作者 lyh

gx

@@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic @@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic
284 public function templateSave(){ 284 public function templateSave(){
285 //演示项目不允许修改 285 //演示项目不允许修改
286 $this->showProjectNoEdit($this->param['source']); 286 $this->showProjectNoEdit($this->param['source']);
287 -// DB::beginTransaction();  
288 -// try { 287 + DB::beginTransaction();
  288 + try {
289 $this->param = $this->handleDefaultString($this->param);//设置默认字符 289 $this->param = $this->handleDefaultString($this->param);//设置默认字符
290 $templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'], 290 $templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
291 $this->param['source_id'],$this->param['is_custom']); 291 $this->param['source_id'],$this->param['is_custom']);
@@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic @@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic
299 //更新头部信息 299 //更新头部信息
300 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']); 300 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
301 $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); 301 $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
302 -// DB::commit();  
303 -// }catch (\Exception $e){  
304 -// DB::rollBack();  
305 -// $this->fail('系统错误,请联系管理员');  
306 -// } 302 + DB::commit();
  303 + }catch (\Exception $e){
  304 + DB::rollBack();
  305 + $this->fail('系统错误,请联系管理员');
  306 + }
307 //通知更新 307 //通知更新
308 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']); 308 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
309 return $this->success(); 309 return $this->success();
@@ -720,7 +720,7 @@ class BTemplateLogic extends BaseLogic @@ -720,7 +720,7 @@ class BTemplateLogic extends BaseLogic
720 $this->fail('请先设置模板'); 720 $this->fail('请先设置模板');
721 } 721 }
722 $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版 722 $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
723 - $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom); 723 + $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
724 //获取设置的默认中间部分 724 //获取设置的默认中间部分
725 $bTemplateMainModel = new BTemplateMain(); 725 $bTemplateMainModel = new BTemplateMain();
726 $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 726 $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
@@ -744,17 +744,17 @@ class BTemplateLogic extends BaseLogic @@ -744,17 +744,17 @@ class BTemplateLogic extends BaseLogic
744 * @method :post 744 * @method :post
745 * @time :2023/12/15 18:06 745 * @time :2023/12/15 18:06
746 */ 746 */
747 - public function getTypeCommonHtml($template_id,$is_custom){ 747 + public function getTypeCommonHtml($template_id,$type,$is_custom){
748 //获取首页公共部分 748 //获取首页公共部分
749 $templateCommonModel = new BTemplateCommon(); 749 $templateCommonModel = new BTemplateCommon();
750 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]); 750 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
751 - //判断当前项目是否有设置独立头部的权限  
752 if($is_custom == BTemplate::SOURCE_CUSTOM){ 751 if($is_custom == BTemplate::SOURCE_CUSTOM){
753 return $this->success($commonInfo); 752 return $this->success($commonInfo);
754 } 753 }
  754 + //判断当前项目是否有设置独立头部的权限
755 if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { 755 if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
756 //有权限时,获取独立头部 756 //有权限时,获取独立头部
757 - $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 757 + $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
758 if($commonTypeInfo !== false){ 758 if($commonTypeInfo !== false){
759 $commonInfo = $commonTypeInfo; 759 $commonInfo = $commonTypeInfo;
760 } 760 }