作者 赵彬吉
@@ -123,30 +123,43 @@ class BTemplateLogLogic extends BaseLogic @@ -123,30 +123,43 @@ 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 + /**
  139 + * @remark :生成界面
  140 + * @name :getTemplateHtml
  141 + * @author :lyh
  142 + * @method :post
  143 + * @time :2024/4/3 17:11
  144 + */
  145 + public function getTemplateHtml($info){
  146 + if(empty($info['other'])){
  147 + $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
  148 + $info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
  149 + }
  150 + $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
  151 + $info['head_html'].$info['main_html'].$info['footer_html'];
  152 + $serviceSettingModel = new ServiceSettingModel();
  153 + $list = $serviceSettingModel->list(['type'=>2],'created_at');
  154 + //拼接html
  155 + foreach ($list as $v){
  156 + if($v['key'] == 'head'){
  157 + $html = $v['values'].$html;
  158 + }
  159 + if($v['key'] == 'footer'){
  160 + $html = $html.$v['values'];
  161 + }
  162 + }
  163 + return $this->success($html);
  164 + }
152 } 165 }
@@ -81,8 +81,6 @@ class RatingLogic extends BaseLogic @@ -81,8 +81,6 @@ class RatingLogic extends BaseLogic
81 $str = trim($str,'&'); 81 $str = trim($str,'&');
82 $url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str"; 82 $url = "http://www.quanqiusou.cn/extend_api/api/service_score.php?postid=$postId&token=$token&ftype=$fType&$str";
83 $rs = http_get($url,['charset=utf-8']); 83 $rs = http_get($url,['charset=utf-8']);
84 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($url, true) . PHP_EOL, FILE_APPEND);  
85 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($rs, true) . PHP_EOL, FILE_APPEND);  
86 return $rs; 84 return $rs;
87 } 85 }
88 } 86 }