作者 lyh

gx

@@ -528,10 +528,11 @@ class BTemplateLogic extends BaseLogic @@ -528,10 +528,11 @@ class BTemplateLogic extends BaseLogic
528 $is_custom = $is_list = 0; 528 $is_custom = $is_list = 0;
529 } 529 }
530 //查看当前数据是否还存在 530 //查看当前数据是否还存在
531 - $condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type]; 531 + $condition = ['template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type];
532 $info = $templateComModel->read($condition); 532 $info = $templateComModel->read($condition);
533 if($info === false){ 533 if($info === false){
534 $data = array_merge($param,$condition); 534 $data = array_merge($param,$condition);
  535 + $data['project_id'] = $this->user['project_id'];
535 $templateComModel->add($data); 536 $templateComModel->add($data);
536 }else{ 537 }else{
537 $templateComModel->edit($param,$condition); 538 $templateComModel->edit($param,$condition);
@@ -217,10 +217,11 @@ class InitHtmlLogic extends BaseLogic @@ -217,10 +217,11 @@ class InitHtmlLogic extends BaseLogic
217 $is_custom = $is_list = 0; 217 $is_custom = $is_list = 0;
218 } 218 }
219 //查看当前数据是否还存在 219 //查看当前数据是否还存在
220 - $condition = ['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type]; 220 + $condition = ['template_id'=>$template_id,'is_list'=>$is_list,'is_custom'=>$is_custom,'source'=>$typeSource,'common_type'=>$type];
221 $info = $templateComModel->read($condition); 221 $info = $templateComModel->read($condition);
222 if($info === false){ 222 if($info === false){
223 $data = array_merge($param,$condition); 223 $data = array_merge($param,$condition);
  224 + $data['project_id'] = $this->user['project_id'];
224 $templateComModel->add($data); 225 $templateComModel->add($data);
225 }else{ 226 }else{
226 $templateComModel->edit($param,$condition); 227 $templateComModel->edit($param,$condition);
@@ -342,7 +343,7 @@ class InitHtmlLogic extends BaseLogic @@ -342,7 +343,7 @@ class InitHtmlLogic extends BaseLogic
342 */ 343 */
343 public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){ 344 public function getCustomizeTemplateComHtml($type,$is_custom,$is_list,$template_id = 0){
344 $data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>'']; 345 $data = ['head_html'=>'','head_style'=>'','footer_html'=>'','footer_style'=>'','other'=>''];
345 - $param = ['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list]; 346 + $param = ['template_id'=>$template_id,'type'=>$type,'is_custom'=>$is_custom,'is_list'=>$is_list];
346 $commonTemplateModel = new BTemplateCom(); 347 $commonTemplateModel = new BTemplateCom();
347 $commonList = $commonTemplateModel->list($param); 348 $commonList = $commonTemplateModel->list($param);
348 if(!empty($commonList)){ 349 if(!empty($commonList)){
@@ -369,7 +370,7 @@ class InitHtmlLogic extends BaseLogic @@ -369,7 +370,7 @@ class InitHtmlLogic extends BaseLogic
369 * @time :2023/12/13 15:39 370 * @time :2023/12/13 15:39
370 */ 371 */
371 public function handleAllHtml($commonInfo,$html){ 372 public function handleAllHtml($commonInfo,$html){
372 - if(!empty($commonInfo)){ 373 + if(!empty($commonInfo['head_html']) && !empty($commonInfo['footer_html'])){
373 $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html); 374 $html = preg_replace('/<header\b[^>]*>(.*?)<\/header>/s', $commonInfo['head_html'], $html);
374 $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html); 375 $html = preg_replace('/<footer\b[^>]*>(.*?)<\/footer>/s', $commonInfo['footer_html'], $html);
375 $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html); 376 $html = preg_replace('/<style id="globalsojs-header">(.*?)<\/style>/s', $commonInfo['head_css'], $html);