作者 lyh

gx

@@ -103,14 +103,21 @@ class BTemplateLogic extends BaseLogic @@ -103,14 +103,21 @@ class BTemplateLogic extends BaseLogic
103 //获取模板详情 103 //获取模板详情
104 $ATemplateModel = new Template(); 104 $ATemplateModel = new Template();
105 $TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); 105 $TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
  106 + $TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
106 }else{ 107 }else{
  108 + //兼容老数据
  109 + $commonTemplateModel = new BTemplateCommon();
  110 + $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
  111 + if($commonInfo === false){
  112 + $TemplateInfo['html'] = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
  113 + $commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
  114 + }
107 //渲染首页数据 115 //渲染首页数据
108 $ATemplateModel = new Template(); 116 $ATemplateModel = new Template();
109 $ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]); 117 $ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
110 $TemplateInfo['name'] = $ATemplateInfo['name']; 118 $TemplateInfo['name'] = $ATemplateInfo['name'];
111 $TemplateInfo['image_link'] = getImageUrl($ATemplateInfo['image']); 119 $TemplateInfo['image_link'] = getImageUrl($ATemplateInfo['image']);
112 } 120 }
113 - $TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);  
114 return $this->success($TemplateInfo); 121 return $this->success($TemplateInfo);
115 } 122 }
116 123
@@ -133,7 +140,7 @@ class BTemplateLogic extends BaseLogic @@ -133,7 +140,7 @@ class BTemplateLogic extends BaseLogic
133 $commonTemplateModel = new BTemplateCommon(); 140 $commonTemplateModel = new BTemplateCommon();
134 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 141 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
135 if($commonInfo !== false){ 142 if($commonInfo !== false){
136 - $html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['head_css'].$commonInfo['other']. 143 + $html = $commonInfo['head_css']."<style id='globalsojs-styles'></style>".$commonInfo['footer_css'].$commonInfo['other'].
137 $commonInfo['head_html'].$this->getProductModule().$commonInfo['footer_html']; 144 $commonInfo['head_html'].$this->getProductModule().$commonInfo['footer_html'];
138 }else{ 145 }else{
139 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']); 146 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', "<style id='globalsojs-styles'></style>", $homeTemplateInfo['html']);
@@ -144,7 +151,7 @@ class BTemplateLogic extends BaseLogic @@ -144,7 +151,7 @@ class BTemplateLogic extends BaseLogic
144 $commonTemplateModel = new BTemplateCommon(); 151 $commonTemplateModel = new BTemplateCommon();
145 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 152 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
146 if($commonInfo !== false){ 153 if($commonInfo !== false){
147 - $html = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['head_css'].$commonInfo['other']. 154 + $html = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
148 $commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html']; 155 $commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
149 }else{ 156 }else{
150 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $homeTemplateInfo['html']); 157 $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $TemplateInfo['main_css'], $homeTemplateInfo['html']);
@@ -226,7 +233,7 @@ class BTemplateLogic extends BaseLogic @@ -226,7 +233,7 @@ class BTemplateLogic extends BaseLogic
226 public function saveCommonTemplate($param){ 233 public function saveCommonTemplate($param){
227 $templateCommonModel = new BTemplateCommon(); 234 $templateCommonModel = new BTemplateCommon();
228 $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id']]); 235 $info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id']]);
229 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['html'], true) . PHP_EOL, FILE_APPEND); 236 +// @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['html'], true) . PHP_EOL, FILE_APPEND);
230 $data = [ 237 $data = [
231 'head_html'=>$param['head_html'], 238 'head_html'=>$param['head_html'],
232 'head_css'=>$param['head_css'], 239 'head_css'=>$param['head_css'],