|
...
|
...
|
@@ -62,21 +62,13 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @time :2023/6/29 9:44
|
|
|
|
*/
|
|
|
|
public function getTemplate(){
|
|
|
|
$bSettingModel = new Setting();
|
|
|
|
$info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先选择模版');
|
|
|
|
}
|
|
|
|
//自定义模块单独处理
|
|
|
|
if(isset($this->param['is_custom']) && $this->param['is_custom'] == 1){
|
|
|
|
$TemplateInfo = $this->customHtml($info,$this->param['source'],$this->param['source_id'],$this->param['is_custom']);
|
|
|
|
}else{//系统页面
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
$TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}else{
|
|
|
|
$TemplateInfo = $this->otherHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -87,29 +79,88 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 10:47
|
|
|
|
*/
|
|
|
|
public function getTemplateHtml(){
|
|
|
|
$settingTemplateInfo = $this->getSettingTemplate();//模版详情
|
|
|
|
$is_customized = $this->watchProjectIsCustomized();//查看是否为定制项目
|
|
|
|
|
|
|
|
public function getTemplateHtml($settingInfo,$source,$source_id,$is_custom = 0){
|
|
|
|
$templateInfo = $this->webTemplateInfo($settingInfo['template_id'],$source,$source_id,$is_custom);
|
|
|
|
if($templateInfo === false){
|
|
|
|
if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
|
|
|
|
$resultCode = $this->isCustomizedPage($source,$source_id);//查看当前页面是否定制
|
|
|
|
if($resultCode !== true){
|
|
|
|
return ['html'=>$resultCode['html'],'template_id'=>$resultCode['template_id']];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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);//获取中间部分代码
|
|
|
|
$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']];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :处理定制项目
|
|
|
|
* @remark :页面是否为定制页面
|
|
|
|
* @name :watchProjectIsCustomized
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 10:55
|
|
|
|
*/
|
|
|
|
public function watchProjectIsCustomized($source,$source_id){
|
|
|
|
//定制项目
|
|
|
|
if($this->user['is_customized'] == Project::CUSTOMIZED_ONE){
|
|
|
|
$type = $this->getCustomizedType($source,$source_id);//获取定制界面类型
|
|
|
|
//查看当前页面是否定制,是否开启可视化
|
|
|
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
|
|
if(in_array($type,$page_array)){//是定制界面
|
|
|
|
return $this->getVisualizationHtml($type);
|
|
|
|
public function isCustomizedPage($source,$source_id)
|
|
|
|
{
|
|
|
|
$type = $this->getCustomizedType($source, $source_id);//获取定制界面类型
|
|
|
|
//查看当前页面是否定制,是否开启可视化
|
|
|
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
|
|
if (in_array($type, $page_array)) {//是定制界面
|
|
|
|
//TODO::获取初始代码
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$customHtmlInfo = $bTemplateMainModel->read(['type'=>$type]);
|
|
|
|
if($customHtmlInfo === false){
|
|
|
|
$this->fail('定制页面,请先上传代码块');
|
|
|
|
}
|
|
|
|
return ['html'=>$customHtmlInfo['html']];
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看定制页面是否支持可视化
|
|
|
|
* @name :checkCustomizedPageVisualization
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 11:25
|
|
|
|
*/
|
|
|
|
public function checkCustomizedPageVisualization($type){
|
|
|
|
switch ($type){
|
|
|
|
case BTemplate::TYPE_ONE:
|
|
|
|
$is_visualization = $this->user['is_visualization']->index_page;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_TWO:
|
|
|
|
$is_visualization = $this->user['is_visualization']->product_details;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_THREE:
|
|
|
|
$is_visualization = $this->user['is_visualization']->product_list;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_FOUR:
|
|
|
|
$is_visualization = $this->user['is_visualization']->blog_details;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_FIVE:
|
|
|
|
$is_visualization = $this->user['is_visualization']->blog_list;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_SIX:
|
|
|
|
$is_visualization = $this->user['is_visualization']->product_list;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_SEVEN:
|
|
|
|
$is_visualization = $this->user['is_visualization']->news_details;
|
|
|
|
break;
|
|
|
|
case BTemplate::TYPE_EIGHT:
|
|
|
|
$is_visualization = $this->user['is_visualization']->news_list;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$is_visualization = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return $is_visualization;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -156,10 +207,10 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/13 9:50
|
|
|
|
*/
|
|
|
|
public function watchHomeISVisualization($template_id){
|
|
|
|
$homeTemplateInfo = $this->webTemplateInfo($template_id,1,0);
|
|
|
|
public function homeISVisualization($template_id){
|
|
|
|
$homeTemplateInfo = $this->webTemplateInfo($template_id,BTemplate::SOURCE_HOME,0);
|
|
|
|
if($homeTemplateInfo === false){
|
|
|
|
return false;
|
|
|
|
$this->fail('请先装修首页');
|
|
|
|
}
|
|
|
|
return $this->success($homeTemplateInfo);
|
|
|
|
}
|
...
|
...
|
|