作者 lyh

gx

@@ -259,14 +259,20 @@ class InitHtmlLogic extends BaseLogic @@ -259,14 +259,20 @@ class InitHtmlLogic extends BaseLogic
259 */ 259 */
260 public function getCustomizedHtml(){ 260 public function getCustomizedHtml(){
261 $is_list = $this->param['is_list'] ?? 0; 261 $is_list = $this->param['is_list'] ?? 0;
  262 + $is_custom = $this->param['is_custom'] ?? 0;
262 $bTemplateMainModel = new BTemplateMain(); 263 $bTemplateMainModel = new BTemplateMain();
263 - $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); 264 + $info = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]);
264 if($info === false){ 265 if($info === false){
265 $html = ''; 266 $html = '';
266 }else{ 267 }else{
  268 + //扩展模块获取头部
  269 + if($is_custom == BTemplate::IS_CUSTOM){
  270 + $type = $this->param['type'];
  271 + }else{
267 $type = $this->getCustomizedType($this->param['type'],$is_list); 272 $type = $this->getCustomizedType($this->param['type'],$is_list);
  273 + }
268 $commonTemplateModel = new BTemplateCommon(); 274 $commonTemplateModel = new BTemplateCommon();
269 - $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type]); 275 + $commonInfo = $commonTemplateModel->read(['template_id' => 0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);
270 if($commonInfo !== false){ 276 if($commonInfo !== false){
271 $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']); 277 $info['main_html'] = $this->handleAllHtml($commonInfo,$info['main_html']);
272 } 278 }
@@ -303,14 +309,16 @@ class InitHtmlLogic extends BaseLogic @@ -303,14 +309,16 @@ class InitHtmlLogic extends BaseLogic
303 public function saveCustomizedHtml(){ 309 public function saveCustomizedHtml(){
304 try { 310 try {
305 $is_list = $this->param['is_list'] ?? 0; 311 $is_list = $this->param['is_list'] ?? 0;
  312 + $is_custom = $this->param['is_custom'] ?? 0;
306 $bTemplateMainModel = new BTemplateMain(); 313 $bTemplateMainModel = new BTemplateMain();
307 - $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_list'=>$is_list]); 314 + $mainInfo = $bTemplateMainModel->read(['type'=>$this->param['type'],'is_custom'=>$is_custom,'is_list'=>$is_list]);
308 if($mainInfo === false){ 315 if($mainInfo === false){
309 $mainData = [ 316 $mainData = [
310 'project_id'=>$this->user['project_id'], 317 'project_id'=>$this->user['project_id'],
311 'type'=>$this->param['type'], 318 'type'=>$this->param['type'],
312 'is_list'=>$is_list, 319 'is_list'=>$is_list,
313 - 'main_html'=>$this->param['html'] 320 + 'main_html'=>$this->param['html'],
  321 + 'is_custom'=>$is_custom
314 ]; 322 ];
315 $bTemplateMainModel->add($mainData); 323 $bTemplateMainModel->add($mainData);
316 }else{ 324 }else{
@@ -331,16 +339,21 @@ class InitHtmlLogic extends BaseLogic @@ -331,16 +339,21 @@ class InitHtmlLogic extends BaseLogic
331 * @method :post 339 * @method :post
332 * @time :2024/1/6 10:29 340 * @time :2024/1/6 10:29
333 */ 341 */
334 - public function saveCustomizeCommon($html,$source,$is_list){ 342 + public function saveCustomizeCommon($html,$source,$is_list,$is_custom){
  343 + if($is_custom == BTemplate::IS_CUSTOM){
  344 + $type = $source;
  345 + }else{
335 $type = $this->getCustomizedType($source,$is_list); 346 $type = $this->getCustomizedType($source,$is_list);
  347 + }
336 $templateCommonModel = new BTemplateCommon(); 348 $templateCommonModel = new BTemplateCommon();
337 - $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type]);//查看当前头部是否存在 349 + $commonInfo = $templateCommonModel->read(['template_id'=>0,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]);//查看当前头部是否存在
338 $handleInfo = $this->handleCommonParam($html); 350 $handleInfo = $this->handleCommonParam($html);
339 if($commonInfo === false){ 351 if($commonInfo === false){
340 $data = [ 352 $data = [
341 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'], 353 'head_html'=>$handleInfo['head_html'], 'head_css'=>$handleInfo['head_css'],
342 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'], 354 'footer_html'=>$handleInfo['footer_html'], 'footer_css'=>$handleInfo['footer_css'],
343 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'], 355 'type'=>$type,'template_id'=>0, 'project_id'=>$this->user['project_id'],
  356 + 'is_custom'=>$is_custom,'is_list'=>$is_list
344 ]; 357 ];
345 $templateCommonModel->add($data); 358 $templateCommonModel->add($data);
346 }else{ 359 }else{