feat: 修改了商品管理的逻辑,优化了商品更新流程,增加了对商品分类的更新操作。

This commit is contained in:
mkm 2024-06-17 14:28:17 +08:00
parent 65ecfcdcde
commit 26f3117e89

View File

@ -109,7 +109,6 @@ class StoreProductLogic extends BaseLogic
if ($item['pid'] == 0 && in_array($item['count'], [0, 1])) {
StoreProductCate::where('id', $item['id'])->update(['delete_time' => time()]);
}
}
}
@ -158,7 +157,10 @@ class StoreProductLogic extends BaseLogic
StoreProduct::where('id', $params['id'])->update($data);
$old_cate = StoreBranchProduct::where('product_id', $params['id'])->field('cate_id,store_id')
->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
foreach ($old_cate as $vv) {
$related_data = Db::name('store_product_cate')->where('cate_id', $vv['cate_id'])->select();