作者 lyh

gx

... ... @@ -259,14 +259,20 @@ class InitHtmlLogic extends BaseLogic
*/
public function getCustomizedHtml(){
$is_list = $this->param['is_list'] ?? 0;
$is_custom = $this->param['is_custom'] ?? 0;
$bTemplateMainModel = new BTemplateMain();
$info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
$info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]);
if($info === false){
$html = '';
}else{
//扩展模块获取头部
if($is_custom == BTemplate::IS_CUSTOM){
$type = $this->param['type'];
}else{
$type = $this->getCustomizedType($this->param['type'],$is_list);
}
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type]);
$commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);
if($commonInfo !== false){
$info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']);
}
... ... @@ -303,14 +309,16 @@ class InitHtmlLogic extends BaseLogic
public function saveCustomizedHtml(){
try {
$is_list = $this->param['is_list'] ?? 0;
$is_custom = $this->param['is_custom'] ?? 0;
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]);
$mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]);
if($mainInfo === false){
$mainData = [
'project_id'=>$this->user['project_id'],
'type'=>$this->param['type'],
'is_list'=>$is_list,
'main_html'=>$this->param['html']
'main_html'=>$this->param['html'],
'is_custom'=>$is_custom
];
$bTemplateMainModel->add($mainData);
}else{
... ... @@ -331,16 +339,21 @@ class InitHtmlLogic extends BaseLogic
* @method :post
* @time :2024/1/6 10:29
*/
public function saveCustomizeCommon($html,$source,$is_list){
public function saveCustomizeCommon($html,$source,$is_list,$is_custom){
if($is_custom == BTemplate::IS_CUSTOM){
$type = $source;
}else{
$type = $this->getCustomizedType($source,$is_list);
}
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type]);//查看当前头部是否存在
$commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在
$handleInfo = $this->handleCommonParam($html);
if($commonInfo === false){
$data = [
'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],
'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'],
'is_custom'=>$is_custom,'is_list'=>$is_list
];
$templateCommonModel->add($data);
}else{
... ...