正在显示
1 个修改的文件
包含
8 行增加
和
4 行删除
| @@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic; | @@ -6,6 +6,7 @@ use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | use App\Models\Project\Country; | 6 | use App\Models\Project\Country; |
| 7 | use App\Models\WebSetting\Proofreading; | 7 | use App\Models\WebSetting\Proofreading; |
| 8 | use App\Models\WebSetting\WebSettingCountry; | 8 | use App\Models\WebSetting\WebSettingCountry; |
| 9 | +use Illuminate\Support\Facades\DB; | ||
| 9 | 10 | ||
| 10 | class ProofreadingLogic extends BaseLogic | 11 | class ProofreadingLogic extends BaseLogic |
| 11 | { | 12 | { |
| @@ -35,7 +36,8 @@ class ProofreadingLogic extends BaseLogic | @@ -35,7 +36,8 @@ class ProofreadingLogic extends BaseLogic | ||
| 35 | * @time :2023/6/12 11:03 | 36 | * @time :2023/6/12 11:03 |
| 36 | */ | 37 | */ |
| 37 | public function proofreadingSave(){ | 38 | public function proofreadingSave(){ |
| 38 | -// try { | 39 | + DB::beginTransaction(); |
| 40 | + try { | ||
| 39 | //删除以前的数据 | 41 | //删除以前的数据 |
| 40 | $this->model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); | 42 | $this->model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]); |
| 41 | foreach ($this->param['data'] as $k => $v){ | 43 | foreach ($this->param['data'] as $k => $v){ |
| @@ -48,9 +50,11 @@ class ProofreadingLogic extends BaseLogic | @@ -48,9 +50,11 @@ class ProofreadingLogic extends BaseLogic | ||
| 48 | } | 50 | } |
| 49 | //新增 | 51 | //新增 |
| 50 | $this->model->insert($this->param['data']); | 52 | $this->model->insert($this->param['data']); |
| 51 | -// }catch (\Exception $e){ | ||
| 52 | -// $this->fail('error'); | ||
| 53 | -// } | 53 | + DB::commit(); |
| 54 | + }catch (\Exception $e){ | ||
| 55 | + DB::rollBack(); | ||
| 56 | + $this->fail('error'); | ||
| 57 | + } | ||
| 54 | return $this->success(); | 58 | return $this->success(); |
| 55 | } | 59 | } |
| 56 | 60 |
-
请 注册 或 登录 后发表评论