feat: 修改了商品管理的逻辑,优化了商品更新流程,增加了对商品分类的更新操作。
This commit is contained in:
parent
65ecfcdcde
commit
26f3117e89
@ -109,7 +109,6 @@ class StoreProductLogic extends BaseLogic
|
|||||||
if ($item['pid'] == 0 && in_array($item['count'], [0, 1])) {
|
if ($item['pid'] == 0 && in_array($item['count'], [0, 1])) {
|
||||||
StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]);
|
StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +157,10 @@ class StoreProductLogic extends BaseLogic
|
|||||||
StoreProduct::where('id', $params['id'])->update($data);
|
StoreProduct::where('id', $params['id'])->update($data);
|
||||||
$old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id')
|
$old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id')
|
||||||
->select();
|
->select();
|
||||||
|
StoreBranchProduct::where('product_id', $params['id'])
|
||||||
|
->update([
|
||||||
|
'batch' => $params['batch'], 'price' => $params['price'], 'vip_price' => $params['vip_price'], 'cost' => $params['purchase'], 'store_name' => $params['store_name'], 'image' => $params['image'], 'bar_code' => $params['bar_code']
|
||||||
|
]);
|
||||||
// 获取分类ID
|
// 获取分类ID
|
||||||
foreach ($old_cate as $vv) {
|
foreach ($old_cate as $vv) {
|
||||||
$related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select();
|
$related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user