作者 lyh

gx

... ... @@ -80,7 +80,8 @@ class BTemplateLogic extends BaseLogic
$mainInfo = $this->getMAinHtml($this->param['source'],$is_custom,$is_list);//获取中间部分代码
}else{
if($templateInfo['type'] == BTemplate::ALL_HTML){//返回整个html代码
$commonInfo = $this->getCommonHtml($this->param['source'],$is_list,0);//获取定制头部
$type = $this->getCustomizedType($this->param['source'],$is_list);
$commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
}
... ... @@ -172,7 +173,7 @@ class BTemplateLogic extends BaseLogic
if($customHtmlInfo === false){
$this->fail('定制页面,请先上传代码块');
}
$commonInfo = $this->getCommonHtml($type,$is_list,0);//获取定制头部
$commonInfo = $this->getCustomizedCommonHtml($type);//获取定制头部
if($commonInfo !== false){
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
}
... ... @@ -182,7 +183,24 @@ class BTemplateLogic extends BaseLogic
}
/**
* @remark :根据source获取type类型
* @remark :定制项目获取头部底部
* @name :getCustomizedCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/29 13:13
*/
public function getCustomizedCommonHtml($type){
$data = [
'template_id' => 0,
'project_id' => $this->user['project_id'],
'type'=>$type
];
$commonTemplateModel = new BTemplateCommon();
return $commonTemplateModel->read($data);
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
... ... @@ -248,7 +266,7 @@ class BTemplateLogic extends BaseLogic
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id,$is_custom = 0){
$type = $this->getType($source,$is_list,$template_id,$is_custom);
$type = $this->getType($source,$is_list,$is_custom);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id'],
... ... @@ -365,7 +383,11 @@ class BTemplateLogic extends BaseLogic
* @time :2023/12/13 17:05
*/
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
$type = $this->getType($source,$is_list,$template_id,$is_custom);//获取头部类型1-9(首页到自定义页面)
if($template_id != 0){
$type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
}else{
$type = $this->getCustomizedType($source,$is_list);
}
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
... ... @@ -440,15 +462,12 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/10/21 17:29
*/
public function getType($source,$is_list,$template_id,$is_custom = 0){
public function getType($source,$is_list,$is_custom = 0){
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
return $this->success($type);
}
if($template_id == 0){//保存上传的代码块时,默认为独立头部
$is_head == BTemplate::IS_HEADER;
}
//查看页面是否设置自定义头部底部
if($is_head != BTemplate::IS_NO_HEADER) {
$pageSettingModel = new PageSetting();
... ... @@ -467,6 +486,7 @@ class BTemplateLogic extends BaseLogic
return $this->success($type);
}
/**
* @remark :生成记录
* @name :setTemplateLog
... ...
... ... @@ -124,7 +124,7 @@ class InitHtmlLogic extends BaseLogic
* @time :2023/12/13 17:05
*/
public function saveCommonHtml($html,$source,$is_list,$template_id,$is_custom){
$type = $this->getType($source,$is_list,$template_id,$is_custom);//获取头部类型1-9(首页到自定义页面)
$type = $this->getType($source,$is_list,$is_custom);//获取头部类型1-9(首页到自定义页面)
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
... ... @@ -154,7 +154,7 @@ class InitHtmlLogic extends BaseLogic
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id,$is_custom){
$type = $this->getType($source,$is_list,$template_id,$is_custom);
$type = $this->getType($source,$is_list,$is_custom);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id'],
... ... @@ -176,12 +176,9 @@ class InitHtmlLogic extends BaseLogic
* @method :post
* @time :2023/10/21 17:29
*/
public function getType($source,$is_list,$template_id,$is_custom = 0){
public function getType($source,$is_list,$is_custom = 0){
$type = BTemplate::SOURCE_HOME;//首页公共头部底部
$is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
if($template_id == 0){//保存上传的代码块时,默认为独立头部
$is_head == BTemplate::IS_HEADER;
}
if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
return $this->success($type);
}
... ...