|
...
|
...
|
@@ -284,46 +284,71 @@ class VisualizationLogic extends BaseLogic |
|
|
|
$type = $this->getType($this->param['source'],$this->param['source_id']);
|
|
|
|
try {
|
|
|
|
if(in_array($type,$page_array)){//定制页面
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateInfo = $bTemplateModel->read([
|
|
|
|
'source'=>$this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'],
|
|
|
|
'template_id'=>0
|
|
|
|
]);
|
|
|
|
if($templateInfo === false){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$this->param['template_id'] = 0;
|
|
|
|
$bTemplateModel->add($this->param);
|
|
|
|
}else{
|
|
|
|
$bTemplateModel->edit(['html'=>$this->param['html']],['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]);
|
|
|
|
}
|
|
|
|
$this->saveVisualizationHtml();
|
|
|
|
}else{
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateInfo = $bTemplateModel->read([
|
|
|
|
'source'=>$this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'],
|
|
|
|
'template_id'=>$this->param['template_id'],
|
|
|
|
]);
|
|
|
|
$this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
$this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
//保存头部
|
|
|
|
$this->saveCommonTemplate($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
|
|
|
|
if($templateInfo === false){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$bTemplateModel->add($this->param);
|
|
|
|
}else{
|
|
|
|
$bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]);
|
|
|
|
}
|
|
|
|
$this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']);
|
|
|
|
$this->homeOrProduct($this->param['source'],$this->param['source_id']);
|
|
|
|
$this->saveTemplateHtml();
|
|
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
$this->fail('系统错误,请联系管理员');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存定制界面
|
|
|
|
* @name :saveVisualizationHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/5 15:42
|
|
|
|
*/
|
|
|
|
public function saveVisualizationHtml(){
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateInfo = $bTemplateModel->read([
|
|
|
|
'source'=>$this->param['source'], 'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'], 'template_id'=>0
|
|
|
|
]);
|
|
|
|
if($templateInfo === false){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$this->param['template_id'] = 0;
|
|
|
|
// $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
// $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
$bTemplateModel->add($this->param);
|
|
|
|
}else{
|
|
|
|
// $param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
// $param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
$param['html'] = $this->param['html'];
|
|
|
|
$bTemplateModel->edit($param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id'],'template_id'=>0]);
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :非定制界面保存数据
|
|
|
|
* @name :saveTemplateHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/5 15:44
|
|
|
|
*/
|
|
|
|
public function saveTemplateHtml(){
|
|
|
|
$bTemplateModel = new BTemplate();
|
|
|
|
$templateInfo = $bTemplateModel->read([
|
|
|
|
'source'=>$this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'],
|
|
|
|
'template_id'=>$this->param['template_id'],
|
|
|
|
]);
|
|
|
|
$this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
|
|
$this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
|
|
|
|
//保存头部
|
|
|
|
$this->saveCommonTemplate($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
|
|
|
|
if($templateInfo === false){
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
|
|
$bTemplateModel->add($this->param);
|
|
|
|
}else{
|
|
|
|
$bTemplateModel->edit($this->param,['source'=>$this->param['source'],'source_id'=>$this->param['source_id']]);
|
|
|
|
}
|
|
|
|
$this->setTemplateLog($this->param['template_id'],$this->param['html'],$this->param['source'],$this->param['source_id']);
|
|
|
|
$this->homeOrProduct($this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -357,12 +382,12 @@ class VisualizationLogic extends BaseLogic |
|
|
|
$newsInfo = $newsModel->read(['id'=>$source_id],['url']);
|
|
|
|
$route = $newsInfo['url'];
|
|
|
|
}else{
|
|
|
|
$type = 0;
|
|
|
|
$type = 'all';
|
|
|
|
$route = 'all';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->addUpdateNotify($type,$route);
|
|
|
|
return $this->curlDelRoute($route);
|
|
|
|
return $this->curlDelRoute(['route'=>$route,'new_route'=>$route]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|