作者 lyh

gx

@@ -38,8 +38,8 @@ class ProductLogic extends BaseLogic @@ -38,8 +38,8 @@ class ProductLogic extends BaseLogic
38 // $category_ids = $this->param['category_id'] ?? []; 38 // $category_ids = $this->param['category_id'] ?? [];
39 //参数处理 39 //参数处理
40 $this->param = $this->handleSaveParam($this->param); 40 $this->param = $this->handleSaveParam($this->param);
41 -// DB::connection('custom_mysql')->beginTransaction();  
42 -// try { 41 + DB::connection('custom_mysql')->beginTransaction();
  42 + try {
43 if(isset($this->param['id']) && !empty($this->param['id'])){ 43 if(isset($this->param['id']) && !empty($this->param['id'])){
44 //查看路由是否更新 44 //查看路由是否更新
45 $id = $this->editProductRoute($this->param['id'],$this->param['route']); 45 $id = $this->editProductRoute($this->param['id'],$this->param['route']);
@@ -55,11 +55,11 @@ class ProductLogic extends BaseLogic @@ -55,11 +55,11 @@ class ProductLogic extends BaseLogic
55 $this->model->edit(['route'=>$route],['id'=>$id]); 55 $this->model->edit(['route'=>$route],['id'=>$id]);
56 //产品分类关联 56 //产品分类关联
57 // CategoryRelated::saveRelated($id, $category_ids); 57 // CategoryRelated::saveRelated($id, $category_ids);
58 -// DB::connection('custom_mysql')->commit();  
59 -// }catch (\Exception $e){  
60 -// DB::connection('custom_mysql')->rollBack();  
61 -// $this->fail('系统错误请联系管理员');  
62 -// } 58 + DB::connection('custom_mysql')->commit();
  59 + }catch (\Exception $e){
  60 + DB::connection('custom_mysql')->rollBack();
  61 + $this->fail('系统错误请联系管理员');
  62 + }
63 //通知更新 63 //通知更新
64 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); 64 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]);
65 return $this->success(); 65 return $this->success();
@@ -85,7 +85,6 @@ class ProductLogic extends BaseLogic @@ -85,7 +85,6 @@ class ProductLogic extends BaseLogic
85 $param['attrs'] = Arr::a2s($param['attrs'] ?? ''); 85 $param['attrs'] = Arr::a2s($param['attrs'] ?? '');
86 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? ''); 86 $param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
87 if(isset($param['category_id']) && !empty($param['category_id'])){ 87 if(isset($param['category_id']) && !empty($param['category_id'])){
88 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($param['category_id'], true) . PHP_EOL, FILE_APPEND);  
89 $param['category_id'] = $this->getLastCategory($param['category_id']); 88 $param['category_id'] = $this->getLastCategory($param['category_id']);
90 } 89 }
91 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ 90 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){