作者 lyh

gx

@@ -87,7 +87,7 @@ class BTemplateLogic extends BaseLogic @@ -87,7 +87,7 @@ class BTemplateLogic extends BaseLogic
87 } 87 }
88 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码 88 if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
89 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型 89 $type = $this->getCustomizedType($source, $source_id);//定制获取头部底部类型
90 - $commonInfo = $this->getCommonPage(['template_id'=>0,'project_id'=>$this->user['project_id'],'type'=>$type]);//获取定制头部 90 + $commonInfo = $this->getCommonPage(0,$this->user['project_id'],$type);//获取定制头部
91 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']); 91 $html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
92 return $this->success(['html'=>$html,'template_id'=>$template_id]); 92 return $this->success(['html'=>$html,'template_id'=>$template_id]);
93 } 93 }
@@ -106,10 +106,12 @@ class BTemplateLogic extends BaseLogic @@ -106,10 +106,12 @@ class BTemplateLogic extends BaseLogic
106 * @time :2023/12/13 15:39 106 * @time :2023/12/13 15:39
107 */ 107 */
108 public function handleAllHtml($commonInfo,$html){ 108 public function handleAllHtml($commonInfo,$html){
  109 + if(!empty($commonInfo)){
109 $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); 110 $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html);
110 $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); 111 $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html);
111 $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html); 112 $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html);
112 $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html); 113 $html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html);
  114 + }
113 return $html; 115 return $html;
114 } 116 }
115 117