|
@@ -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
|