正在显示
1 个修改的文件
包含
17 行增加
和
14 行删除
| @@ -39,38 +39,41 @@ class BTemplateLogLogic extends BaseLogic | @@ -39,38 +39,41 @@ class BTemplateLogLogic extends BaseLogic | ||
| 39 | $this->fail('error'); | 39 | $this->fail('error'); |
| 40 | } | 40 | } |
| 41 | $bTemplateModel = new BTemplate(); | 41 | $bTemplateModel = new BTemplate(); |
| 42 | - if($info['template_id'] == 0){//定制项目 | ||
| 43 | - //TODO::还原头部+底部 | ||
| 44 | - $bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); | ||
| 45 | - return $this->success(); | ||
| 46 | - } | ||
| 47 | //演示项目,不允许其他号码编辑 | 42 | //演示项目,不允许其他号码编辑 |
| 48 | if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ | 43 | if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ |
| 49 | $this->fail('演示项目仅支持演示功能,无法更改首页'); | 44 | $this->fail('演示项目仅支持演示功能,无法更改首页'); |
| 50 | } | 45 | } |
| 51 | - //获取当前项目的模版 | 46 | + if($info['template_id'] == 0){//todo::定制项目 |
| 47 | + //TODO::还原头部+底部 | ||
| 48 | + $bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); | ||
| 49 | + $commonData = $this->setCommonParam($info); | ||
| 50 | + $commonTemplateModel = new BTemplateCommon(); | ||
| 51 | + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$info['type'],'project_id'=>$this->user['project_id']]); | ||
| 52 | + return $this->success(); | ||
| 53 | + } | ||
| 54 | + //TODO::非定制项目,获取当前项目的模版 | ||
| 52 | $bSettingModel = new Setting(); | 55 | $bSettingModel = new Setting(); |
| 53 | $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); | 56 | $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); |
| 54 | if($settingInfo === false){ | 57 | if($settingInfo === false){ |
| 55 | $this->fail('请先选择模版'); | 58 | $this->fail('请先选择模版'); |
| 56 | } | 59 | } |
| 57 | - //切换模版 | ||
| 58 | - if($info['template_id'] != $settingInfo['template_id']){ | ||
| 59 | - $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]); | ||
| 60 | - } | ||
| 61 | try { | 60 | try { |
| 61 | + //切换模版 | ||
| 62 | + if($info['template_id'] != $settingInfo['template_id']){ | ||
| 63 | + $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]); | ||
| 64 | + } | ||
| 62 | $data = $this->setParam($info); | 65 | $data = $this->setParam($info); |
| 63 | $bTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); | 66 | $bTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]); |
| 67 | + //还原头部+底部 | ||
| 64 | $commonData = $this->setCommonParam($info); | 68 | $commonData = $this->setCommonParam($info); |
| 65 | $commonTemplateModel = new BTemplateCommon(); | 69 | $commonTemplateModel = new BTemplateCommon(); |
| 66 | - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); | ||
| 67 | - //更新所有界面的other | 70 | + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$info['type'],'project_id'=>$this->user['project_id']]); |
| 68 | if(!empty($info['other'])){ | 71 | if(!empty($info['other'])){ |
| 69 | - $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 72 | + $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]); |
| 70 | }else{ | 73 | }else{ |
| 71 | $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); | 74 | $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); |
| 72 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); | 75 | $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); |
| 73 | - $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); | 76 | + $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]); |
| 74 | } | 77 | } |
| 75 | }catch (\Exception $e){ | 78 | }catch (\Exception $e){ |
| 76 | $this->fail('系统错误,请联系管理员'); | 79 | $this->fail('系统错误,请联系管理员'); |
-
请 注册 或 登录 后发表评论