|
...
|
...
|
@@ -26,7 +26,8 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/29 15:46
|
|
|
|
*/
|
|
|
|
public function customTemplateLists($map,$page,$row,$order = 'created_at',$filed = ['*']){
|
|
|
|
public function customTemplateLists($map,$page,$row,$order = 'created_at'){
|
|
|
|
$filed = ['id','name','status','url','title','keywords','description','project_id','created_at','updated_at'];
|
|
|
|
$map['deleted_status'] = 0;
|
|
|
|
$map['project_id'] = $this->user['project_id'];
|
|
|
|
$lists = $this->model->lists($map,$page,$row,$order,$filed);
|
|
...
|
...
|
@@ -42,11 +43,11 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateInfo(){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
$html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
|
|
|
|
$info['html'] = $this->getHeadFooter($html);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
$this->fail('当前数据不存在');
|
|
|
|
}
|
|
|
|
$html = $this->getBodyHeaderFooter($info['html'],$info['html_style']);
|
|
|
|
$info['html'] = $this->getHeadFooter($html);
|
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -223,13 +224,21 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先设置模版');
|
|
|
|
}
|
|
|
|
//兼容老数据
|
|
|
|
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
|
|
|
|
$html = '';
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$preg_html.$commonInfo['footer_html'];
|
|
|
|
}else{
|
|
|
|
//兼容老数据,获取首页数据
|
|
|
|
$TemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
|
|
|
|
if($TemplateInfo !== false){
|
|
|
|
$html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']);
|
|
|
|
//内容
|
|
|
|
$html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
...
|
...
|
|