作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !352
@@ -65,6 +65,7 @@ class OnlineController extends BaseController @@ -65,6 +65,7 @@ class OnlineController extends BaseController
65 'gl_project.channel AS channel', 65 'gl_project.channel AS channel',
66 'gl_project.type AS type', 66 'gl_project.type AS type',
67 'gl_project.created_at AS created_at', 67 'gl_project.created_at AS created_at',
  68 + 'gl_project.is_upgrade AS is_upgrade',
68 'gl_project_online_check.id AS online_check_id', 69 'gl_project_online_check.id AS online_check_id',
69 'gl_project_online_check.question AS question', 70 'gl_project_online_check.question AS question',
70 'gl_project_online_check.optimist_status AS optimist_status', 71 'gl_project_online_check.optimist_status AS optimist_status',
@@ -145,6 +146,9 @@ class OnlineController extends BaseController @@ -145,6 +146,9 @@ class OnlineController extends BaseController
145 if(isset($this->map['all_status'])){ 146 if(isset($this->map['all_status'])){
146 $query->where('gl_project_online_check.qa_status',$this->map['all_status']); 147 $query->where('gl_project_online_check.qa_status',$this->map['all_status']);
147 } 148 }
  149 + if(isset($this->map['is_upgrade'])){
  150 + $query->where('gl_project.is_upgrade',$this->map['is_upgrade']);
  151 + }
148 if(isset($this->map['optimist_status'])){ 152 if(isset($this->map['optimist_status'])){
149 $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']); 153 $query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']);
150 } 154 }
@@ -133,6 +133,7 @@ class OptimizeController extends BaseController @@ -133,6 +133,7 @@ class OptimizeController extends BaseController
133 'gl_project.robots AS robots', 133 'gl_project.robots AS robots',
134 'gl_project.is_translate AS is_translate', 134 'gl_project.is_translate AS is_translate',
135 'gl_project.is_translate_tag AS is_translate_tag', 135 'gl_project.is_translate_tag AS is_translate_tag',
  136 + 'gl_project.is_upgrade AS is_upgrade',
136 'gl_project_online_check.id AS online_check_id', 137 'gl_project_online_check.id AS online_check_id',
137 'gl_project_online_check.question AS question', 138 'gl_project_online_check.question AS question',
138 'gl_project_online_check.go_question AS go_question', 139 'gl_project_online_check.go_question AS go_question',
@@ -191,6 +192,9 @@ class OptimizeController extends BaseController @@ -191,6 +192,9 @@ class OptimizeController extends BaseController
191 if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){ 192 if(isset($this->map['optimize_manager_mid']) && !empty($this->map['optimize_manager_mid'])){
192 $query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%'); 193 $query = $query->where('gl_project_deploy_optimize.manager_mid','like','%'.$this->map['optimize_manager_mid'].'%');
193 } 194 }
  195 + if(isset($this->map['is_upgrade']) && !empty($this->map['is_upgrade'])){
  196 + $query = $query->where('gl_project.is_upgrade',$this->map['is_upgrade']);
  197 + }
194 if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){ 198 if(isset($this->map['optimize_tech_mid']) && !empty($this->map['optimize_tech_mid'])){
195 $query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%'); 199 $query = $query->where('gl_project_deploy_optimize.tech_mid','like','%'.$this->map['optimize_tech_mid'].'%');
196 } 200 }
@@ -240,7 +240,7 @@ class ProductController extends BaseController @@ -240,7 +240,7 @@ class ProductController extends BaseController
240 } 240 }
241 $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; 241 $v['status_text'] = Product::statusMap()[$v['status']] ?? '';
242 //获取当前用户选择的模版 242 //获取当前用户选择的模版
243 - $v['video'] = json_decode($v['video']); 243 + $v['video'] = json_decode($v['video'] ?? '');
244 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL); 244 $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
245 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']); 245 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
246 $v['url'] = $this->user['domain'].$v['route']; 246 $v['url'] = $this->user['domain'].$v['route'];
@@ -421,4 +421,16 @@ class ProductController extends BaseController @@ -421,4 +421,16 @@ class ProductController extends BaseController
421 $logic->setSort(); 421 $logic->setSort();
422 $this->response('success'); 422 $this->response('success');
423 } 423 }
  424 +
  425 + /**
  426 + * @remark :批量更新排序
  427 + * @name :allSort
  428 + * @author :lyh
  429 + * @method :post
  430 + * @time :2024/1/10 15:34
  431 + */
  432 + public function allSort(ProductLogic $logic){
  433 + $logic->setAllSort();
  434 + $this->response('success');
  435 + }
424 } 436 }
@@ -66,43 +66,118 @@ class BTemplateLogic extends BaseLogic @@ -66,43 +66,118 @@ class BTemplateLogic extends BaseLogic
66 public function getTemplateHtml(){ 66 public function getTemplateHtml(){
67 $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块 67 $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
68 $is_list = $this->param['is_list'] ?? 0;//是否为列表页 68 $is_list = $this->param['is_list'] ?? 0;//是否为列表页
69 - $template_id = $this->getSettingTemplate($this->param['source'],$is_list);//设置的模版id  
70 - $templateInfo = $this->model->read([  
71 - 'template_id'=>$template_id, 'source'=>$this->param['source'],  
72 - 'project_id'=>$this->user['project_id'], 'source_id'=>$this->param['source_id'],  
73 - 'is_custom'=>$is_custom, 'is_list'=>$is_list  
74 - ]); 69 + $template_id = $this->getSettingTemplate($this->param['source'],$is_list,$is_custom);//设置的模版id
  70 + $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$template_id,$is_custom,$is_list);
75 if($templateInfo === false){ 71 if($templateInfo === false){
76 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据 72 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//处理定制页面初始数据
77 - $html = $this->isCustomizedPage($this->param['source'],$is_list);//获取定制页面的html  
78 - if(!empty($html)){  
79 - return $this->success(['html'=>$html,'template_id'=>$template_id]); 73 + $html = $this->customizedReturnHtml($this->param['source'],$template_id,$is_custom,$is_list);
  74 + if($html !== false){
  75 + return $this->success($html);
80 } 76 }
81 } 77 }
  78 + //非定制初始中间部分
82 $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码 79 $mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
83 }else{ 80 }else{
84 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 81 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
85 - $type = $this->getCustomizedType($this->param['source'],$is_list);  
86 - $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部  
87 - $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);  
88 - return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]); 82 + return $this->getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list);
89 } 83 }
90 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']]; 84 $mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
91 } 85 }
92 - $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取定制头部  
93 - $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].  
94 - $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html']; 86 + $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,$template_id,$is_custom);//获取非定制头部
  87 + $html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
95 $html = $this->getHeadFooter($html); 88 $html = $this->getHeadFooter($html);
96 $result = ['html'=>$html,'template_id'=>$template_id]; 89 $result = ['html'=>$html,'template_id'=>$template_id];
97 - if($templateInfo !== false)  
98 - {  
99 - $result['id'] = $templateInfo['id'];  
100 - $result['updated_at'] = $templateInfo['updated_at'];  
101 - } 90 + if($templateInfo !== false) {$result['id'] = $templateInfo['id'];$result['updated_at'] = $templateInfo['updated_at'];}
102 return $this->success($result); 91 return $this->success($result);
103 } 92 }
104 93
105 /** 94 /**
  95 + * @remark :获取整个html代码
  96 + * @name :getCustomizeAllHtml
  97 + * @author :lyh
  98 + * @method :post
  99 + * @time :2024/1/10 14:15
  100 + */
  101 + public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){
  102 + if($is_custom == BTemplate::IS_CUSTOM){
  103 + $commonInfo = $this->getCustomizedCommonHtml($this->param['source'],$is_custom,$is_list);//获取定制头部
  104 + $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
  105 + }else{
  106 + $type = $this->getCustomizedType($this->param['source'],$is_list);
  107 + $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部
  108 + $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
  109 + }
  110 + return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
  111 + }
  112 +
  113 + /**
  114 + * @remark :获取装修详情
  115 + * @name :webTemplateInfo
  116 + * @author :lyh
  117 + * @method :post
  118 + * @time :2024/1/10 13:43
  119 + */
  120 + public function webTemplateInfo($source,$source_id,$template_id,$is_custom,$is_list){
  121 + $templateInfo = $this->model->read([
  122 + 'template_id'=>$template_id, 'source'=>$source,
  123 + 'project_id'=>$this->user['project_id'], 'source_id'=>$source_id,
  124 + 'is_custom'=>$is_custom, 'is_list'=>$is_list
  125 + ]);
  126 + return $this->success($templateInfo);
  127 + }
  128 +
  129 + /**
  130 + * @remark :定制页面获取html
  131 + * @name :customizedReturnHtml
  132 + * @author :lyh
  133 + * @method :post
  134 + * @time :2024/1/10 13:46
  135 + */
  136 + public function customizedReturnHtml($source,$template_id,$is_custom,$is_list){
  137 + //TODO::扩展模块定制单独处理
  138 + if($is_custom == BTemplate::IS_CUSTOM){
  139 + $customModuleModel = new CustomModule();
  140 + $info = $customModuleModel->read(['id'=>$source]);
  141 + if($info === false){
  142 + $this->fail('当前扩展模块不存在或已被删除');
  143 + }
  144 + //扩展模块定制
  145 + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){
  146 + $html = $this->customModuleCustomizeHtml($source,$is_list,$is_custom);
  147 + return $this->success(['html'=>$html,'template_id'=>$template_id]);
  148 + }
  149 + return false;
  150 + }
  151 + //TODO::默认模块定制
  152 + $html = $this->isCustomizedPage($source,$is_list);//获取定制页面的html
  153 + if(!empty($html)){
  154 + return $this->success(['html'=>$html,'template_id'=>$template_id]);
  155 + }
  156 + return false;
  157 + }
  158 +
  159 + /**
  160 + * @remark :扩展模块定制html
  161 + * @name :customModuleInfo
  162 + * @author :lyh
  163 + * @method :post
  164 + * @time :2024/1/10 9:20
  165 + */
  166 + public function customModuleCustomizeHtml($source,$is_list,$is_custom){
  167 + $bTemplateMainModel = new BTemplateMain();
  168 + //TODO::获取初始代码
  169 + $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list,'is_custom'=>$is_custom]);
  170 + if($customHtmlInfo === false){
  171 + $this->fail('定制页面,请先上传代码块');
  172 + }
  173 + $commonInfo = $this->getCustomizedCommonHtml($source,$is_custom,$is_list);//获取定制头部
  174 + if($commonInfo !== false){
  175 + $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
  176 + }
  177 + return $customHtmlInfo['main_html'];
  178 + }
  179 +
  180 + /**
106 * @remark :获取中间部分的html 181 * @remark :获取中间部分的html
107 * @name :getMAinHtml 182 * @name :getMAinHtml
108 * @author :lyh 183 * @author :lyh
@@ -163,7 +238,7 @@ class BTemplateLogic extends BaseLogic @@ -163,7 +238,7 @@ class BTemplateLogic extends BaseLogic
163 * @method :post 238 * @method :post
164 * @time :2023/12/13 10:55 239 * @time :2023/12/13 10:55
165 */ 240 */
166 - public function isCustomizedPage($source,$is_list) 241 + public function isCustomizedPage($source,$is_list,$is_custom)
167 { 242 {
168 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 243 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
169 //查看当前页面是否定制,是否开启可视化 244 //查看当前页面是否定制,是否开启可视化
@@ -171,17 +246,17 @@ class BTemplateLogic extends BaseLogic @@ -171,17 +246,17 @@ class BTemplateLogic extends BaseLogic
171 if (in_array($type, $page_array)) {//是定制界面 246 if (in_array($type, $page_array)) {//是定制界面
172 //TODO::获取初始代码 247 //TODO::获取初始代码
173 $bTemplateMainModel = new BTemplateMain(); 248 $bTemplateMainModel = new BTemplateMain();
174 - $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_list'=>$is_list]); 249 + $customHtmlInfo = $bTemplateMainModel->read(['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list]);
175 if($customHtmlInfo === false){ 250 if($customHtmlInfo === false){
176 $this->fail('定制页面,请先上传代码块'); 251 $this->fail('定制页面,请先上传代码块');
177 } 252 }
178 - $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部 253 + $commonInfo = $this->getCustomizedCommonHtml($type,$is_custom,$is_list);//获取定制头部
179 if($commonInfo !== false){ 254 if($commonInfo !== false){
180 $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']); 255 $customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
181 } 256 }
182 return $customHtmlInfo['main_html']; 257 return $customHtmlInfo['main_html'];
183 } 258 }
184 - return []; 259 + return false;
185 } 260 }
186 261
187 /** 262 /**
@@ -191,11 +266,13 @@ class BTemplateLogic extends BaseLogic @@ -191,11 +266,13 @@ class BTemplateLogic extends BaseLogic
191 * @method :post 266 * @method :post
192 * @time :2023/12/29 13:13 267 * @time :2023/12/29 13:13
193 */ 268 */
194 - public function getCustomizedCommonHtml($type){ 269 + public function getCustomizedCommonHtml($type,$is_custom = 0,$is_list = 0){
195 $data = [ 270 $data = [
196 'template_id' => 0, 271 'template_id' => 0,
197 'project_id' => $this->user['project_id'], 272 'project_id' => $this->user['project_id'],
198 - 'type'=>$type 273 + 'type'=>$type,
  274 + 'is_custom'=>$is_custom,
  275 + 'is_list'=>$is_list
199 ]; 276 ];
200 $commonTemplateModel = new BTemplateCommon(); 277 $commonTemplateModel = new BTemplateCommon();
201 return $commonTemplateModel->read($data); 278 return $commonTemplateModel->read($data);
@@ -241,14 +318,25 @@ class BTemplateLogic extends BaseLogic @@ -241,14 +318,25 @@ class BTemplateLogic extends BaseLogic
241 * @method :post 318 * @method :post
242 * @time :2023/12/13 10:48 319 * @time :2023/12/13 10:48
243 */ 320 */
244 - public function getSettingTemplate($source,$is_list){ 321 + public function getSettingTemplate($source,$is_list,$is_custom){
245 $template_id = 0; 322 $template_id = 0;
246 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目 323 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
247 - $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型  
248 - //查看当前页面是否定制,是否开启可视化  
249 - $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面  
250 - if (in_array($type, $page_array)) {//是定制界面  
251 - return $this->success($template_id); 324 + if($is_custom == BTemplate::IS_CUSTOM){
  325 + $customModuleModel = new CustomModule();
  326 + $info = $customModuleModel->read(['id'=>$source]);
  327 + if($info === false){
  328 + $this->fail('当前扩展模块不存在或已被删除');
  329 + }
  330 + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION){
  331 + return $this->success($template_id);
  332 + }
  333 + }else{
  334 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
  335 + //查看当前页面是否定制,是否开启可视化
  336 + $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
  337 + if (in_array($type, $page_array)) {//是定制界面
  338 + return $this->success($template_id);
  339 + }
252 } 340 }
253 } 341 }
254 $bSettingModel = new Setting(); 342 $bSettingModel = new Setting();
@@ -272,7 +360,8 @@ class BTemplateLogic extends BaseLogic @@ -272,7 +360,8 @@ class BTemplateLogic extends BaseLogic
272 $data = [ 360 $data = [
273 'template_id' => $template_id, 361 'template_id' => $template_id,
274 'project_id' => $this->user['project_id'], 362 'project_id' => $this->user['project_id'],
275 - 'type'=>$type 363 + 'type'=>$type,
  364 + 'is_custom'=>$is_custom,
276 ]; 365 ];
277 $commonTemplateModel = new BTemplateCommon(); 366 $commonTemplateModel = new BTemplateCommon();
278 $commonInfo = $commonTemplateModel->read($data); 367 $commonInfo = $commonTemplateModel->read($data);
@@ -294,16 +383,10 @@ class BTemplateLogic extends BaseLogic @@ -294,16 +383,10 @@ class BTemplateLogic extends BaseLogic
294 * @time :2023/6/29 11:05 383 * @time :2023/6/29 11:05
295 */ 384 */
296 public function templateSave(){ 385 public function templateSave(){
297 - //演示项目不允许修改 386 + //TODO::演示项目不允许修改
298 $this->showProjectNoEdit($this->param['source']); 387 $this->showProjectNoEdit($this->param['source']);
299 $this->param = $this->handleDefaultString($this->param);//设置默认数据 388 $this->param = $this->handleDefaultString($this->param);//设置默认数据
300 - $templateInfo = $this->model->read([  
301 - 'template_id'=>$this->param['template_id'],  
302 - 'source'=>$this->param['source'],  
303 - 'source_id'=>$this->param['source_id'],  
304 - 'is_custom'=>$this->param['is_custom'],  
305 - 'is_list'=>$this->param['is_list']  
306 - ]); 389 + $templateInfo = $this->webTemplateInfo($this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']);
307 if($templateInfo === false){//执行新增 390 if($templateInfo === false){//执行新增
308 $data = [ 391 $data = [
309 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML, 392 'source'=>$this->param['source'], 'source_id'=>$this->param['source_id'],'type'=>BTemplate::PAGE_HTML,
@@ -311,7 +394,7 @@ class BTemplateLogic extends BaseLogic @@ -311,7 +394,7 @@ class BTemplateLogic extends BaseLogic
311 'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'], 394 'section_list_id'=>$this->param['section_list_id'],'is_custom'=>$this->param['is_custom'],
312 'is_list'=>$this->param['is_list'] 395 'is_list'=>$this->param['is_list']
313 ]; 396 ];
314 - $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data); 397 + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data);
315 $this->model->add($data); 398 $this->model->add($data);
316 }else{//执行编辑 399 }else{//执行编辑
317 $condition = [ 400 $condition = [
@@ -322,7 +405,7 @@ class BTemplateLogic extends BaseLogic @@ -322,7 +405,7 @@ class BTemplateLogic extends BaseLogic
322 $data = [ 405 $data = [
323 'section_list_id'=>$this->param['section_list_id'] 406 'section_list_id'=>$this->param['section_list_id']
324 ]; 407 ];
325 - $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$data); 408 + $data = $this->handleVisualizationParam($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['is_custom'],$data);
326 $this->model->edit($data,$condition); 409 $this->model->edit($data,$condition);
327 } 410 }
328 //更新头部信息 411 //更新头部信息
@@ -355,7 +438,7 @@ class BTemplateLogic extends BaseLogic @@ -355,7 +438,7 @@ class BTemplateLogic extends BaseLogic
355 * @method :post 438 * @method :post
356 * @time :2023/12/15 10:59 439 * @time :2023/12/15 10:59
357 */ 440 */
358 - public function handleVisualizationParam($html,$source, $is_list,$data){ 441 + public function handleVisualizationParam($html,$source, $is_list,$is_custom,$data){
359 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目 442 if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION){//定制项目
360 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型 443 $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
361 //查看当前页面是否定制,是否开启可视化 444 //查看当前页面是否定制,是否开启可视化
@@ -364,6 +447,19 @@ class BTemplateLogic extends BaseLogic @@ -364,6 +447,19 @@ class BTemplateLogic extends BaseLogic
364 $data['html'] = $html; 447 $data['html'] = $html;
365 $data['type'] = BTemplate::ALL_HTML; 448 $data['type'] = BTemplate::ALL_HTML;
366 }else{ 449 }else{
  450 + //TODO::扩展模块定制单独处理
  451 + if($is_custom == BTemplate::IS_CUSTOM){
  452 + $customModuleModel = new CustomModule();
  453 + $info = $customModuleModel->read(['id'=>$source]);
  454 + if($info === false){
  455 + $this->fail('当前扩展模块不存在或已被删除');
  456 + }
  457 + //todo::扩展模块(列表页/详情页)定制
  458 + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
  459 + $data['html'] = $html;
  460 + $data['type'] = BTemplate::ALL_HTML;
  461 + }
  462 + }
367 $mainInfo = $this->handleTemplateHtml($html); 463 $mainInfo = $this->handleTemplateHtml($html);
368 $data['main_html'] = $mainInfo['main_html']; 464 $data['main_html'] = $mainInfo['main_html'];
369 $data['main_css'] = $mainInfo['main_css']; 465 $data['main_css'] = $mainInfo['main_css'];
@@ -376,7 +472,6 @@ class BTemplateLogic extends BaseLogic @@ -376,7 +472,6 @@ class BTemplateLogic extends BaseLogic
376 return $data; 472 return $data;
377 } 473 }
378 474
379 -  
380 /** 475 /**
381 * @remark :保存公共头部底部 476 * @remark :保存公共头部底部
382 * @name :saveCommonHtml 477 * @name :saveCommonHtml
@@ -385,12 +480,20 @@ class BTemplateLogic extends BaseLogic @@ -385,12 +480,20 @@ class BTemplateLogic extends BaseLogic
385 * @time :2023/12/13 17:05 480 * @time :2023/12/13 17:05
386 */ 481 */
387 public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){ 482 public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
  483 + //TODO::定制扩展模块单独处理
  484 + if($is_custom == BTemplate::IS_CUSTOM){
  485 + $code = $this->saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id);
  486 + if($code === false){
  487 + return $this->success();
  488 + }
  489 + }
  490 + //其他情况
388 $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面) 491 $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
389 if($template_id == 0){//定制页面默认为独立头部 492 if($template_id == 0){//定制页面默认为独立头部
390 $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部 493 $type = $this->getCustomizedType($source,$is_list);//定制默认独立头部
391 } 494 }
392 $templateCommonModel = new BTemplateCommon(); 495 $templateCommonModel = new BTemplateCommon();
393 - $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在 496 + $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>0]);//查看当前头部是否存在
394 $handleInfo = $this->handleCommonParam($html); 497 $handleInfo = $this->handleCommonParam($html);
395 if($commonInfo === false){ 498 if($commonInfo === false){
396 $data = [ 499 $data = [
@@ -411,6 +514,45 @@ class BTemplateLogic extends BaseLogic @@ -411,6 +514,45 @@ class BTemplateLogic extends BaseLogic
411 } 514 }
412 515
413 /** 516 /**
  517 + * @remark :扩展模块定制保存头部处理
  518 + * @name :saveCustomModuleCommonHtml
  519 + * @author :lyh
  520 + * @method :post
  521 + * @time :2024/1/10 11:33
  522 + */
  523 + public function saveCustomModuleCommonHtml($html,$source,$is_custom,$is_list,$template_id){
  524 + $customModuleModel = new CustomModule();
  525 + $info = $customModuleModel->read(['id'=>$source]);
  526 + if($info === false){
  527 + $this->fail('当前扩展模块不存在或已被删除');
  528 + }
  529 + //todo::扩展模块(列表页/详情页)定制
  530 + if($info['list_customized'] == BTemplate::IS_VISUALIZATION || $info['detail_customized'] == BTemplate::IS_VISUALIZATION) {
  531 + $data = ['type'=>$source,'is_custom'=>$is_custom,'is_list'=>$is_list,'template_id'=>$template_id];
  532 + $templateCommonModel = new BTemplateCommon();
  533 + $commonInfo = $templateCommonModel->read($data);//查看当前头部是否存在
  534 + $handleInfo = $this->handleCommonParam($html);
  535 + if($commonInfo === false){
  536 + $data = [
  537 + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
  538 + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
  539 + 'type'=>$source,'template_id'=>$template_id, 'project_id'=>$this->user['project_id'],
  540 + 'is_custom'=>$is_custom,'is_list'=>$is_list,
  541 + ];
  542 + $templateCommonModel->add($data);
  543 + }else{
  544 + $data = [
  545 + 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],'other'=>$handleInfo['other'],
  546 + 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
  547 + ];
  548 + $templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
  549 + }
  550 + return false;
  551 + }
  552 + return true;
  553 + }
  554 +
  555 + /**
414 * @remark :演示项目不允许修改首页 556 * @remark :演示项目不允许修改首页
415 * @name :showProject 557 * @name :showProject
416 * @author :lyh 558 * @author :lyh
@@ -457,7 +599,7 @@ class BTemplateLogic extends BaseLogic @@ -457,7 +599,7 @@ class BTemplateLogic extends BaseLogic
457 return $this->success($param); 599 return $this->success($param);
458 } 600 }
459 /** 601 /**
460 - * @remark :保存时获取获取设置的类型 602 + * @remark :(非定制)保存时获取获取设置的类型
461 * @name :getType 603 * @name :getType
462 * @author :lyh 604 * @author :lyh
463 * @method :post 605 * @method :post
@@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic @@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic
599 } 599 }
600 600
601 /** 601 /**
  602 + * @remark :
  603 + * @name :setAllSort
  604 + * @author :lyh
  605 + * @method :post
  606 + * @time :2024/1/10 15:40
  607 + */
  608 + public function setAllSort(){
  609 + foreach ($this->param['data'] as $k => $v){
  610 + $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
  611 + }
  612 + return $this->success();
  613 + }
  614 +
  615 + /**
602 * 产品导入 616 * 产品导入
603 * @param $project_id 617 * @param $project_id
604 * @param $user_id 618 * @param $user_id
@@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic @@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic
722 if($data[10]??''){ 736 if($data[10]??''){
723 $seo_description = substr(strip_tags($data[10]),0,200); 737 $seo_description = substr(strip_tags($data[10]),0,200);
724 } 738 }
725 -  
726 $seo_mate = [ 739 $seo_mate = [
727 'title' => $seo_title, 740 'title' => $seo_title,
728 'keyword' => $seo_keywords, 741 'keyword' => $seo_keywords,
729 'description' => $seo_description 742 'description' => $seo_description
730 ]; 743 ];
731 -  
732 //处理参数 744 //处理参数
733 $attrs = []; 745 $attrs = [];
734 if($data[4]??''){ 746 if($data[4]??''){
@@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic @@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic
746 } 758 }
747 } 759 }
748 } 760 }
749 -  
750 //处理描述切换栏 761 //处理描述切换栏
751 $describe = []; 762 $describe = [];
752 -  
753 for ($i=11;$i<=20;$i+=2){ 763 for ($i=11;$i<=20;$i+=2){
754 if(($data[$i]??'') && ($data[$i+1]??'')){ 764 if(($data[$i]??'') && ($data[$i+1]??'')){
755 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc); 765 preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc);
@@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic @@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic
759 $new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]); 769 $new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]);
760 } 770 }
761 } 771 }
762 -  
763 preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video); 772 preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video);
764 if($result_desc_video[2]??[]){ 773 if($result_desc_video[2]??[]){
765 foreach ($result_desc_video[2] as $vdesc_video){ 774 foreach ($result_desc_video[2] as $vdesc_video){
@@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic @@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic
776 break; 785 break;
777 } 786 }
778 } 787 }
779 -  
780 $id = $this->model->addReturnId( 788 $id = $this->model->addReturnId(
781 [ 789 [
782 'project_id' => $project_id, 790 'project_id' => $project_id,
@@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic @@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic
794 'status' => Product::STATUS_ON 802 'status' => Product::STATUS_ON
795 ] 803 ]
796 ); 804 );
797 -  
798 //更新路由 805 //更新路由
799 if($route){ 806 if($route){
800 $route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first(); 807 $route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first();
@@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic @@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic
810 }else{ 817 }else{
811 $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id); 818 $route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
812 } 819 }
813 -  
814 $this->edit(['route' => $route], ['id' => $id]); 820 $this->edit(['route' => $route], ['id' => $id]);
815 -  
816 //关联分类 821 //关联分类
817 if($category_arr){ 822 if($category_arr){
818 CategoryRelated::saveRelated($id, $category_arr); 823 CategoryRelated::saveRelated($id, $category_arr);
819 } 824 }
820 -  
821 return true; 825 return true;
822 } 826 }
823 -  
824 return false; 827 return false;
825 } 828 }
826 } 829 }
@@ -204,6 +204,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -204,6 +204,7 @@ Route::middleware(['bloginauth'])->group(function () {
204 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); 204 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save');
205 Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList'); 205 Route::post('/editList', [\App\Http\Controllers\Bside\Product\ProductController::class, 'editList'])->name('product_editList');
206 Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort'); 206 Route::post('/sort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'sort'])->name('product_sort');
  207 + Route::post('/allSort', [\App\Http\Controllers\Bside\Product\ProductController::class, 'allSort'])->name('product_allSort');
207 Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete'); 208 Route::any('/delete', [\App\Http\Controllers\Bside\Product\ProductController::class, 'delete'])->name('product_delete');
208 Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum'); 209 Route::any('/statusNum', [\App\Http\Controllers\Bside\Product\ProductController::class, 'getStatusNumber'])->name('product_statusNum');
209 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct'); 210 Route::any('/copyProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'copyProduct'])->name('product_copyProduct');