|
...
|
...
|
@@ -65,11 +65,57 @@ class BTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function getTemplate(){
|
|
|
|
$template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id
|
|
|
|
$data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$this->param['is_custom'] ?? 0);
|
|
|
|
$is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
|
|
|
|
$is_list = $this->param['is_list'] ?? 0;//是否为
|
|
|
|
$data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$is_custom);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取可视化html
|
|
|
|
* @name :getTemplateHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/27 14:48
|
|
|
|
*/
|
|
|
|
public function getTemplateHtml(){
|
|
|
|
$template_id = $this->getSettingTemplate($this->param['source'],$this->param['source_id']);//设置的模版id
|
|
|
|
$is_custom = $this->param['is_custom'] ?? 0;//是否为扩展模块
|
|
|
|
$is_list = $this->param['is_list'] ?? 0;//是否为列表页
|
|
|
|
$templateInfo = $this->model->read(['template_id'=>$template_id, 'source'=>$this->param['source'],'project_id'=>$this->user['project_id'],
|
|
|
|
'source_id'=>$this->param['source_id'], 'is_custom'=>$is_custom, 'is_list'=>$is_list]);
|
|
|
|
if($templateInfo === false){
|
|
|
|
if($this->user['is_customized'] == BTemplate::SOURCE_VISUALIZATION){//处理定制页面初始数据
|
|
|
|
$html = $this->isCustomizedPage($this->param['source'],$this->param['source_id']);//查看当前页面是否定制
|
|
|
|
return $this->success(['html'=>$html,'template_id'=>$template_id]);
|
|
|
|
}
|
|
|
|
$mainInfo = $this->getMAinHtml($this->param['source'],$this->param['source_id'],$is_custom);//获取中间部分代码
|
|
|
|
}
|
|
|
|
$data = $this->getHtml($template_id,$this->param['source'],$this->param['source_id'],$is_custom);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取中间部分的html
|
|
|
|
* @name :getMAinHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/27 15:00
|
|
|
|
*/
|
|
|
|
public function getMAinHtml($source,$source_id,$is_custom,$is_list){
|
|
|
|
//查询有没有公共详情模板
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
if($mainInfo === false){
|
|
|
|
$data['main_html'] = $this->getModule($type);
|
|
|
|
$data['main_css'] = "<style id='globalsojs-styles'></style>";
|
|
|
|
}else{
|
|
|
|
$data['main_html'] = $mainInfo['main_html'];
|
|
|
|
$data['main_css'] = $mainInfo['main_css'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取可视化装修的html
|
|
|
|
* @name :getTemplateHtml
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -181,7 +227,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
//查看当前页面是否定制,是否开启可视化
|
|
|
|
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
|
|
|
|
if (in_array($type, $page_array)) {//是定制界面
|
|
|
|
return 0;
|
|
|
|
return $this->success(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$bSettingModel = new Setting();
|
|
...
|
...
|
@@ -189,7 +235,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先选择模版');
|
|
|
|
}
|
|
|
|
return $info['template_id'];
|
|
|
|
return $this->success($info['template_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -221,7 +267,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
public function getCommonMain($source,$source_id,$is_custom){
|
|
|
|
$data = [];
|
|
|
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
|
|
if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
|
|
|
|
if($source_id != 0){$type = BTemplate::TYPE_CUSTOM;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
|
|
|
|
}else{
|
|
|
|
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
|
|
|
|
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
|
|
...
|
...
|
@@ -821,64 +867,6 @@ class BTemplateLogic extends BaseLogic |
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取详情模板详情
|
|
|
|
* @name :getDetail
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/24 11:29
|
|
|
|
*/
|
|
|
|
public function getDetail(){
|
|
|
|
$bSettingModel = new Setting();
|
|
|
|
$bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($bSettingInfo === false){
|
|
|
|
$this->fail('请先设置模板');
|
|
|
|
}
|
|
|
|
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
|
|
|
|
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
|
|
|
|
//获取设置的默认中间部分
|
|
|
|
$bTemplateMainModel = new BTemplateMain();
|
|
|
|
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type'],'is_custom'=>$is_custom]);
|
|
|
|
if($mainInfo === false){
|
|
|
|
if($is_custom == BTemplate::SOURCE_CUSTOM) {
|
|
|
|
$this->param['type'] = BTemplate::TYPE_CUSTOM_DETAIL;
|
|
|
|
}
|
|
|
|
$main_html = $this->getModule($this->param['type']);
|
|
|
|
$main_style = "<style id='globalsojs-styles'></style>";
|
|
|
|
}else{
|
|
|
|
$main_html = $mainInfo['main_html'];
|
|
|
|
$main_style = $mainInfo['main_css'];
|
|
|
|
}
|
|
|
|
$html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
|
|
|
|
$html = $this->getHeadFooter($html);//组装数据
|
|
|
|
return $this->success($html);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据type获取html
|
|
|
|
* @name :getHeaderFooter
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/15 18:06
|
|
|
|
*/
|
|
|
|
public function getTypeCommonHtml($template_id,$type,$is_custom){
|
|
|
|
//获取首页公共部分
|
|
|
|
$templateCommonModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
if($is_custom == BTemplate::SOURCE_CUSTOM){
|
|
|
|
return $this->success($commonInfo);
|
|
|
|
}
|
|
|
|
//判断当前项目是否有设置独立头部的权限
|
|
|
|
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
|
|
|
|
//有权限时,获取独立头部
|
|
|
|
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
if($commonTypeInfo !== false){
|
|
|
|
$commonInfo = $commonTypeInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($commonInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存详情模板数据
|
...
|
...
|
|