作者 lyh

更新产品扩展字段

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