正在显示
2 个修改的文件
包含
87 行增加
和
7 行删除
| @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic; | @@ -13,6 +13,7 @@ use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | use App\Models\Project\DeployBuild; | 13 | use App\Models\Project\DeployBuild; |
| 14 | use App\Models\Project\Project; | 14 | use App\Models\Project\Project; |
| 15 | use App\Models\Project\ProjectRenew; | 15 | use App\Models\Project\ProjectRenew; |
| 16 | +use App\Models\Project\RenewLog; | ||
| 16 | use Illuminate\Support\Facades\DB; | 17 | use Illuminate\Support\Facades\DB; |
| 17 | 18 | ||
| 18 | class RenewLogic extends BaseLogic | 19 | class RenewLogic extends BaseLogic |
| @@ -77,13 +78,10 @@ class RenewLogic extends BaseLogic | @@ -77,13 +78,10 @@ class RenewLogic extends BaseLogic | ||
| 77 | } | 78 | } |
| 78 | DB::beginTransaction(); | 79 | DB::beginTransaction(); |
| 79 | try { | 80 | try { |
| 80 | - $this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id']],['id'=>$this->param['renew_id']]); | ||
| 81 | - $project = new Project(); | ||
| 82 | - $project->edit(['extend_type'=>0],['id'=>$this->param['id']]); | ||
| 83 | - $deployBuild = new DeployBuild(); | ||
| 84 | - $deployBuild->edit( | ||
| 85 | - ['service_duration'=>DB::raw('service_duration + ' . $info['service_duration']), | ||
| 86 | - 'plan'=>$info['plan']], ['project_id'=>$this->param['id']]); | 81 | + $this->model->edit(['project_id'=>$this->param['id'],'operator_id'=>$this->manager['id'],'status'=>1],['id'=>$this->param['renew_id']]); |
| 82 | + $this->saveLog($this->param['renew_id'],$this->param['service_duration'],$this->param['plan'],$info['amount'],$info['api_no'],$this->param['id']); | ||
| 83 | + $this->updateProject($this->param['id']); | ||
| 84 | + $this->updateProjectBuild($this->param['id'],$this->param['service_duration'],$this->param['plan']); | ||
| 87 | DB::commit(); | 85 | DB::commit(); |
| 88 | }catch (\Exception $e){ | 86 | }catch (\Exception $e){ |
| 89 | DB::rollBack(); | 87 | DB::rollBack(); |
| @@ -106,4 +104,62 @@ class RenewLogic extends BaseLogic | @@ -106,4 +104,62 @@ class RenewLogic extends BaseLogic | ||
| 106 | } | 104 | } |
| 107 | return $this->success(); | 105 | return $this->success(); |
| 108 | } | 106 | } |
| 107 | + | ||
| 108 | + /** | ||
| 109 | + * @remark :关联续费单生成一条日志 | ||
| 110 | + * @name :saveLog | ||
| 111 | + * @author :lyh | ||
| 112 | + * @method :post | ||
| 113 | + * @time :2023/9/27 16:29 | ||
| 114 | + */ | ||
| 115 | + public function saveLog($renew_id,$service_duration,$plan,$amount,$api_no,$project_id){ | ||
| 116 | + $data = [ | ||
| 117 | + 'renew_id'=>$renew_id, | ||
| 118 | + 'service_duration'=>$service_duration, | ||
| 119 | + 'plan'=>$plan, | ||
| 120 | + 'amount'=>$amount, | ||
| 121 | + 'api_no'=>$api_no, | ||
| 122 | + 'project_id'=>$project_id, | ||
| 123 | + 'operator_id'=>$this->manager['id'] | ||
| 124 | + ]; | ||
| 125 | + $renewLogModel = new RenewLog(); | ||
| 126 | + return $renewLogModel->add($data); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + /** | ||
| 130 | + * @remark :更新项目部署信息 | ||
| 131 | + * @name :updateProjectBuild | ||
| 132 | + * @author :lyh | ||
| 133 | + * @method :post | ||
| 134 | + * @time :2023/9/27 16:32 | ||
| 135 | + */ | ||
| 136 | + public function updateProjectBuild($id,$service_duration,$plan){ | ||
| 137 | + $deployBuild = new DeployBuild(); | ||
| 138 | + return $deployBuild->edit( | ||
| 139 | + [ | ||
| 140 | + 'service_duration'=>DB::raw('service_duration + ' . $service_duration), | ||
| 141 | + 'plan'=>$plan | ||
| 142 | + ], | ||
| 143 | + [ | ||
| 144 | + 'project_id'=>$id | ||
| 145 | + ]); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * @remark :更新项目 | ||
| 150 | + * @name :updateProject | ||
| 151 | + * @author :lyh | ||
| 152 | + * @method :post | ||
| 153 | + * @time :2023/9/27 16:35 | ||
| 154 | + */ | ||
| 155 | + public function updateProject($id,$type){ | ||
| 156 | + $project = new Project(); | ||
| 157 | + return $project->edit([ | ||
| 158 | + 'extend_type'=>0, | ||
| 159 | + 'type'=>$type | ||
| 160 | + ],[ | ||
| 161 | + 'id'=>$id | ||
| 162 | + ]); | ||
| 163 | + } | ||
| 164 | + | ||
| 109 | } | 165 | } |
app/Models/Project/RenewLog.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :RenewLog.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2023/9/27 16:39 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Models\Project; | ||
| 11 | + | ||
| 12 | +use App\Models\Base; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @remark :续费记录单日志 | ||
| 16 | + * @name :RenewLog | ||
| 17 | + * @author :lyh | ||
| 18 | + * @method :post | ||
| 19 | + * @time :2023/9/27 16:40 | ||
| 20 | + */ | ||
| 21 | +class RenewLog extends Base | ||
| 22 | +{ | ||
| 23 | + protected $table = 'gl_project_renew_log'; | ||
| 24 | +} |
-
请 注册 或 登录 后发表评论