|
@@ -26,7 +26,8 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -26,7 +26,8 @@ class CustomTemplateLogic extends BaseLogic |
|
26
|
* @method :post
|
26
|
* @method :post
|
|
27
|
* @time :2023/6/29 15:46
|
27
|
* @time :2023/6/29 15:46
|
|
28
|
*/
|
28
|
*/
|
|
29
|
- public function customTemplateLists($map,$page,$row,$order = 'created_at',$filed = ['*']){
|
29
|
+ public function customTemplateLists($map,$page,$row,$order = 'created_at'){
|
|
|
|
30
|
+ $filed = ['id','name','status','url','title','keywords','description','project_id','created_at','updated_at'];
|
|
30
|
$map['deleted_status'] = 0;
|
31
|
$map['deleted_status'] = 0;
|
|
31
|
$map['project_id'] = $this->user['project_id'];
|
32
|
$map['project_id'] = $this->user['project_id'];
|
|
32
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
33
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
|
@@ -42,11 +43,11 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -42,11 +43,11 @@ class CustomTemplateLogic extends BaseLogic |
|
42
|
*/
|
43
|
*/
|
|
43
|
public function customTemplateInfo(){
|
44
|
public function customTemplateInfo(){
|
|
44
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
45
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
45
|
- $html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
|
|
|
|
46
|
- $info['html'] = $this->getHeadFooter($html);
|
|
|
|
47
|
if($info === false){
|
46
|
if($info === false){
|
|
48
|
- $this->fail('error');
|
47
|
+ $this->fail('当前数据不存在');
|
|
49
|
}
|
48
|
}
|
|
|
|
49
|
+ $html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
|
|
|
|
50
|
+ $info['html'] = $this->getHeadFooter($html);
|
|
50
|
return $this->success($info);
|
51
|
return $this->success($info);
|
|
51
|
}
|
52
|
}
|
|
52
|
|
53
|
|
|
@@ -223,13 +224,21 @@ class CustomTemplateLogic extends BaseLogic |
|
@@ -223,13 +224,21 @@ class CustomTemplateLogic extends BaseLogic |
|
223
|
if($info === false){
|
224
|
if($info === false){
|
|
224
|
$this->fail('请先设置模版');
|
225
|
$this->fail('请先设置模版');
|
|
225
|
}
|
226
|
}
|
|
226
|
- //兼容老数据
|
227
|
+
|
|
227
|
$commonTemplateModel = new BTemplateCommon();
|
228
|
$commonTemplateModel = new BTemplateCommon();
|
|
228
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
|
229
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
|
|
229
|
$html = '';
|
230
|
$html = '';
|
|
230
|
if($commonInfo !== false){
|
231
|
if($commonInfo !== false){
|
|
231
|
$html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
|
232
|
$html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
232
|
$commonInfo['head_html'].$preg_html.$commonInfo['footer_html'];
|
233
|
$commonInfo['head_html'].$preg_html.$commonInfo['footer_html'];
|
|
|
|
234
|
+ }else{
|
|
|
|
235
|
+ //兼容老数据,获取首页数据
|
|
|
|
236
|
+ $TemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
|
|
|
|
237
|
+ if($TemplateInfo !== false){
|
|
|
|
238
|
+ $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']);
|
|
|
|
239
|
+ //内容
|
|
|
|
240
|
+ $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);
|
|
|
|
241
|
+ }
|
|
233
|
}
|
242
|
}
|
|
234
|
return $html;
|
243
|
return $html;
|
|
235
|
}
|
244
|
}
|