|
...
|
...
|
@@ -212,21 +212,6 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看首页是否可视化
|
|
|
|
* @name :getTemplateHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 9:50
|
|
|
|
*/
|
|
|
|
public function homeISVisualization($template_id){
|
|
|
|
$homeTemplateInfo = $this->webTemplateInfo($template_id,BTemplate::SOURCE_HOME,0);
|
|
|
|
if($homeTemplateInfo === false){
|
|
|
|
$this->fail('请先装修首页');
|
|
|
|
}
|
|
|
|
return $this->success($homeTemplateInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据参数获取数据详情
|
|
|
|
* @name :webTemplateInfo
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -246,98 +231,6 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理首页数据
|
|
|
|
* @name :homeHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/25 16:36
|
|
|
|
*/
|
|
|
|
public function homeHtml($info,$source,$source_id){
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
//获取模板详情
|
|
|
|
$ATemplateModel = new Template();
|
|
|
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
|
|
|
}else{
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
$TemplateInfo['html'] = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
|
|
|
|
$ATemplateModel = new Template();
|
|
|
|
$ATemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']],['name','image']);
|
|
|
|
$TemplateInfo['name'] = $ATemplateInfo['name'];
|
|
|
|
$TemplateInfo['image_link'] = getImageUrl($ATemplateInfo['image']);
|
|
|
|
}
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($TemplateInfo['html']);
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理其他页数据
|
|
|
|
* @name :ProductHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/25 16:40
|
|
|
|
*/
|
|
|
|
public function otherHtml($info,$source,$source_id){
|
|
|
|
$homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
|
|
|
|
if($homeTemplateInfo === false){
|
|
|
|
$this->fail('请先装修首页');
|
|
|
|
}
|
|
|
|
//查看当前模板是否已编辑保存web_template
|
|
|
|
$TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id);
|
|
|
|
if($TemplateInfo === false){
|
|
|
|
$mainInfo = $this->getCommonMain($source,$source_id);
|
|
|
|
$main_html = $mainInfo['main_html'];
|
|
|
|
$main_style = $mainInfo['main_css'];
|
|
|
|
$TemplateInfo['template_id'] = $info['template_id'];
|
|
|
|
}else{
|
|
|
|
$main_html = $TemplateInfo['main_html'];
|
|
|
|
$main_style = $TemplateInfo['main_css'];
|
|
|
|
}
|
|
|
|
$commonInfo = $this->getCommonPage($source,$source_id,$info['template_id']);
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
|
|
|
|
}else{
|
|
|
|
$html = preg_replace('/<style id="globalsojs-styles">(.*?)<\/style>/s', $main_style, $homeTemplateInfo['html']);
|
|
|
|
$html = preg_replace('/<main\b[^>]*>(.*?)<\/main>/s', $main_html, $html);
|
|
|
|
}
|
|
|
|
$TemplateInfo['html'] = $this->getHeadFooter($html);//组装数据
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取自定义模块的html
|
|
|
|
* @name :customHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/12 9:39
|
|
|
|
*/
|
|
|
|
public function customHtml($info,$source,$source_id,$is_custom){
|
|
|
|
$templateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id,$is_custom);
|
|
|
|
if($templateInfo === false){
|
|
|
|
//TODO::取新闻的默认页,后期如果更新,修改此处
|
|
|
|
$news_source = 3;
|
|
|
|
$mainInfo = $this->getCommonMain($news_source,$source_id);
|
|
|
|
$main_html = $mainInfo['main_html'];
|
|
|
|
$main_style = $mainInfo['main_css'];
|
|
|
|
$templateInfo['template_id'] = $info['template_id'];
|
|
|
|
}else{
|
|
|
|
$main_html = $templateInfo['main_html'];
|
|
|
|
$main_style = $templateInfo['main_css'];
|
|
|
|
}
|
|
|
|
//TODO::无独立头部时,取首页的头部和底部
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
$html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
|
|
|
|
$templateInfo['html'] = $this->getHeadFooter($html);//组装数据
|
|
|
|
return $this->success($templateInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取中间公共部分
|
|
|
|
* @name :getCommonMain
|
|
|
|
* @author :lyh
|
...
|
...
|
|