作者 lyh

gx

... ... @@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic
public function templateSave(){
//演示项目不允许修改
$this->showProjectNoEdit($this->param['source']);
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$this->param = $this->handleDefaultString($this->param);//设置默认字符
$templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
$this->param['source_id'],$this->param['is_custom']);
... ... @@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic
//更新头部信息
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
return $this->success();
... ... @@ -720,7 +720,7 @@ class BTemplateLogic extends BaseLogic
$this->fail('请先设置模板');
}
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom);
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
//获取设置的默认中间部分
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
... ... @@ -744,17 +744,17 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/15 18:06
*/
public function getTypeCommonHtml($template_id,$is_custom){
public function getTypeCommonHtml($template_id,$type,$is_custom){
//获取首页公共部分
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
//判断当前项目是否有设置独立头部的权限
if($is_custom == BTemplate::SOURCE_CUSTOM){
return $this->success($commonInfo);
}
//判断当前项目是否有设置独立头部的权限
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
//有权限时,获取独立头部
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
if($commonTypeInfo !== false){
$commonInfo = $commonTypeInfo;
}
... ...