作者 lyh

gx

@@ -123,30 +123,36 @@ class BTemplateLogLogic extends BaseLogic @@ -123,30 +123,36 @@ class BTemplateLogLogic extends BaseLogic
123 $this->fail('当前数据不存在,或已被删除'); 123 $this->fail('当前数据不存在,或已被删除');
124 } 124 }
125 if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){ 125 if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){
126 - if(empty($info['other'])){  
127 - $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));  
128 - $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);  
129 - }  
130 - $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].  
131 - $info['head_html'].$info['main_html'].$info['footer_html'];  
132 - $serviceSettingModel = new ServiceSettingModel();  
133 - $list = $serviceSettingModel->list(['type'=>2],'created_at');  
134 - //拼接html  
135 - foreach ($list as $v){  
136 - if($v['key'] == 'head'){  
137 - $html = $v['values'].$html;  
138 - }  
139 - if($v['key'] == 'footer'){  
140 - $html = $html.$v['values'];  
141 - }  
142 - } 126 + $html = $this->getTemplateHtml($info);
143 }else{ 127 }else{
144 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面 128 $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
145 if (in_array(1, $page_array)) {//首页是定制界面 129 if (in_array(1, $page_array)) {//首页是定制界面
146 $html = $info['text']; 130 $html = $info['text'];
  131 + }else{
  132 + $html = $this->getTemplateHtml($info);
147 } 133 }
148 } 134 }
149 return $this->success(['html'=>$html]); 135 return $this->success(['html'=>$html]);
150 } 136 }
151 137
  138 + public function getTemplateHtml($info){
  139 + if(empty($info['other'])){
  140 + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
  141 + $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
  142 + }
  143 + $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
  144 + $info['head_html'].$info['main_html'].$info['footer_html'];
  145 + $serviceSettingModel = new ServiceSettingModel();
  146 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  147 + //拼接html
  148 + foreach ($list as $v){
  149 + if($v['key'] == 'head'){
  150 + $html = $v['values'].$html;
  151 + }
  152 + if($v['key'] == 'footer'){
  153 + $html = $html.$v['values'];
  154 + }
  155 + }
  156 + return $this->success($html);
  157 + }
152 } 158 }