|
...
|
...
|
@@ -173,14 +173,12 @@ class BTemplateLogic extends BaseLogic |
|
|
|
public function templateSave(){
|
|
|
|
//查询当前模版是否已保存
|
|
|
|
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
|
|
|
|
//字符串截取
|
|
|
|
$this->param = $this->stringProcessing($this->param);
|
|
|
|
$this->param = $this->templateSaveParam($this->param);
|
|
|
|
if($info === false){
|
|
|
|
//字符串截取
|
|
|
|
$this->StringProcessing();
|
|
|
|
$this->templateSaveParam($this->param['template_id']);
|
|
|
|
$rs = $this->model->add($this->param);
|
|
|
|
}else{
|
|
|
|
$this->StringProcessing();
|
|
|
|
$this->templateSaveParam($this->param['template_id']);
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
if($rs === false){
|
|
...
|
...
|
@@ -218,13 +216,14 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/21 16:30
|
|
|
|
*/
|
|
|
|
public function templateSaveParam($template_id){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
if($this->param['source'] == 1){//首页
|
|
|
|
$this->param['html'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s');
|
|
|
|
public function templateSaveParam($param){
|
|
|
|
$param['project_id'] = $this->user['project_id'];
|
|
|
|
if($param['source'] == 1){//首页
|
|
|
|
$param['html'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s');
|
|
|
|
}else{
|
|
|
|
$this->param['html'] = $this->param['main_html'];
|
|
|
|
$param['html'] = $param['main_html'];
|
|
|
|
}
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -257,16 +256,30 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/29 15:35
|
|
|
|
*/
|
|
|
|
public function StringProcessing(){
|
|
|
|
public function stringProcessing($param){
|
|
|
|
//字符串截取
|
|
|
|
$this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
|
|
|
$this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
$this->param['footer_html'] = characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
|
|
|
$this->param['head_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
|
|
|
|
$this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
|
|
|
|
$param['head_html'] = characterTruncation($param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
|
|
|
$param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
$param['footer_html'] = characterTruncation($param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
|
|
|
$param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
|
|
|
|
$param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
$param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
|
|
|
|
return $this->success($param);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :默认产品模块
|
|
|
|
* @name :getProductModule
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/27 15:08
|
|
|
|
*/
|
|
|
|
public function getProductModule(){
|
|
|
|
//获取公共主题头部底部
|
|
|
|
$serviceSettingModel = new ServiceSettingModel();
|
|
|
|
$info = $serviceSettingModel->read(['type'=>$serviceSettingModel::TYPE_PRODUCT]);
|
|
|
|
return $info['values'];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -361,17 +374,4 @@ class BTemplateLogic extends BaseLogic |
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :默认产品模块
|
|
|
|
* @name :getProductModule
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/27 15:08
|
|
|
|
*/
|
|
|
|
public function getProductModule(){
|
|
|
|
//获取公共主题头部底部
|
|
|
|
$serviceSettingModel = new ServiceSettingModel();
|
|
|
|
$info = $serviceSettingModel->read(['type'=>3]);
|
|
|
|
return $info['values'];
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|