作者 lyh

gx

@@ -223,13 +223,21 @@ class CustomTemplateLogic extends BaseLogic @@ -223,13 +223,21 @@ class CustomTemplateLogic extends BaseLogic
223 if($info === false){ 223 if($info === false){
224 $this->fail('请先设置模版'); 224 $this->fail('请先设置模版');
225 } 225 }
226 - //兼容老数据 226 +
227 $commonTemplateModel = new BTemplateCommon(); 227 $commonTemplateModel = new BTemplateCommon();
228 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]); 228 $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id']]);
229 $html = ''; 229 $html = '';
230 if($commonInfo !== false){ 230 if($commonInfo !== false){
231 $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other']. 231 $html = $commonInfo['head_css'].$html_style.$commonInfo['footer_css'].$commonInfo['other'].
232 $commonInfo['head_html'].$preg_html.$commonInfo['footer_html']; 232 $commonInfo['head_html'].$preg_html.$commonInfo['footer_html'];
  233 + }else{
  234 + //兼容老数据,获取首页数据
  235 + $TemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
  236 + if($TemplateInfo !== false){
  237 + $html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s',$html_style , $TemplateInfo['html']);
  238 + //内容
  239 + $html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $preg_html, $html);
  240 + }
233 } 241 }
234 return $html; 242 return $html;
235 } 243 }