|
@@ -80,7 +80,8 @@ class BTemplateLogic extends BaseLogic |
|
@@ -80,7 +80,8 @@ class BTemplateLogic extends BaseLogic |
|
80
|
$mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
|
80
|
$mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
|
|
81
|
}else{
|
81
|
}else{
|
|
82
|
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
|
82
|
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
|
|
83
|
- $commonInfo = $this->getCommonHtml($this->param['source'],$is_list,0);//获取定制头部
|
83
|
+ $type = $this->getCustomizedType($this->param['source'],$is_list);
|
|
|
|
84
|
+ $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
|
|
84
|
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
|
85
|
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
|
|
85
|
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
|
86
|
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
|
|
86
|
}
|
87
|
}
|
|
@@ -172,7 +173,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -172,7 +173,7 @@ class BTemplateLogic extends BaseLogic |
|
172
|
if($customHtmlInfo === false){
|
173
|
if($customHtmlInfo === false){
|
|
173
|
$this->fail('定制页面,请先上传代码块');
|
174
|
$this->fail('定制页面,请先上传代码块');
|
|
174
|
}
|
175
|
}
|
|
175
|
- $commonInfo = $this->getCommonHtml($type,$is_list,0);//获取定制头部
|
176
|
+ $commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
|
|
176
|
if($commonInfo !== false){
|
177
|
if($commonInfo !== false){
|
|
177
|
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
|
178
|
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
|
|
178
|
}
|
179
|
}
|
|
@@ -182,7 +183,24 @@ class BTemplateLogic extends BaseLogic |
|
@@ -182,7 +183,24 @@ class BTemplateLogic extends BaseLogic |
|
182
|
}
|
183
|
}
|
|
183
|
|
184
|
|
|
184
|
/**
|
185
|
/**
|
|
185
|
- * @remark :根据source获取type类型
|
186
|
+ * @remark :定制项目获取头部底部
|
|
|
|
187
|
+ * @name :getCustomizedCommonHtml
|
|
|
|
188
|
+ * @author :lyh
|
|
|
|
189
|
+ * @method :post
|
|
|
|
190
|
+ * @time :2023/12/29 13:13
|
|
|
|
191
|
+ */
|
|
|
|
192
|
+ public function getCustomizedCommonHtml($type){
|
|
|
|
193
|
+ $data = [
|
|
|
|
194
|
+ 'template_id' => 0,
|
|
|
|
195
|
+ 'project_id' => $this->user['project_id'],
|
|
|
|
196
|
+ 'type'=>$type
|
|
|
|
197
|
+ ];
|
|
|
|
198
|
+ $commonTemplateModel = new BTemplateCommon();
|
|
|
|
199
|
+ return $commonTemplateModel->read($data);
|
|
|
|
200
|
+ }
|
|
|
|
201
|
+
|
|
|
|
202
|
+ /**
|
|
|
|
203
|
+ * @remark :定制页面头部类型---根据source获取type类型
|
|
186
|
* @name :getType
|
204
|
* @name :getType
|
|
187
|
* @author :lyh
|
205
|
* @author :lyh
|
|
188
|
* @method :post
|
206
|
* @method :post
|
|
@@ -248,7 +266,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -248,7 +266,7 @@ class BTemplateLogic extends BaseLogic |
|
248
|
* @time :2023/10/21 16:55
|
266
|
* @time :2023/10/21 16:55
|
|
249
|
*/
|
267
|
*/
|
|
250
|
public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){
|
268
|
public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){
|
|
251
|
- $type = $this->getType($source,$is_list,$template_id,$is_custom);
|
269
|
+ $type = $this->getType($source,$is_list,$is_custom);
|
|
252
|
$data = [
|
270
|
$data = [
|
|
253
|
'template_id' => $template_id,
|
271
|
'template_id' => $template_id,
|
|
254
|
'project_id' => $this->user['project_id'],
|
272
|
'project_id' => $this->user['project_id'],
|
|
@@ -365,7 +383,11 @@ class BTemplateLogic extends BaseLogic |
|
@@ -365,7 +383,11 @@ class BTemplateLogic extends BaseLogic |
|
365
|
* @time :2023/12/13 17:05
|
383
|
* @time :2023/12/13 17:05
|
|
366
|
*/
|
384
|
*/
|
|
367
|
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
|
385
|
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
|
|
368
|
- $type = $this->getType($source,$is_list,$template_id,$is_custom);//获取头部类型1-9(首页到自定义页面)
|
386
|
+ if($template_id != 0){
|
|
|
|
387
|
+ $type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
|
|
|
|
388
|
+ }else{
|
|
|
|
389
|
+ $type = $this->getCustomizedType($source,$is_list);
|
|
|
|
390
|
+ }
|
|
369
|
$templateCommonModel = new BTemplateCommon();
|
391
|
$templateCommonModel = new BTemplateCommon();
|
|
370
|
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
|
392
|
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
|
|
371
|
$handleInfo = $this->handleCommonParam($html);
|
393
|
$handleInfo = $this->handleCommonParam($html);
|
|
@@ -440,15 +462,12 @@ class BTemplateLogic extends BaseLogic |
|
@@ -440,15 +462,12 @@ class BTemplateLogic extends BaseLogic |
|
440
|
* @method :post
|
462
|
* @method :post
|
|
441
|
* @time :2023/10/21 17:29
|
463
|
* @time :2023/10/21 17:29
|
|
442
|
*/
|
464
|
*/
|
|
443
|
- public function getType($source,$is_list,$template_id,$is_custom = 0){
|
465
|
+ public function getType($source,$is_list,$is_custom = 0){
|
|
444
|
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
|
466
|
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
|
|
445
|
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
|
467
|
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
|
|
446
|
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
|
468
|
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
|
|
447
|
return $this->success($type);
|
469
|
return $this->success($type);
|
|
448
|
}
|
470
|
}
|
|
449
|
- if($template_id == 0){//保存上传的代码块时,默认为独立头部
|
|
|
|
450
|
- $is_head == BTemplate::IS_HEADER;
|
|
|
|
451
|
- }
|
|
|
|
452
|
//查看页面是否设置自定义头部底部
|
471
|
//查看页面是否设置自定义头部底部
|
|
453
|
if($is_head != BTemplate::IS_NO_HEADER) {
|
472
|
if($is_head != BTemplate::IS_NO_HEADER) {
|
|
454
|
$pageSettingModel = new PageSetting();
|
473
|
$pageSettingModel = new PageSetting();
|
|
@@ -467,6 +486,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -467,6 +486,7 @@ class BTemplateLogic extends BaseLogic |
|
467
|
return $this->success($type);
|
486
|
return $this->success($type);
|
|
468
|
}
|
487
|
}
|
|
469
|
|
488
|
|
|
|
|
489
|
+
|
|
470
|
/**
|
490
|
/**
|
|
471
|
* @remark :生成记录
|
491
|
* @remark :生成记录
|
|
472
|
* @name :setTemplateLog
|
492
|
* @name :setTemplateLog
|