|
...
|
...
|
@@ -63,13 +63,8 @@ class BTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function getTemplate(){
|
|
|
|
$settingInfo = $this->getSettingTemplate();//模版详情
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
$TemplateInfo = $this->homeHtml($settingInfo,$this->param['source'],$this->param['source_id']);
|
|
|
|
}else{
|
|
|
|
$TemplateInfo = $this->otherHtml($settingInfo,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
$data = $this->getTemplateHtml($settingInfo,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -89,14 +84,30 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
|
|
|
|
return ['html'=>$templateInfo['html'],'template_id'=>$settingInfo['template_id']];
|
|
|
|
}
|
|
|
|
$commonInfo = $this->getCommonPage($source,$source_id,$settingInfo['template_id']);//获取头部
|
|
|
|
$mainInfo = $this->getCommonMain($source,$source_id);//获取中间部分代码
|
|
|
|
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
|
|
|
|
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
|
|
|
|
return ['html'=>$html,'template_id'=>$settingInfo['template_id']];
|
|
|
|
}
|
|
|
|
$html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
|
|
|
|
return ['html'=>$templateInfo['html'],'template_id'=>$settingInfo['template_id']];
|
|
|
|
return ['html'=>$html,'template_id'=>$settingInfo['template_id']];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :返回整个html截取代码
|
|
|
|
* @name :handleAllHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 15:39
|
|
|
|
*/
|
|
|
|
public function handleAllHtml($commonInfo,$html){
|
|
|
|
$html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html);
|
|
|
|
$html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html);
|
|
|
|
$html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html);
|
|
|
|
$html = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', $commonInfo['footer_css'], $html);
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|