|
...
|
...
|
@@ -85,7 +85,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
$mainInfo = ['main_html'=>$templateInfo['main_html'], 'main_css'=>$templateInfo['main_css']];
|
|
|
|
}
|
|
|
|
$commonInfo = $this->getTemplateComHtml($this->param['source'],$is_list,$is_custom,$template_id);//获取非定制头部
|
|
|
|
$html = $commonInfo['head_css'].$mainInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
|
|
|
|
$html = $commonInfo['head_style'].$mainInfo['main_style'].$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$mainInfo['main_html'].$commonInfo['footer_html'];
|
|
|
|
$html = $this->getHeadFooter($html);
|
|
|
|
$result = ['html'=>$html,'template_id'=>$template_id];
|
|
|
|
if($templateInfo !== false) {
|
|
...
|
...
|
@@ -96,6 +96,75 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :非定制获取头部+底部
|
|
|
|
* @name :getTemplateComHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/4/29 16:53
|
|
|
|
*/
|
|
|
|
public function getTemplateComHtml($source,$is_list,$is_custom,$template_id){
|
|
|
|
$condition = ['common_type'=>BTemplate::COMMON_HEAD,'source'=>'','is_list'=>$is_list,'is_custom'=>$is_custom,'template_id'=>$template_id];
|
|
|
|
$headComInfo = $this->getHeadComHtml($condition,$source,$is_list,$is_custom);
|
|
|
|
$bTemplateComModel = new BTemplateCom();
|
|
|
|
$condition['common_type'] = BTemplate::COMMON_OTHER;
|
|
|
|
$condition['source'] = $headComInfo['source'];
|
|
|
|
$otherInfo = $bTemplateComModel->read($condition);
|
|
|
|
if($otherInfo === false){
|
|
|
|
$this->fail('获取失败,请联系管理员');
|
|
|
|
}
|
|
|
|
$footerComInfo = $this->getFooterComHtml($condition,$source,$is_list,$is_custom);
|
|
|
|
$data = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
|
|
|
|
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :公共头部
|
|
|
|
* @name :HeadComHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/4/29 17:20
|
|
|
|
*/
|
|
|
|
public function getHeadComHtml($condition,$source,$is_list,$is_custom){
|
|
|
|
$commonHead = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_HEAD);
|
|
|
|
$bTemplateComModel = new BTemplateCom();
|
|
|
|
$condition['source'] = $commonHead;
|
|
|
|
$condition['common_type'] = BTemplate::COMMON_FOOTER;
|
|
|
|
$headComInfo = $bTemplateComModel->read($condition);
|
|
|
|
if($headComInfo === false){
|
|
|
|
//取默认首页的
|
|
|
|
$condition['source'] = BTemplate::SOURCE_HOME;
|
|
|
|
$headComInfo = $bTemplateComModel->read($condition);
|
|
|
|
if($headComInfo === false){
|
|
|
|
$this->fail('获取失败,请联系管理员');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($headComInfo);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @remark :公共底部
|
|
|
|
* @name :footerComHtml
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/4/29 17:18
|
|
|
|
*/
|
|
|
|
public function getFooterComHtml($condition,$source,$is_list,$is_custom){
|
|
|
|
$bTemplateComModel = new BTemplateCom();
|
|
|
|
$condition['common_type'] = BTemplate::COMMON_FOOTER;
|
|
|
|
$condition['source'] = $this->getType($source,$is_list,$is_custom,BTemplate::COMMON_FOOTER);
|
|
|
|
$footerComInfo = $bTemplateComModel->read($condition);
|
|
|
|
if($footerComInfo === false){
|
|
|
|
//取默认首页的
|
|
|
|
$condition['source'] = BTemplate::SOURCE_HOME;
|
|
|
|
$footerComInfo = $bTemplateComModel->read($condition);
|
|
|
|
if($footerComInfo === false){
|
|
|
|
$this->fail('获取失败,请联系管理员');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($footerComInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取整个html代码
|
|
|
|
* @name :getCustomizeAllHtml
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -104,11 +173,11 @@ class BTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function getCustomizeAllHtml($templateInfo,$template_id,$is_custom,$is_list){
|
|
|
|
if($is_custom == BTemplate::IS_CUSTOM){
|
|
|
|
$commonInfo = $this->getTemplateComHtml($templateInfo['source'],$is_custom,$is_list);//获取定制头部
|
|
|
|
$commonInfo = $this->getCustomizeTemplateComHtml($templateInfo['source'],$is_custom,$is_list);//获取定制头部
|
|
|
|
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
|
|
|
|
}else{
|
|
|
|
$type = $this->getCustomizedType($templateInfo['source'],$is_list);
|
|
|
|
$commonInfo = $this->getTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
|
|
|
|
$commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
|
|
|
|
$html = $this->handleAllHtml($commonInfo,$templateInfo['html']);
|
|
|
|
}
|
|
|
|
return $this->success(['html'=>$html,'template_id'=>$template_id,'id'=>$templateInfo['id'],'updated_at'=>$templateInfo['updated_at']]);
|
|
...
|
...
|
@@ -178,7 +247,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
if($customHtmlInfo === false){
|
|
|
|
$this->fail('定制页面,请先上传代码块');
|
|
|
|
}
|
|
|
|
$commonInfo = $this->getTemplateComHtml($source,$is_custom,$is_list);//获取定制头部
|
|
|
|
$commonInfo = $this->getCustomizeTemplateComHtml($source,$is_custom,$is_list);//获取定制头部
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
|
|
|
|
}
|
|
...
|
...
|
@@ -258,7 +327,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
if($customHtmlInfo === false){
|
|
|
|
$this->fail('定制页面,请先上传代码块');
|
|
|
|
}
|
|
|
|
$commonInfo = $this->getTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
|
|
|
|
$commonInfo = $this->getCustomizeTemplateComHtml($type,$is_custom,$is_list);//获取定制头部
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$customHtmlInfo['main_html'] = $this->handleAllHtml($commonInfo,$customHtmlInfo['main_html']);
|
|
|
|
}
|
|
...
|
...
|
@@ -275,7 +344,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/12/29 13:13
|
|
|
|
*/
|
|
|
|
public function getTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){
|
|
|
|
public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){
|
|
|
|
$data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>''];
|
|
|
|
$param = ['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list];
|
|
|
|
$commonTemplateModel = new BTemplateCom();
|
...
|
...
|
|