|
@@ -173,14 +173,12 @@ class BTemplateLogic extends BaseLogic |
|
@@ -173,14 +173,12 @@ class BTemplateLogic extends BaseLogic |
|
173
|
public function templateSave(){
|
173
|
public function templateSave(){
|
|
174
|
//查询当前模版是否已保存
|
174
|
//查询当前模版是否已保存
|
|
175
|
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
|
175
|
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
|
|
176
|
- if($info === false){
|
|
|
|
177
|
//字符串截取
|
176
|
//字符串截取
|
|
178
|
- $this->StringProcessing();
|
|
|
|
179
|
- $this->templateSaveParam($this->param['template_id']);
|
177
|
+ $this->param = $this->stringProcessing($this->param);
|
|
|
|
178
|
+ $this->param = $this->templateSaveParam($this->param);
|
|
|
|
179
|
+ if($info === false){
|
|
180
|
$rs = $this->model->add($this->param);
|
180
|
$rs = $this->model->add($this->param);
|
|
181
|
}else{
|
181
|
}else{
|
|
182
|
- $this->StringProcessing();
|
|
|
|
183
|
- $this->templateSaveParam($this->param['template_id']);
|
|
|
|
184
|
$rs = $this->model->edit($this->param,['id'=>$info['id']]);
|
182
|
$rs = $this->model->edit($this->param,['id'=>$info['id']]);
|
|
185
|
}
|
183
|
}
|
|
186
|
if($rs === false){
|
184
|
if($rs === false){
|
|
@@ -218,13 +216,14 @@ class BTemplateLogic extends BaseLogic |
|
@@ -218,13 +216,14 @@ class BTemplateLogic extends BaseLogic |
|
218
|
* @method :post
|
216
|
* @method :post
|
|
219
|
* @time :2023/7/21 16:30
|
217
|
* @time :2023/7/21 16:30
|
|
220
|
*/
|
218
|
*/
|
|
221
|
- public function templateSaveParam($template_id){
|
|
|
|
222
|
- $this->param['project_id'] = $this->user['project_id'];
|
|
|
|
223
|
- if($this->param['source'] == 1){//首页
|
|
|
|
224
|
- $this->param['html'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s');
|
219
|
+ public function templateSaveParam($param){
|
|
|
|
220
|
+ $param['project_id'] = $this->user['project_id'];
|
|
|
|
221
|
+ if($param['source'] == 1){//首页
|
|
|
|
222
|
+ $param['html'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s');
|
|
225
|
}else{
|
223
|
}else{
|
|
226
|
- $this->param['html'] = $this->param['main_html'];
|
224
|
+ $param['html'] = $param['main_html'];
|
|
227
|
}
|
225
|
}
|
|
|
|
226
|
+ return $this->success($param);
|
|
228
|
}
|
227
|
}
|
|
229
|
|
228
|
|
|
230
|
/**
|
229
|
/**
|
|
@@ -257,16 +256,30 @@ class BTemplateLogic extends BaseLogic |
|
@@ -257,16 +256,30 @@ class BTemplateLogic extends BaseLogic |
|
257
|
* @method :post
|
256
|
* @method :post
|
|
258
|
* @time :2023/6/29 15:35
|
257
|
* @time :2023/6/29 15:35
|
|
259
|
*/
|
258
|
*/
|
|
260
|
- public function StringProcessing(){
|
259
|
+ public function stringProcessing($param){
|
|
261
|
//字符串截取
|
260
|
//字符串截取
|
|
262
|
- $this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
|
|
|
263
|
- $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
264
|
- $this->param['footer_html'] = characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
|
|
|
265
|
- $this->param['head_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
|
|
|
|
266
|
- $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
267
|
- $this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
|
261
|
+ $param['head_html'] = characterTruncation($param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
|
|
|
262
|
+ $param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
263
|
+ $param['footer_html'] = characterTruncation($param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
|
|
|
264
|
+ $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
|
|
|
|
265
|
+ $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
266
|
+ $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
|
|
|
|
267
|
+ return $this->success($param);
|
|
268
|
}
|
268
|
}
|
|
269
|
|
269
|
|
|
|
|
270
|
+ /**
|
|
|
|
271
|
+ * @remark :默认产品模块
|
|
|
|
272
|
+ * @name :getProductModule
|
|
|
|
273
|
+ * @author :lyh
|
|
|
|
274
|
+ * @method :post
|
|
|
|
275
|
+ * @time :2023/7/27 15:08
|
|
|
|
276
|
+ */
|
|
|
|
277
|
+ public function getProductModule(){
|
|
|
|
278
|
+ //获取公共主题头部底部
|
|
|
|
279
|
+ $serviceSettingModel = new ServiceSettingModel();
|
|
|
|
280
|
+ $info = $serviceSettingModel->read(['type'=>$serviceSettingModel::TYPE_PRODUCT]);
|
|
|
|
281
|
+ return $info['values'];
|
|
|
|
282
|
+ }
|
|
270
|
|
283
|
|
|
271
|
|
284
|
|
|
272
|
/**
|
285
|
/**
|
|
@@ -361,17 +374,4 @@ class BTemplateLogic extends BaseLogic |
|
@@ -361,17 +374,4 @@ class BTemplateLogic extends BaseLogic |
|
361
|
return $this->success($data);
|
374
|
return $this->success($data);
|
|
362
|
}
|
375
|
}
|
|
363
|
|
376
|
|
|
364
|
- /**
|
|
|
|
365
|
- * @remark :默认产品模块
|
|
|
|
366
|
- * @name :getProductModule
|
|
|
|
367
|
- * @author :lyh
|
|
|
|
368
|
- * @method :post
|
|
|
|
369
|
- * @time :2023/7/27 15:08
|
|
|
|
370
|
- */
|
|
|
|
371
|
- public function getProductModule(){
|
|
|
|
372
|
- //获取公共主题头部底部
|
|
|
|
373
|
- $serviceSettingModel = new ServiceSettingModel();
|
|
|
|
374
|
- $info = $serviceSettingModel->read(['type'=>3]);
|
|
|
|
375
|
- return $info['values'];
|
|
|
|
376
|
- }
|
|
|
|
377
|
} |
377
|
} |