正在显示
1 个修改的文件
包含
16 行增加
和
20 行删除
| @@ -56,16 +56,16 @@ class ProductLogic extends BaseLogic | @@ -56,16 +56,16 @@ class ProductLogic extends BaseLogic | ||
| 56 | DB::connection('custom_mysql')->beginTransaction(); | 56 | DB::connection('custom_mysql')->beginTransaction(); |
| 57 | try { | 57 | try { |
| 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ | 58 | if(isset($this->param['id']) && !empty($this->param['id'])){ |
| 59 | - $id = $this->param['id']; | 59 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); |
| 60 | //查看路由是否更新 | 60 | //查看路由是否更新 |
| 61 | - $this->param['route'] = $this->editProductRoute($this->param['route']); | 61 | + $this->editProductRoute($this->param['route']); |
| 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); | 62 | $this->model->edit($this->param,['id'=>$this->param['id']]); |
| 63 | }else{ | 63 | }else{ |
| 64 | $this->param = $this->addHandleParam($this->param); | 64 | $this->param = $this->addHandleParam($this->param); |
| 65 | $id = $this->model->addReturnId($this->param); | 65 | $id = $this->model->addReturnId($this->param); |
| 66 | + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 67 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 66 | } | 68 | } |
| 67 | - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 68 | - $this->model->edit(['route'=> $this->param['route']],['id'=>$id]); | ||
| 69 | //产品分类关联 | 69 | //产品分类关联 |
| 70 | CategoryRelated::saveRelated($id, $category_ids); | 70 | CategoryRelated::saveRelated($id, $category_ids); |
| 71 | //保存扩展字段 | 71 | //保存扩展字段 |
| @@ -75,8 +75,6 @@ class ProductLogic extends BaseLogic | @@ -75,8 +75,6 @@ class ProductLogic extends BaseLogic | ||
| 75 | DB::connection('custom_mysql')->rollBack(); | 75 | DB::connection('custom_mysql')->rollBack(); |
| 76 | $this->fail('系统错误请联系管理员'); | 76 | $this->fail('系统错误请联系管理员'); |
| 77 | } | 77 | } |
| 78 | - //通知更新 | ||
| 79 | - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]); | ||
| 80 | return $this->success(); | 78 | return $this->success(); |
| 81 | } | 79 | } |
| 82 | 80 | ||
| @@ -154,10 +152,15 @@ class ProductLogic extends BaseLogic | @@ -154,10 +152,15 @@ class ProductLogic extends BaseLogic | ||
| 154 | }else{ | 152 | }else{ |
| 155 | $this->param['thumb'] = Arr::a2s([]); | 153 | $this->param['thumb'] = Arr::a2s([]); |
| 156 | } | 154 | } |
| 157 | - if(isset($this->param['route']) && !empty($this->param['route'])){ | ||
| 158 | - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | 155 | + try { |
| 156 | + if(isset($this->param['route']) && !empty($this->param['route'])){ | ||
| 157 | + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); | ||
| 158 | + $this->editProductRoute($this->param['route']); | ||
| 159 | + } | ||
| 160 | + $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 161 | + }catch (\Exception $e){ | ||
| 162 | + $this->fail('系统错误,请连续管理员');; | ||
| 159 | } | 163 | } |
| 160 | - $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 161 | return $this->success(); | 164 | return $this->success(); |
| 162 | } | 165 | } |
| 163 | 166 | ||
| @@ -288,12 +291,8 @@ class ProductLogic extends BaseLogic | @@ -288,12 +291,8 @@ class ProductLogic extends BaseLogic | ||
| 288 | public function editProductRoute($route){ | 291 | public function editProductRoute($route){ |
| 289 | $info = $this->model->read(['id'=>$this->param['id']]); | 292 | $info = $this->model->read(['id'=>$this->param['id']]); |
| 290 | if($info['route'] != $route){ | 293 | if($info['route'] != $route){ |
| 291 | - //生成一条删除路由记录 | ||
| 292 | - $data = [ | ||
| 293 | - 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 294 | - 'route'=>$route, | ||
| 295 | - ]; | ||
| 296 | - $this->setRouteDeleteSave($data); | 294 | + //通知更新 |
| 295 | + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]); | ||
| 297 | } | 296 | } |
| 298 | return $route; | 297 | return $route; |
| 299 | } | 298 | } |
| @@ -340,11 +339,8 @@ class ProductLogic extends BaseLogic | @@ -340,11 +339,8 @@ class ProductLogic extends BaseLogic | ||
| 340 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | 339 | RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); |
| 341 | //生成一条删除路由记录 | 340 | //生成一条删除路由记录 |
| 342 | $info = $this->model->read(['id'=>$id],['id','route']); | 341 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 343 | - $data = [ | ||
| 344 | - 'source'=>RouteMap::SOURCE_PRODUCT, | ||
| 345 | - 'route'=>$info['route'], | ||
| 346 | - ]; | ||
| 347 | - $this->setRouteDeleteSave($data); | 342 | + //通知更新 |
| 343 | + $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]); | ||
| 348 | return $this->success(); | 344 | return $this->success(); |
| 349 | } | 345 | } |
| 350 | 346 |
-
请 注册 或 登录 后发表评论