作者 lyh

更新产品扩展字段

@@ -67,7 +67,7 @@ class ProductLogic extends BaseLogic @@ -67,7 +67,7 @@ class ProductLogic extends BaseLogic
67 //产品分类关联 67 //产品分类关联
68 CategoryRelated::saveRelated($id, $category_ids); 68 CategoryRelated::saveRelated($id, $category_ids);
69 //保存扩展字段 69 //保存扩展字段
70 - $this->saveExtendInfo($this->user['project_id'],$extend); 70 + $this->saveExtendInfo($id,$extend);
71 DB::connection('custom_mysql')->commit(); 71 DB::connection('custom_mysql')->commit();
72 }catch (\Exception $e){ 72 }catch (\Exception $e){
73 DB::connection('custom_mysql')->rollBack(); 73 DB::connection('custom_mysql')->rollBack();
@@ -99,10 +99,10 @@ class ProductLogic extends BaseLogic @@ -99,10 +99,10 @@ class ProductLogic extends BaseLogic
99 * @method :post 99 * @method :post
100 * @time :2023/11/9 15:02 100 * @time :2023/11/9 15:02
101 */ 101 */
102 - public function saveExtendInfo($project_id,$extend){ 102 + public function saveExtendInfo($product_id,$extend){
103 //先删除以前的数据 103 //先删除以前的数据
104 $extendInfoModel = new ExtendInfo(); 104 $extendInfoModel = new ExtendInfo();
105 - $extendInfoModel->del(['project_id'=>$project_id]); 105 + $extendInfoModel->del(['project_id'=>$this->user['project_id']]);
106 if(empty($extend)) { 106 if(empty($extend)) {
107 return $this->success(); 107 return $this->success();
108 } 108 }
@@ -119,7 +119,7 @@ class ProductLogic extends BaseLogic @@ -119,7 +119,7 @@ class ProductLogic extends BaseLogic
119 $v['values'] = json_encode($v['values']); 119 $v['values'] = json_encode($v['values']);
120 } 120 }
121 $v['project_id'] = $this->user['project_id']; 121 $v['project_id'] = $this->user['project_id'];
122 - $v['product_id'] = $project_id; 122 + $v['product_id'] = $product_id;
123 $extendInfoModel->add($v); 123 $extendInfoModel->add($v);
124 } 124 }
125 return $this->success(); 125 return $this->success();