|
...
|
...
|
@@ -55,19 +55,53 @@ class BTemplateLogic extends BaseLogic |
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
$TemplateInfo = [];
|
|
|
|
if($info !== false){
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->model->read([
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'source'=>!isset($this->param['source']) ? 1 : $this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>!isset($this->param['source_id']) ? 0 : $this->param['source_id'],
|
|
|
|
]);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
//获取模板详情
|
|
|
|
$ATemplateModel = new Template();
|
|
|
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
|
|
|
if($this->param['source'] == 1){//首页
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->model->read([
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'source'=>!isset($this->param['source']) ? 1 : $this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>!isset($this->param['source_id']) ? 0 : $this->param['source_id'],
|
|
|
|
]);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
//获取模板详情
|
|
|
|
$ATemplateModel = new Template();
|
|
|
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
|
|
|
}
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
}else{
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->model->read([
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'source'=>$this->param['source'],
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'],
|
|
|
|
]);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->model->read([
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'source'=>1,
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
]);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
$this->fail('请先装修首页');
|
|
|
|
}
|
|
|
|
$TemplateInfo['html'] = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', "<style id='vvvebjs-styles'></style>", $TemplateInfo['html']);
|
|
|
|
$TemplateInfo['html'] = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main></main>", $TemplateInfo['html']);
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
}else{
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->model->read([
|
|
|
|
'template_id'=>$info['template_id'],
|
|
|
|
'source'=>1,
|
|
|
|
'project_id'=>$this->user['project_id'],
|
|
|
|
]);
|
|
|
|
$TemplateInfo['html'] = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $TemplateInfo['html']);
|
|
|
|
$TemplateInfo['html'] = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s',$TemplateInfo['main_html'] , $TemplateInfo['html']);
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
}
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
}
|
|
...
|
...
|
@@ -145,7 +179,11 @@ class BTemplateLogic extends BaseLogic |
|
|
|
//同步数据
|
|
|
|
$this->param['name'] = $TemplateInfo['name'];
|
|
|
|
$this->param['image'] = $TemplateInfo['image'];
|
|
|
|
$this->param['html'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s');
|
|
|
|
if($this->param['source'] == 1){
|
|
|
|
$this->param['html'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s');
|
|
|
|
}else{
|
|
|
|
$this->param['html'] = $this->param['main_html'];
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -182,8 +220,10 @@ class BTemplateLogic extends BaseLogic |
|
|
|
public function StringProcessing(){
|
|
|
|
//字符串截取
|
|
|
|
$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="vvvebjs-header">(.*?)<\/style>/s');
|
|
|
|
$this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-styles">(.*?)<\/style>/s');
|
|
|
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-footer">(.*?)<\/style>/s');
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|