正在显示
1 个修改的文件
包含
7 行增加
和
0 行删除
| @@ -144,6 +144,8 @@ class KeywordLogic extends BaseLogic | @@ -144,6 +144,8 @@ class KeywordLogic extends BaseLogic | ||
| 144 | if($num > 1000){ | 144 | if($num > 1000){ |
| 145 | $this->fail('最大数量不能超过1000'); | 145 | $this->fail('最大数量不能超过1000'); |
| 146 | } | 146 | } |
| 147 | + DB::connection('custom_mysql')->beginTransaction(); | ||
| 148 | + try { | ||
| 147 | foreach ($this->param['title'] as $k=>$v) { | 149 | foreach ($this->param['title'] as $k=>$v) { |
| 148 | $data = []; | 150 | $data = []; |
| 149 | if (empty($v)) { | 151 | if (empty($v)) { |
| @@ -168,6 +170,11 @@ class KeywordLogic extends BaseLogic | @@ -168,6 +170,11 @@ class KeywordLogic extends BaseLogic | ||
| 168 | } | 170 | } |
| 169 | $this->model->edit(['route' => $route], ['id' => $ids]); | 171 | $this->model->edit(['route' => $route], ['id' => $ids]); |
| 170 | } | 172 | } |
| 173 | + DB::connection('custom_mysql')->commit(); | ||
| 174 | + }catch (\Exception $e){ | ||
| 175 | + DB::connection('custom_mysql')->rollBack(); | ||
| 176 | + } | ||
| 177 | + | ||
| 171 | return $this->success(); | 178 | return $this->success(); |
| 172 | } | 179 | } |
| 173 | 180 |
-
请 注册 或 登录 后发表评论