|
@@ -65,11 +65,57 @@ class BTemplateLogic extends BaseLogic |
|
@@ -65,11 +65,57 @@ class BTemplateLogic extends BaseLogic |
|
65
|
*/
|
65
|
*/
|
|
66
|
public function getTemplate(){
|
66
|
public function getTemplate(){
|
|
67
|
$template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id
|
67
|
$template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id
|
|
68
|
- $data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);
|
68
|
+ $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
|
|
|
|
69
|
+ $is_list = $this->param['is_list'] ?? 0;//是否为
|
|
|
|
70
|
+ $data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$is_custom);
|
|
69
|
return $this->success($data);
|
71
|
return $this->success($data);
|
|
70
|
}
|
72
|
}
|
|
71
|
|
73
|
|
|
72
|
/**
|
74
|
/**
|
|
|
|
75
|
+ * @remark :获取可视化html
|
|
|
|
76
|
+ * @name :getTemplateHtml
|
|
|
|
77
|
+ * @author :lyh
|
|
|
|
78
|
+ * @method :post
|
|
|
|
79
|
+ * @time :2023/12/27 14:48
|
|
|
|
80
|
+ */
|
|
|
|
81
|
+ public function getTemplateHtml(){
|
|
|
|
82
|
+ $template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id
|
|
|
|
83
|
+ $is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
|
|
|
|
84
|
+ $is_list = $this->param['is_list'] ?? 0;//是否为列表页
|
|
|
|
85
|
+ $templateInfo = $this->model->read(['template_id'=>$template_id, 'source'=>$this->param['source'],'project_id'=>$this->user['project_id'],
|
|
|
|
86
|
+ 'source_id'=>$this->param['source_id'], 'is_custom'=>$is_custom, 'is_list'=>$is_list]);
|
|
|
|
87
|
+ if($templateInfo === false){
|
|
|
|
88
|
+ if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
|
|
|
|
89
|
+ $html = $this->isCustomizedPage($this->param['source'],$this->param['source_id']);//查看当前页面是否定制
|
|
|
|
90
|
+ return $this->success(['html'=>$html,'template_id'=>$template_id]);
|
|
|
|
91
|
+ }
|
|
|
|
92
|
+ $mainInfo = $this->getMAinHtml($this->param['source'],$this->param['source_id'],$is_custom);//获取中间部分代码
|
|
|
|
93
|
+ }
|
|
|
|
94
|
+ $data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$is_custom);
|
|
|
|
95
|
+ return $this->success($data);
|
|
|
|
96
|
+ }
|
|
|
|
97
|
+
|
|
|
|
98
|
+ /**
|
|
|
|
99
|
+ * @remark :获取中间部分的html
|
|
|
|
100
|
+ * @name :getMAinHtml
|
|
|
|
101
|
+ * @author :lyh
|
|
|
|
102
|
+ * @method :post
|
|
|
|
103
|
+ * @time :2023/12/27 15:00
|
|
|
|
104
|
+ */
|
|
|
|
105
|
+ public function getMAinHtml($source,$source_id,$is_custom,$is_list){
|
|
|
|
106
|
+ //查询有没有公共详情模板
|
|
|
|
107
|
+ $bTemplateMainModel = new BTemplateMain();
|
|
|
|
108
|
+ $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
109
|
+ if($mainInfo === false){
|
|
|
|
110
|
+ $data['main_html'] = $this->getModule($type);
|
|
|
|
111
|
+ $data['main_css'] = "<style id='globalsojs-styles'></style>";
|
|
|
|
112
|
+ }else{
|
|
|
|
113
|
+ $data['main_html'] = $mainInfo['main_html'];
|
|
|
|
114
|
+ $data['main_css'] = $mainInfo['main_css'];
|
|
|
|
115
|
+ }
|
|
|
|
116
|
+ }
|
|
|
|
117
|
+
|
|
|
|
118
|
+ /**
|
|
73
|
* @remark :获取可视化装修的html
|
119
|
* @remark :获取可视化装修的html
|
|
74
|
* @name :getTemplateHtml
|
120
|
* @name :getTemplateHtml
|
|
75
|
* @author :lyh
|
121
|
* @author :lyh
|
|
@@ -181,7 +227,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -181,7 +227,7 @@ class BTemplateLogic extends BaseLogic |
|
181
|
//查看当前页面是否定制,是否开启可视化
|
227
|
//查看当前页面是否定制,是否开启可视化
|
|
182
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
228
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
183
|
if (in_array($type, $page_array)) {//是定制界面
|
229
|
if (in_array($type, $page_array)) {//是定制界面
|
|
184
|
- return 0;
|
230
|
+ return $this->success(0);
|
|
185
|
}
|
231
|
}
|
|
186
|
}
|
232
|
}
|
|
187
|
$bSettingModel = new Setting();
|
233
|
$bSettingModel = new Setting();
|
|
@@ -189,7 +235,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -189,7 +235,7 @@ class BTemplateLogic extends BaseLogic |
|
189
|
if($info === false){
|
235
|
if($info === false){
|
|
190
|
$this->fail('请先选择模版');
|
236
|
$this->fail('请先选择模版');
|
|
191
|
}
|
237
|
}
|
|
192
|
- return $info['template_id'];
|
238
|
+ return $this->success($info['template_id']);
|
|
193
|
}
|
239
|
}
|
|
194
|
|
240
|
|
|
195
|
/**
|
241
|
/**
|
|
@@ -221,7 +267,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -221,7 +267,7 @@ class BTemplateLogic extends BaseLogic |
|
221
|
public function getCommonMain($source,$source_id,$is_custom){
|
267
|
public function getCommonMain($source,$source_id,$is_custom){
|
|
222
|
$data = [];
|
268
|
$data = [];
|
|
223
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
269
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
224
|
- if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
|
270
|
+ if($source_id != 0){$type = BTemplate::TYPE_CUSTOM;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
|
|
225
|
}else{
|
271
|
}else{
|
|
226
|
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
|
272
|
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
|
|
227
|
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
|
273
|
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
|
|
@@ -821,64 +867,6 @@ class BTemplateLogic extends BaseLogic |
|
@@ -821,64 +867,6 @@ class BTemplateLogic extends BaseLogic |
|
821
|
return $this->success();
|
867
|
return $this->success();
|
|
822
|
}
|
868
|
}
|
|
823
|
|
869
|
|
|
824
|
- /**
|
|
|
|
825
|
- * @remark :获取详情模板详情
|
|
|
|
826
|
- * @name :getDetail
|
|
|
|
827
|
- * @author :lyh
|
|
|
|
828
|
- * @method :post
|
|
|
|
829
|
- * @time :2023/10/24 11:29
|
|
|
|
830
|
- */
|
|
|
|
831
|
- public function getDetail(){
|
|
|
|
832
|
- $bSettingModel = new Setting();
|
|
|
|
833
|
- $bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
834
|
- if($bSettingInfo === false){
|
|
|
|
835
|
- $this->fail('请先设置模板');
|
|
|
|
836
|
- }
|
|
|
|
837
|
- $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
|
|
|
|
838
|
- $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
|
|
|
|
839
|
- //获取设置的默认中间部分
|
|
|
|
840
|
- $bTemplateMainModel = new BTemplateMain();
|
|
|
|
841
|
- $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);
|
|
|
|
842
|
- if($mainInfo === false){
|
|
|
|
843
|
- if($is_custom == BTemplate::SOURCE_CUSTOM) {
|
|
|
|
844
|
- $this->param['type'] = BTemplate::TYPE_CUSTOM_DETAIL;
|
|
|
|
845
|
- }
|
|
|
|
846
|
- $main_html = $this->getModule($this->param['type']);
|
|
|
|
847
|
- $main_style = "<style id='globalsojs-styles'></style>";
|
|
|
|
848
|
- }else{
|
|
|
|
849
|
- $main_html = $mainInfo['main_html'];
|
|
|
|
850
|
- $main_style = $mainInfo['main_css'];
|
|
|
|
851
|
- }
|
|
|
|
852
|
- $html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
853
|
- $commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
|
|
|
|
854
|
- $html = $this->getHeadFooter($html);//组装数据
|
|
|
|
855
|
- return $this->success($html);
|
|
|
|
856
|
- }
|
|
|
|
857
|
-
|
|
|
|
858
|
- /**
|
|
|
|
859
|
- * @remark :根据type获取html
|
|
|
|
860
|
- * @name :getHeaderFooter
|
|
|
|
861
|
- * @author :lyh
|
|
|
|
862
|
- * @method :post
|
|
|
|
863
|
- * @time :2023/12/15 18:06
|
|
|
|
864
|
- */
|
|
|
|
865
|
- public function getTypeCommonHtml($template_id,$type,$is_custom){
|
|
|
|
866
|
- //获取首页公共部分
|
|
|
|
867
|
- $templateCommonModel = new BTemplateCommon();
|
|
|
|
868
|
- $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
869
|
- if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
|
|
870
|
- return $this->success($commonInfo);
|
|
|
|
871
|
- }
|
|
|
|
872
|
- //判断当前项目是否有设置独立头部的权限
|
|
|
|
873
|
- if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
|
|
|
|
874
|
- //有权限时,获取独立头部
|
|
|
|
875
|
- $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
876
|
- if($commonTypeInfo !== false){
|
|
|
|
877
|
- $commonInfo = $commonTypeInfo;
|
|
|
|
878
|
- }
|
|
|
|
879
|
- }
|
|
|
|
880
|
- return $this->success($commonInfo);
|
|
|
|
881
|
- }
|
|
|
|
882
|
|
870
|
|
|
883
|
/**
|
871
|
/**
|
|
884
|
* @remark :保存详情模板数据
|
872
|
* @remark :保存详情模板数据
|