作者 lyh

gx

@@ -120,7 +120,7 @@ class BTemplateLogic extends BaseLogic @@ -120,7 +120,7 @@ class BTemplateLogic extends BaseLogic
120 } 120 }
121 121
122 /** 122 /**
123 - * @remark :处理产品页数据 123 + * @remark :处理其他页数据
124 * @name :ProductHtml 124 * @name :ProductHtml
125 * @author :lyh 125 * @author :lyh
126 * @method :post 126 * @method :post
@@ -134,8 +134,9 @@ class BTemplateLogic extends BaseLogic @@ -134,8 +134,9 @@ class BTemplateLogic extends BaseLogic
134 //查看当前模板是否已编辑保存web_template 134 //查看当前模板是否已编辑保存web_template
135 $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id); 135 $TemplateInfo = $this->webTemplateInfo($info['template_id'],$source,$source_id);
136 if($TemplateInfo === false){ 136 if($TemplateInfo === false){
137 - $main_html = "<main>{$this->getProductModule()}</main>";  
138 - $main_style = "<style id='globalsojs-styles'></style>"; 137 + $mainInfo = $this->getCommonMain($source,$source_id);
  138 + $main_html = $mainInfo['main_html'];
  139 + $main_style = $mainInfo['main_css'];
139 }else{ 140 }else{
140 $main_html = $TemplateInfo['main_html']; 141 $main_html = $TemplateInfo['main_html'];
141 $main_style = $TemplateInfo['main_css']; 142 $main_style = $TemplateInfo['main_css'];
@@ -153,6 +154,31 @@ class BTemplateLogic extends BaseLogic @@ -153,6 +154,31 @@ class BTemplateLogic extends BaseLogic
153 } 154 }
154 155
155 /** 156 /**
  157 + * @remark :获取中间公共部分
  158 + * @name :getCommonMain
  159 + * @author :lyh
  160 + * @method :post
  161 + * @time :2023/10/24 15:58
  162 + */
  163 + public function getCommonMain($source,$source_id){
  164 + $data = [];
  165 + if ($source == 2) {if ($source_id != 0) {$type = 2;} else {$type = 3;}}
  166 + if ($source == 3) {if ($source_id != 0) {$type = 4;} else {$type = 5;}}
  167 + if ($source == 4) {if ($source_id != 0) {$type = 6;} else {$type = 7;}}
  168 + //查询有没有公共模板详情样式
  169 + $bTemplateMainModel = new BTemplateMain();
  170 + $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$type]);
  171 + if($mainInfo === false){
  172 + $data['main_html'] = "<main>{$this->getProductModule()}</main>";
  173 + $data['main_css'] = "<style id='globalsojs-styles'></style>";
  174 + }else{
  175 + $data['main_html'] = $mainInfo['main_html'];
  176 + $data['main_css'] = $mainInfo['main_css'];
  177 + }
  178 + return $data;
  179 + }
  180 +
  181 + /**
156 * @remark :根据类型获取公共头和底 182 * @remark :根据类型获取公共头和底
157 * @name :getCommonPage 183 * @name :getCommonPage
158 * @author :lyh 184 * @author :lyh
@@ -180,8 +206,7 @@ class BTemplateLogic extends BaseLogic @@ -180,8 +206,7 @@ class BTemplateLogic extends BaseLogic
180 if ($source_id != 0) {$data['type'] = 6;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}} 206 if ($source_id != 0) {$data['type'] = 6;if ($pageInfo['news_details'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
181 else {$data['type'] = 7;if ($pageInfo['news_lists'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}} 207 else {$data['type'] = 7;if ($pageInfo['news_lists'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}}
182 if ($source == 5) {//聚合页 208 if ($source == 5) {//聚合页
183 - $data['type'] = 8;  
184 - if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}} 209 + $data['type'] = 8;if ($pageInfo['polymerization'] != 0) {$commonInfo = $commonTemplateModel->read($data);}}
185 } 210 }
186 } 211 }
187 //获取首页公共的头部和底部 212 //获取首页公共的头部和底部