作者 赵彬吉
@@ -70,19 +70,22 @@ class AyrReleaseController extends BaseController @@ -70,19 +70,22 @@ class AyrReleaseController extends BaseController
70 //参数处理 70 //参数处理
71 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data); 71 $this->param['mediaUrls'] = $ayrReleaseLogic->image_file_param($data);
72 //时间处理 72 //时间处理
73 - $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s'));  
74 - $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z");  
75 //统一生成发布 73 //统一生成发布
76 $param = [ 74 $param = [
77 'post'=>$this->param['content'], 75 'post'=>$this->param['content'],
78 'platforms'=>$this->param['platforms'], 76 'platforms'=>$this->param['platforms'],
79 'mediaUrls'=>$this->param['mediaUrls'],//参数处理 77 'mediaUrls'=>$this->param['mediaUrls'],//参数处理
80 - 'scheduleDate'=>$formattedTime,//时间(如是过去时间,立即发布)  
81 ]; 78 ];
  79 + if(isset($this->param['schedule_date']) && !empty($this->param['schedule_date'])){
  80 + $datetime = new \DateTime($this->param['schedule_date'] ?? date('Y-m-d H:i:s'));
  81 + $formattedTime = $datetime->format("Y-m-d\TH:i:s\Z");
  82 + $param['scheduleDate'] = $formattedTime;//时间(如是过去时间,立即发布)
  83 + }
82 //发送请求发布社交文章 84 //发送请求发布社交文章
83 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); 85 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
84 //保存数据库 86 //保存数据库
85 - $ayrReleaseLogic->release_add(); 87 + $ayrReleaseLogic->release_add($res);
  88 + //保存返回的内容
86 $this->response('success',Code::SUCCESS,json_decode($res)); 89 $this->response('success',Code::SUCCESS,json_decode($res));
87 } 90 }
88 91
@@ -12,7 +12,10 @@ namespace App\Http\Controllers\Bside\CustomModule; @@ -12,7 +12,10 @@ namespace App\Http\Controllers\Bside\CustomModule;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic; 14 use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic;
  15 +use App\Models\CustomModule\CustomModule;
15 use App\Models\CustomModule\CustomModuleCategory; 16 use App\Models\CustomModule\CustomModuleCategory;
  17 +use App\Models\Template\BTemplate;
  18 +use App\Models\Template\Setting;
16 use App\Models\User\User; 19 use App\Models\User\User;
17 20
18 class CustomModuleCategoryController extends BaseController 21 class CustomModuleCategoryController extends BaseController
@@ -34,7 +37,9 @@ class CustomModuleCategoryController extends BaseController @@ -34,7 +37,9 @@ class CustomModuleCategoryController extends BaseController
34 $this->map['status'] = 0; 37 $this->map['status'] = 0;
35 $list = $customModuleCategory->list($this->map,'sort'); 38 $list = $customModuleCategory->list($this->map,'sort');
36 if(!empty($list)){ 39 if(!empty($list)){
  40 + $template_id = $this->getModuleTemplateId($this->param['module_id']);
37 foreach ($list as $k => $v){ 41 foreach ($list as $k => $v){
  42 + $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM);
38 $v['url'] = $this->user['domain'].$v['route']; 43 $v['url'] = $this->user['domain'].$v['route'];
39 $list[$k] = $v; 44 $list[$k] = $v;
40 } 45 }
@@ -44,6 +49,25 @@ class CustomModuleCategoryController extends BaseController @@ -44,6 +49,25 @@ class CustomModuleCategoryController extends BaseController
44 } 49 }
45 50
46 /** 51 /**
  52 + * @remark :扩展模块获取模版id
  53 + * @name :getTemplateId
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2024/1/31 16:47
  57 + */
  58 + public function getModuleTemplateId($module_id){
  59 + $template_id = 0;
  60 + $moduleModel = new CustomModule();
  61 + $info = $moduleModel->read(['id'=>$module_id]);
  62 + if($info['list_customized'] != 1){
  63 + $bSettingModel = new Setting();
  64 + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  65 + $template_id = $info['template_id'];
  66 + }
  67 + return $this->success($template_id);
  68 + }
  69 +
  70 + /**
47 * @remark :无分页子集处理 71 * @remark :无分页子集处理
48 * @name :getListSon 72 * @name :getListSon
49 * @author :lyh 73 * @author :lyh
@@ -12,9 +12,12 @@ namespace App\Http\Controllers\Bside\CustomModule; @@ -12,9 +12,12 @@ namespace App\Http\Controllers\Bside\CustomModule;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic; 14 use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
  15 +use App\Models\CustomModule\CustomModule;
15 use App\Models\CustomModule\CustomModuleCategory; 16 use App\Models\CustomModule\CustomModuleCategory;
16 use App\Models\CustomModule\CustomModuleContent; 17 use App\Models\CustomModule\CustomModuleContent;
17 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
  19 +use App\Models\Template\BTemplate;
  20 +use App\Models\Template\Setting;
18 use App\Models\User\User; 21 use App\Models\User\User;
19 22
20 class CustomModuleContentController extends BaseController 23 class CustomModuleContentController extends BaseController
@@ -35,12 +38,14 @@ class CustomModuleContentController extends BaseController @@ -35,12 +38,14 @@ class CustomModuleContentController extends BaseController
35 $this->map['project_id'] = $this->user['project_id']; 38 $this->map['project_id'] = $this->user['project_id'];
36 $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order = ['sort','id']); 39 $lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order = ['sort','id']);
37 if(!empty($lists)){ 40 if(!empty($lists)){
  41 + $template_id = $this->getModuleTemplateId($this->param['module_id']);
38 $data = $this->getAllCategoryName(); 42 $data = $this->getAllCategoryName();
39 foreach ($lists['list'] as $k=>$v){ 43 foreach ($lists['list'] as $k=>$v){
40 $v['url'] = $this->getUrl($v); 44 $v['url'] = $this->getUrl($v);
41 $v = $this->getHandleImageFile($v); 45 $v = $this->getHandleImageFile($v);
42 $v['category_name'] = $this->categoryName($v['category_id'],$data); 46 $v['category_name'] = $this->categoryName($v['category_id'],$data);
43 $v['operator_name'] = (new User())->getName($v['operator_id']); 47 $v['operator_name'] = (new User())->getName($v['operator_id']);
  48 + $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_DETAIL,$template_id,$v['id'],BTemplate::IS_CUSTOM);
44 $lists['list'][$k] = $v; 49 $lists['list'][$k] = $v;
45 } 50 }
46 } 51 }
@@ -48,6 +53,25 @@ class CustomModuleContentController extends BaseController @@ -48,6 +53,25 @@ class CustomModuleContentController extends BaseController
48 } 53 }
49 54
50 /** 55 /**
  56 + * @remark :扩展模块获取模版id
  57 + * @name :getTemplateId
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2024/1/31 16:47
  61 + */
  62 + public function getModuleTemplateId($module_id){
  63 + $template_id = 0;
  64 + $moduleModel = new CustomModule();
  65 + $info = $moduleModel->read(['id'=>$module_id]);
  66 + if($info['detail_customized'] != 1){
  67 + $bSettingModel = new Setting();
  68 + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  69 + $template_id = $info['template_id'];
  70 + }
  71 + return $this->success($template_id);
  72 + }
  73 +
  74 + /**
51 * @remark :获取时处理视频,图片,文件 75 * @remark :获取时处理视频,图片,文件
52 * @name :getHandleImageFile 76 * @name :getHandleImageFile
53 * @author :lyh 77 * @author :lyh
@@ -37,12 +37,13 @@ class AyrReleaseLogic extends BaseLogic @@ -37,12 +37,13 @@ class AyrReleaseLogic extends BaseLogic
37 * @method :post 37 * @method :post
38 * @time :2023/5/9 9:38 38 * @time :2023/5/9 9:38
39 */ 39 */
40 - public function release_add(){ 40 + public function release_add($res){
41 $this->param['project_id'] = $this->user['project_id']; 41 $this->param['project_id'] = $this->user['project_id'];
42 $this->param['operator_id'] = $this->user['id']; 42 $this->param['operator_id'] = $this->user['id'];
43 if(isset($this->param['images']) && !empty($this->param['images'])){ 43 if(isset($this->param['images']) && !empty($this->param['images'])){
44 $this->param['images'] = implode(',',$this->param['images']); 44 $this->param['images'] = implode(',',$this->param['images']);
45 } 45 }
  46 + $this->param['result_data'] = $res;
46 $this->param['platforms'] = json_encode($this->param['platforms']); 47 $this->param['platforms'] = json_encode($this->param['platforms']);
47 $rs = $this->model->add($this->param); 48 $rs = $this->model->add($this->param);
48 if($rs === false){ 49 if($rs === false){
@@ -196,7 +196,9 @@ class CategoryLogic extends BaseLogic @@ -196,7 +196,9 @@ class CategoryLogic extends BaseLogic
196 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 196 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
197 //生成一条删除路由记录 197 //生成一条删除路由记录
198 $info = $this->model->read(['id'=>$id],['id','route']); 198 $info = $this->model->read(['id'=>$id],['id','route']);
199 - $this->curlDelRoute(['route'=>$info['route']]); 199 + if($info !== false){
  200 + $this->curlDelRoute(['route'=>$info['route']]);
  201 + }
200 return $this->success(); 202 return $this->success();
201 } 203 }
202 204