|
@@ -55,6 +55,7 @@ class BTemplateLogic extends BaseLogic |
|
@@ -55,6 +55,7 @@ class BTemplateLogic extends BaseLogic |
|
55
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
55
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
56
|
$TemplateInfo = [];
|
56
|
$TemplateInfo = [];
|
|
57
|
if($info !== false){
|
57
|
if($info !== false){
|
|
|
|
58
|
+ if($this->param['source'] == 1){//首页
|
|
58
|
//查看当前模板是否已编辑保存web_template
|
59
|
//查看当前模板是否已编辑保存web_template
|
|
59
|
$TemplateInfo = $this->model->read([
|
60
|
$TemplateInfo = $this->model->read([
|
|
60
|
'template_id'=>$info['template_id'],
|
61
|
'template_id'=>$info['template_id'],
|
|
@@ -68,6 +69,39 @@ class BTemplateLogic extends BaseLogic |
|
@@ -68,6 +69,39 @@ class BTemplateLogic extends BaseLogic |
|
68
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
69
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
|
69
|
}
|
70
|
}
|
|
70
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
71
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
72
|
+ }else{
|
|
|
|
73
|
+ //查看当前模板是否已编辑保存web_template
|
|
|
|
74
|
+ $TemplateInfo = $this->model->read([
|
|
|
|
75
|
+ 'template_id'=>$info['template_id'],
|
|
|
|
76
|
+ 'source'=>$this->param['source'],
|
|
|
|
77
|
+ 'project_id'=>$this->user['project_id'],
|
|
|
|
78
|
+ 'source_id'=>$this->param['source_id'],
|
|
|
|
79
|
+ ]);
|
|
|
|
80
|
+ if($TemplateInfo === false){
|
|
|
|
81
|
+ //查看当前模板是否已编辑保存web_template
|
|
|
|
82
|
+ $TemplateInfo = $this->model->read([
|
|
|
|
83
|
+ 'template_id'=>$info['template_id'],
|
|
|
|
84
|
+ 'source'=>1,
|
|
|
|
85
|
+ 'project_id'=>$this->user['project_id'],
|
|
|
|
86
|
+ ]);
|
|
|
|
87
|
+ if($TemplateInfo === false){
|
|
|
|
88
|
+ $this->fail('请先装修首页');
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ $TemplateInfo['html'] = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', "<style id='vvvebjs-styles'></style>", $TemplateInfo['html']);
|
|
|
|
91
|
+ $TemplateInfo['html'] = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', "<main></main>", $TemplateInfo['html']);
|
|
|
|
92
|
+ $TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
93
|
+ }else{
|
|
|
|
94
|
+ //查看当前模板是否已编辑保存web_template
|
|
|
|
95
|
+ $TemplateInfo = $this->model->read([
|
|
|
|
96
|
+ 'template_id'=>$info['template_id'],
|
|
|
|
97
|
+ 'source'=>1,
|
|
|
|
98
|
+ 'project_id'=>$this->user['project_id'],
|
|
|
|
99
|
+ ]);
|
|
|
|
100
|
+ $TemplateInfo['html'] = preg_replace('/<style id="vvvebjs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $TemplateInfo['html']);
|
|
|
|
101
|
+ $TemplateInfo['html'] = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s',$TemplateInfo['main_html'] , $TemplateInfo['html']);
|
|
|
|
102
|
+ $TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
103
|
+ }
|
|
|
|
104
|
+ }
|
|
71
|
}
|
105
|
}
|
|
72
|
return $this->success($TemplateInfo);
|
106
|
return $this->success($TemplateInfo);
|
|
73
|
}
|
107
|
}
|
|
@@ -145,7 +179,11 @@ class BTemplateLogic extends BaseLogic |
|
@@ -145,7 +179,11 @@ class BTemplateLogic extends BaseLogic |
|
145
|
//同步数据
|
179
|
//同步数据
|
|
146
|
$this->param['name'] = $TemplateInfo['name'];
|
180
|
$this->param['name'] = $TemplateInfo['name'];
|
|
147
|
$this->param['image'] = $TemplateInfo['image'];
|
181
|
$this->param['image'] = $TemplateInfo['image'];
|
|
|
|
182
|
+ if($this->param['source'] == 1){
|
|
148
|
$this->param['html'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s');
|
183
|
$this->param['html'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s');
|
|
|
|
184
|
+ }else{
|
|
|
|
185
|
+ $this->param['html'] = $this->param['main_html'];
|
|
|
|
186
|
+ }
|
|
149
|
return true;
|
187
|
return true;
|
|
150
|
}
|
188
|
}
|
|
151
|
|
189
|
|
|
@@ -182,8 +220,10 @@ class BTemplateLogic extends BaseLogic |
|
@@ -182,8 +220,10 @@ class BTemplateLogic extends BaseLogic |
|
182
|
public function StringProcessing(){
|
220
|
public function StringProcessing(){
|
|
183
|
//字符串截取
|
221
|
//字符串截取
|
|
184
|
$this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
222
|
$this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
|
|
|
|
223
|
+ $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
|
|
185
|
$this->param['footer_html'] = characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
224
|
$this->param['footer_html'] = characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
|
|
186
|
$this->param['head_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/style>/s');
|
225
|
$this->param['head_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/style>/s');
|
|
|
|
226
|
+ $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-styles">(.*?)<\/style>/s');
|
|
187
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-footer">(.*?)<\/style>/s');
|
227
|
$this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="vvvebjs-footer">(.*?)<\/style>/s');
|
|
188
|
}
|
228
|
}
|
|
189
|
|
229
|
|