深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

选择组件的交互过程

查看数: 320 | 评论数: 3 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2024-6-16 09:42

正文摘要:

回复

syant 发表于 2024-6-16 17:29:21
  1. function addComponent(){
  2.         header("Content-Type:text/html; charset=utf-8");
  3.         $this->isAddComponent = true;
  4.         //1、获取组件数据
  5.         $data = $this->_getComponentData();
  6.                 if(true){
  7.                         $gid='XXX';
  8.                         if(array_key_exists("GroupID",$data)){
  9.                                 $gid=$data["GroupID"];
  10.                                 file_put_contents("c:/cms/tpl/{$gid}.txt",var_export($data,true));
  11.                                 //file_put_contents("c:/tpl/aa2.txt",json_encode($data,JSON_UNESCAPED_UNICODE));
  12.                                 //eval('$bb='.var_export($data,true).";");
  13.                                 //file_put_contents("c:/tpl/aa3.txt",json_encode($bb,JSON_UNESCAPED_UNICODE));
  14.                         }
  15.                 }
复制代码


syant 发表于 2024-6-16 09:56:14
app\lib\common\ydapi.class.php

  1.     /**
  2.      * 获取组件
  3.      */
  4.     function getComponent(){
  5.         $url = "{$this->ApiUrl}Component/getComponent";
  6.         $params = array();
  7.         $this->_getPublicParams($params);
  8.         $result = yd_curl_post($url, $params);
  9.         $result = json_decode($result, true);
  10.         if(1 == $result['Status']){
  11.             return $result['Data'];
  12.         }else{
  13.             $this->LastError = $result['Message'];
  14.             $this->Code = $result['Code'];
  15.             return false;
  16.         }
  17.     }
复制代码


syant 发表于 2024-6-16 09:53:19
\app\lib\action\admin\decorationaction.class.php
  1.     /**
  2.      * 获取所有组件
  3.      */
  4.     function getComponent(){
  5.         header("Content-Type:text/html; charset=utf-8");
  6.         $Slot = isset($_POST['Slot']) ? $_POST['Slot'] : 0;
  7.         $api = $this->_getApiInstance();
  8.         $result = $api->getComponent();
  9.         if(false !== $result){
  10.             //一般添加,不显示子组件==========================
  11.             if(empty($Slot)){
  12.                 $data = array();
  13.                 foreach($result as $v){
  14.                     if($v['ComponentClassKey'] != 'child'){
  15.                         $data[] = $v;
  16.                     }
  17.                 }
  18.                 //======================================
  19.                 $result = $data;
  20.             }
  21.             $this->ajaxReturn($result, "" , 1);
  22.         }else{
  23.             $error = $api->getLastError();
  24.             $this->ajaxReturn(null,"获取组件失败!{$error}", 0);
  25.         }
  26.     }
复制代码





QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-5 04:03 , Processed in 0.032356 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表