作者 lyh

gx

... ... @@ -103,14 +103,21 @@ class BTemplateLogic extends BaseLogic
//获取模板详情
$ATemplateModel = new Template();
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
}else{
//兼容老数据
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
if($commonInfo === false){
$TemplateInfo['html'] = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
$commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
}
//渲染首页数据
$ATemplateModel = new Template();
$ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
$TemplateInfo['name'] = $ATemplateInfo['name'];
$TemplateInfo['image_link'] = getImageUrl($ATemplateInfo['image']);
}
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
return $this->success($TemplateInfo);
}
... ... @@ -133,7 +140,7 @@ class BTemplateLogic extends BaseLogic
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
if($commonInfo !== false){
$html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['head_css'].$commonInfo['other'].
$html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['footer_css'].$commonInfo['other'].
$commonInfo['head_html'].$this->getProductModule().$commonInfo['footer_html'];
}else{
$html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']);
... ... @@ -144,7 +151,7 @@ class BTemplateLogic extends BaseLogic
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
if($commonInfo !== false){
$html = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['head_css'].$commonInfo['other'].
$html = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
$commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
}else{
$html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $homeTemplateInfo['html']);
... ... @@ -226,7 +233,7 @@ class BTemplateLogic extends BaseLogic
public function saveCommonTemplate($param){
$templateCommonModel = new BTemplateCommon();
$info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id']]);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['html'], true) . PHP_EOL, FILE_APPEND);
// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['html'], true) . PHP_EOL, FILE_APPEND);
$data = [
'head_html'=>$param['head_html'],
'head_css'=>$param['head_css'],
... ...