正在显示
1 个修改的文件
包含
18 行增加
和
17 行删除
| @@ -112,13 +112,14 @@ class ProjectLogic extends BaseLogic | @@ -112,13 +112,14 @@ class ProjectLogic extends BaseLogic | ||
| 112 | public function getProjectInfo($id){ | 112 | public function getProjectInfo($id){ |
| 113 | $info = Common::get_user_cache($this->model->getTable(),$id); | 113 | $info = Common::get_user_cache($this->model->getTable(),$id); |
| 114 | if(empty($info)){ | 114 | if(empty($info)){ |
| 115 | - $info = $this->model->with('payment')->with('deploy_build') | ||
| 116 | - ->with('deploy_optimize')->with('online_check') | 115 | + $info = $this->model->with('payment')->with('deploy_build')->with('deploy_optimize')->with('online_check') |
| 117 | ->with('project_after')->where(['id'=>$id])->first()->toArray(); | 116 | ->with('project_after')->where(['id'=>$id])->first()->toArray(); |
| 118 | if(!empty($info['online_check']['created_manage_id'])){ | 117 | if(!empty($info['online_check']['created_manage_id'])){ |
| 119 | $info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? ''; | 118 | $info['online_check']['name'] = (new Manage())->read(['id'=>$info['online_check']['created_manage_id']])['name'] ?? ''; |
| 120 | } | 119 | } |
| 120 | + if(isset($info['deploy_optimize']['minor_keywords']) && !empty($info['deploy_optimize']['minor_keywords'])){ | ||
| 121 | $info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? ''; | 121 | $info['deploy_optimize']['minor_keywords'] = json_decode($info['deploy_optimize']['minor_keywords']) ?? ''; |
| 122 | + } | ||
| 122 | if($info['extend_type'] != 0){ | 123 | if($info['extend_type'] != 0){ |
| 123 | $info['type'] = $info['extend_type']; | 124 | $info['type'] = $info['extend_type']; |
| 124 | } | 125 | } |
| @@ -135,10 +136,10 @@ class ProjectLogic extends BaseLogic | @@ -135,10 +136,10 @@ class ProjectLogic extends BaseLogic | ||
| 135 | * @time :2023/8/17 14:19 | 136 | * @time :2023/8/17 14:19 |
| 136 | */ | 137 | */ |
| 137 | public function save($param){ | 138 | public function save($param){ |
| 138 | -// DB::beginTransaction(); | ||
| 139 | -// try { | ||
| 140 | - if($param['type'] == 5){ | ||
| 141 | - $param['extend_type'] == 5; | 139 | + DB::beginTransaction(); |
| 140 | + try { | ||
| 141 | + if($param['type'] == Project::TYPE_FIVE){ | ||
| 142 | + $param['extend_type'] == Project::TYPE_FIVE; | ||
| 142 | unset($param['type']); | 143 | unset($param['type']); |
| 143 | } | 144 | } |
| 144 | $res = parent::save($param); | 145 | $res = parent::save($param); |
| @@ -148,12 +149,12 @@ class ProjectLogic extends BaseLogic | @@ -148,12 +149,12 @@ class ProjectLogic extends BaseLogic | ||
| 148 | $this->saveDeployBuild($param); | 149 | $this->saveDeployBuild($param); |
| 149 | $this->saveDeployOptimize($param); | 150 | $this->saveDeployOptimize($param); |
| 150 | $this->saveAfter($param); | 151 | $this->saveAfter($param); |
| 151 | -// DB::commit(); | ||
| 152 | -// }catch (\Exception $e){ | ||
| 153 | -// DB::rollBack(); | ||
| 154 | -// errorLog('项目保存失败', $param, $e); | ||
| 155 | -// $this->fail('保存失败'); | ||
| 156 | -// } | 152 | + DB::commit(); |
| 153 | + }catch (\Exception $e){ | ||
| 154 | + DB::rollBack(); | ||
| 155 | + errorLog('项目保存失败', $param, $e); | ||
| 156 | + $this->fail('保存失败'); | ||
| 157 | + } | ||
| 157 | return $this->success(); | 158 | return $this->success(); |
| 158 | } | 159 | } |
| 159 | 160 | ||
| @@ -291,11 +292,11 @@ class ProjectLogic extends BaseLogic | @@ -291,11 +292,11 @@ class ProjectLogic extends BaseLogic | ||
| 291 | 292 | ||
| 292 | public function channelSource($param){ | 293 | public function channelSource($param){ |
| 293 | switch ($param['type']){ | 294 | switch ($param['type']){ |
| 294 | - case 1: | 295 | + case Project::TYPE_ONE: |
| 295 | return Zone::pluck('title', 'id')->toArray(); | 296 | return Zone::pluck('title', 'id')->toArray(); |
| 296 | - case 2: | 297 | + case Project::TYPE_TWO: |
| 297 | return Channel::where('zone_id', $param['zone_id']??0)->pluck('alias', 'id')->toArray(); | 298 | return Channel::where('zone_id', $param['zone_id']??0)->pluck('alias', 'id')->toArray(); |
| 298 | - case 3: | 299 | + case Project::TYPE_THREE: |
| 299 | return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray(); | 300 | return User::where('channel_id', $param['channel_id']??0)->pluck('name', 'id')->toArray(); |
| 300 | } | 301 | } |
| 301 | return []; | 302 | return []; |
| @@ -378,9 +379,9 @@ class ProjectLogic extends BaseLogic | @@ -378,9 +379,9 @@ class ProjectLogic extends BaseLogic | ||
| 378 | */ | 379 | */ |
| 379 | public function setPostId($plan,$id){ | 380 | public function setPostId($plan,$id){ |
| 380 | $length = strlen((string)$id); // 获取变量的位数 | 381 | $length = strlen((string)$id); // 获取变量的位数 |
| 381 | - $paddingLength = 5 - $length; // 计算填充前面的 0 的位数 | 382 | + $paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数 |
| 382 | $zeros = str_repeat("0", $paddingLength); | 383 | $zeros = str_repeat("0", $paddingLength); |
| 383 | - $number = '6'.$plan.$zeros.$id; | 384 | + $number = Project::TYPE_SIX.$plan.$zeros.$id; |
| 384 | $projectModel = new Project(); | 385 | $projectModel = new Project(); |
| 385 | $projectModel->edit(['post_id'=>$number],['id'=>$id]); | 386 | $projectModel->edit(['post_id'=>$number],['id'=>$id]); |
| 386 | return true; | 387 | return true; |
-
请 注册 或 登录 后发表评论