作者 lyh

gx

@@ -70,8 +70,8 @@ class ProductLogic extends BaseLogic @@ -70,8 +70,8 @@ class ProductLogic extends BaseLogic
70 public function save($param){ 70 public function save($param){
71 //封面取第一个图片 71 //封面取第一个图片
72 $param['thumb'] = $param['gallery'][0] ?? ''; 72 $param['thumb'] = $param['gallery'][0] ?? '';
73 -// DB::beginTransaction();  
74 -// try { 73 + DB::beginTransaction();
  74 + try {
75 $data = $param; 75 $data = $param;
76 $data['created_uid'] = $this->user['id']; 76 $data['created_uid'] = $this->user['id'];
77 $res = parent::save($data); 77 $res = parent::save($data);
@@ -81,12 +81,12 @@ class ProductLogic extends BaseLogic @@ -81,12 +81,12 @@ class ProductLogic extends BaseLogic
81 KeywordRelated::saveRelated($res['id'], $data['keyword_id']); 81 KeywordRelated::saveRelated($res['id'], $data['keyword_id']);
82 //路由映射 82 //路由映射
83 $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $res['id'], $this->user['project_id']); 83 $route = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $res['id'], $this->user['project_id']);
84 -// DB::commit();  
85 -// }catch (\Exception $e){  
86 -// DB::rollBack();  
87 -// errorLog('产品保存失败', $param, $e);  
88 -// $this->fail('保存失败');  
89 -// } 84 + DB::commit();
  85 + }catch (\Exception $e){
  86 + DB::rollBack();
  87 + errorLog('产品保存失败', $param, $e);
  88 + $this->fail('保存失败');
  89 + }
90 //通知更新 90 //通知更新
91 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]); 91 $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$route]);
92 return $this->success(); 92 return $this->success();
@@ -25,7 +25,7 @@ class Product extends Base @@ -25,7 +25,7 @@ class Product extends Base
25 const STATUS_ON = 1; 25 const STATUS_ON = 1;
26 const STATUS_RECYCLE = 2; 26 const STATUS_RECYCLE = 2;
27 27
28 - protected $appends = ['route']; 28 +// protected $appends = ['route'];
29 29
30 public static function statusMap(){ 30 public static function statusMap(){
31 return [ 31 return [