作者 lyh

gx

... ... @@ -123,30 +123,36 @@ class BTemplateLogLogic extends BaseLogic
$this->fail('当前数据不存在,或已被删除');
}
if($this->user['is_customized'] != BTemplate::IS_VISUALIZATION){
if(empty($info['other'])){
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
//拼接html
foreach ($list as $v){
if($v['key'] == 'head'){
$html = $v['values'].$html;
}
if($v['key'] == 'footer'){
$html = $html.$v['values'];
}
}
$html = $this->getTemplateHtml($info);
}else{
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array(1, $page_array)) {//首页是定制界面
$html = $info['text'];
}else{
$html = $this->getTemplateHtml($info);
}
}
return $this->success(['html'=>$html]);
}
public function getTemplateHtml($info){
if(empty($info['other'])){
$footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
$info['other'] = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
//拼接html
foreach ($list as $v){
if($v['key'] == 'head'){
$html = $v['values'].$html;
}
if($v['key'] == 'footer'){
$html = $html.$v['values'];
}
}
return $this->success($html);
}
}
... ...