正在显示
1 个修改的文件
包含
34 行增加
和
26 行删除
| @@ -47,6 +47,7 @@ use App\Services\ProjectServer; | @@ -47,6 +47,7 @@ use App\Services\ProjectServer; | ||
| 47 | use App\Services\SyncService; | 47 | use App\Services\SyncService; |
| 48 | use App\Utils\LogUtils; | 48 | use App\Utils\LogUtils; |
| 49 | use Illuminate\Support\Facades\Cache; | 49 | use Illuminate\Support\Facades\Cache; |
| 50 | +use Illuminate\Support\Facades\DB; | ||
| 50 | use Illuminate\Support\Facades\Http; | 51 | use Illuminate\Support\Facades\Http; |
| 51 | 52 | ||
| 52 | /** | 53 | /** |
| @@ -144,32 +145,39 @@ class ProjectLogic extends BaseLogic | @@ -144,32 +145,39 @@ class ProjectLogic extends BaseLogic | ||
| 144 | * @time :2023/8/30 11:57 | 145 | * @time :2023/8/30 11:57 |
| 145 | */ | 146 | */ |
| 146 | public function projectSave(){ | 147 | public function projectSave(){ |
| 147 | - if($this->param['type'] == Project::TYPE_SEVEN){ | ||
| 148 | - //错误单直接返回,单独处理 | ||
| 149 | - $this->setTypeSevenEdit($this->param); | ||
| 150 | - }else{ | ||
| 151 | - //初始化项目 | ||
| 152 | - $this->createProjectData($this->param); | ||
| 153 | - //双向绑定服务器,需放到保存项目的上方 | ||
| 154 | - $this->setServers($this->param['serve_id'],$this->param['id']); | ||
| 155 | - //保存项目信息 | ||
| 156 | - $this->saveProject($this->param); | ||
| 157 | - //保存建站部署信息 | ||
| 158 | - $this->saveProjectDeployBuild($this->param['deploy_build']); | ||
| 159 | - //保存付费信息 | ||
| 160 | - $this->saveProjectPayment($this->param['payment']); | ||
| 161 | - //保存优化信息 | ||
| 162 | - $this->saveProjectDeployOptimize($this->param['deploy_optimize']); | ||
| 163 | - //保存项目关键字 | ||
| 164 | - $this->saveProjectKeyword($this->param['project_keyword'] ?? [],$this->param['id']); | ||
| 165 | - //保存售后信息 | ||
| 166 | - $this->saveProjectAfter($this->param['project_after']); | ||
| 167 | - //单独保存小语种配置 | ||
| 168 | - $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); | ||
| 169 | - //同步图片文件 | ||
| 170 | - $this->syncImageFile($this->param['project_location'],$this->param['id']); | ||
| 171 | - //同步信息表 | ||
| 172 | - (new SyncService())->projectAcceptAddress($this->param['id']); | 148 | + DB::beginTransaction(); |
| 149 | + try { | ||
| 150 | + if($this->param['type'] == Project::TYPE_SEVEN){ | ||
| 151 | + //错误单直接返回,单独处理 | ||
| 152 | + $this->setTypeSevenEdit($this->param); | ||
| 153 | + }else{ | ||
| 154 | + //初始化项目 | ||
| 155 | + $this->createProjectData($this->param); | ||
| 156 | + //双向绑定服务器,需放到保存项目的上方 | ||
| 157 | + $this->setServers($this->param['serve_id'],$this->param['id']); | ||
| 158 | + //保存项目信息 | ||
| 159 | + $this->saveProject($this->param); | ||
| 160 | + //保存建站部署信息 | ||
| 161 | + $this->saveProjectDeployBuild($this->param['deploy_build']); | ||
| 162 | + //保存付费信息 | ||
| 163 | + $this->saveProjectPayment($this->param['payment']); | ||
| 164 | + //保存优化信息 | ||
| 165 | + $this->saveProjectDeployOptimize($this->param['deploy_optimize']); | ||
| 166 | + //保存项目关键字 | ||
| 167 | + $this->saveProjectKeyword($this->param['project_keyword'] ?? [],$this->param['id']); | ||
| 168 | + //保存售后信息 | ||
| 169 | + $this->saveProjectAfter($this->param['project_after']); | ||
| 170 | + //单独保存小语种配置 | ||
| 171 | + $this->saveMinorLanguages($this->param['minor_languages'] ?? [],$this->param['id']); | ||
| 172 | + //同步图片文件 | ||
| 173 | + $this->syncImageFile($this->param['project_location'],$this->param['id']); | ||
| 174 | + //同步信息表 | ||
| 175 | + (new SyncService())->projectAcceptAddress($this->param['id']); | ||
| 176 | + } | ||
| 177 | + DB::commit(); | ||
| 178 | + }catch (\Exception $e){ | ||
| 179 | + DB::rollBack(); | ||
| 180 | + $this->fail('保存失败,请联系管理员'); | ||
| 173 | } | 181 | } |
| 174 | return $this->success(); | 182 | return $this->success(); |
| 175 | } | 183 | } |
-
请 注册 或 登录 后发表评论