修复:总平台商品编辑时 无法编辑星级推荐、商品推荐的问题
This commit is contained in:
parent
ef0f4c5d57
commit
ef9ea92df2
|
|
@ -259,6 +259,8 @@ class ProductRepository extends BaseRepository
|
|||
$product['price'] = $settleParams['data']['price'];
|
||||
$product['ot_price'] = $settleParams['data']['ot_price'];
|
||||
$product['mer_labels'] = $data['mer_labels'];
|
||||
$product['star'] = $data['star'] ?? 1;
|
||||
$product['rank'] = $data['rank'] ?? 0;
|
||||
app()->make(SpuRepository::class)->create($product, $result->product_id, $activity_id, $productType);
|
||||
}
|
||||
$product = $result;
|
||||
|
|
@ -297,6 +299,8 @@ class ProductRepository extends BaseRepository
|
|||
$spuData['price'] = $settleParams['data']['price'];
|
||||
$spuData['mer_id'] = $merId;
|
||||
$spuData['mer_labels'] = $data['mer_labels'];
|
||||
$spuData['star'] = $data['star'] ?? 1;
|
||||
$spuData['rank'] = $data['rank'] ?? 0;
|
||||
|
||||
Db::transaction(function () use ($id, $data, $productType, $settleParams,$content,$buyAgreement,$product,$spuData,$merId) {
|
||||
$this->save($id, $settleParams, $content, $product, $productType,$buyAgreement);
|
||||
|
|
@ -486,6 +490,10 @@ class ProductRepository extends BaseRepository
|
|||
'is_show' => $data['is_show'] ?? 0,
|
||||
'is_used' => (isset($data['status']) && $data['status'] == 1) ? 1 : 0,
|
||||
'is_good' => $data['is_good'] ?? 0,
|
||||
'is_benefit' => $data['is_benefit'] ?? 0,
|
||||
'is_hot' => $data['is_hot'] ?? 0,
|
||||
'is_best' => $data['is_best'] ?? 0,
|
||||
'is_new' => $data['is_new'] ?? 0,
|
||||
'video_link' => $data['video_link'] ?? '',
|
||||
'temp_id' => $data['delivery_free'] ? 0 : ($data['temp_id'] ?? 0),
|
||||
'extension_type' => $data['extension_type'] ?? 0,
|
||||
|
|
@ -522,18 +530,12 @@ class ProductRepository extends BaseRepository
|
|||
'batch_num' => $data['batch_num'] ?? 0,
|
||||
'batch_unit' => $data['batch_unit'] ?? '',
|
||||
];
|
||||
if (isset($data['extend']))
|
||||
$result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : '';
|
||||
if (isset($data['mer_id']))
|
||||
$result['mer_id'] = $data['mer_id'];
|
||||
if (isset($data['old_product_id']))
|
||||
$result['old_product_id'] = $data['old_product_id'];
|
||||
if (isset($data['product_type']))
|
||||
$result['product_type'] = $data['product_type'];
|
||||
if (isset($data['type']) && $data['type'])
|
||||
$result['type'] = $data['type'];
|
||||
if (isset($data['param_temp_id']))
|
||||
$result['param_temp_id'] = $data['param_temp_id'];
|
||||
if (isset($data['extend'])) $result['extend'] = $data['extend'] ? json_encode($data['extend'], JSON_UNESCAPED_UNICODE) : '';
|
||||
if (isset($data['mer_id'])) $result['mer_id'] = $data['mer_id'];
|
||||
if (isset($data['old_product_id'])) $result['old_product_id'] = $data['old_product_id'];
|
||||
if (isset($data['product_type'])) $result['product_type'] = $data['product_type'];
|
||||
if (isset($data['type']) && $data['type']) $result['type'] = $data['type'];
|
||||
if (isset($data['param_temp_id'])) $result['param_temp_id'] = $data['param_temp_id'];
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class SpuRepository extends BaseRepository
|
|||
'temp_id' => $param['temp_id'],
|
||||
'sort' => $param['sort'] ?? 0,
|
||||
'mer_labels' => $param['mer_labels'] ?? '',
|
||||
'star' => $param['star'] ?? 1,
|
||||
];
|
||||
if (isset($param['mer_id'])) $data['mer_id'] = $param['mer_id'];
|
||||
return $data;
|
||||
|
|
|
|||
|
|
@ -329,7 +329,8 @@ class StoreProduct extends BaseController
|
|||
|
||||
// 总平台添加商品
|
||||
public function create(){
|
||||
$params = $this->request->params($this->repository::CREATE_PARAMS);
|
||||
$fields = array_merge(['is_hot','is_best','is_benefit','is_new','store_name','content','rank','star'],$this->repository::CREATE_PARAMS);
|
||||
$params = $this->request->params($fields);
|
||||
$data = $this->repository->checkParams($params,$this->request->merId());
|
||||
$data['mer_id'] = $this->request->merId();
|
||||
$data['admin_id'] = $this->request->merAdminId();
|
||||
|
|
@ -338,11 +339,14 @@ class StoreProduct extends BaseController
|
|||
$data['mer_status'] = 1;
|
||||
$data['rate'] = 3;
|
||||
$this->repository->create($data,0);
|
||||
|
||||
return app('json')->success('添加成功');
|
||||
}
|
||||
// 总平台编辑总平台添加的商品
|
||||
public function edit($id){
|
||||
$params = $this->request->params($this->repository::CREATE_PARAMS);
|
||||
public function edit($id, validate $validate){
|
||||
$fields = array_merge(['is_hot','is_best','is_benefit','is_new','store_name','content','rank','star'],$this->repository::CREATE_PARAMS);
|
||||
// 执行商品编辑
|
||||
$params = $this->request->params($fields);
|
||||
$data = $this->repository->checkParams($params,$this->request->merId(), $id);
|
||||
if (!$this->repository->merExists($this->request->merId(), $id)) return app('json')->fail('数据不存在');
|
||||
$pro = $this->repository->getWhere(['product_id' => $id]);
|
||||
|
|
@ -351,6 +355,7 @@ class StoreProduct extends BaseController
|
|||
$data['mer_status'] = 1;
|
||||
$data['mer_id'] = $this->request->merId();
|
||||
$this->repository->edit($id, $data, $this->request->merId(), 0);
|
||||
|
||||
return app('json')->success('编辑成功');
|
||||
}
|
||||
// 总平台商品下架 / 上架
|
||||
|
|
|
|||
Loading…
Reference in New Issue