兼容已经删除的创建相关

This commit is contained in:
liu 2024-06-15 11:36:34 +08:00
parent e960f06837
commit 5e5cc45490

View File

@ -71,7 +71,7 @@ class OrderLogic extends BaseLogic
/** 计算价格 */
foreach ($cart_select as $k => $v) {
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->find();
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field('id branch_product_id,store_name,image,unit,price,vip_price,cost,product_id')->withTrashed()->find();
if (!$find) {
continue;
}
@ -200,7 +200,7 @@ class OrderLogic extends BaseLogic
$goods_list[$k]['uid'] = request()->userId;
$goods_list[$k]['cart_id'] = implode(',', $cartId);
$goods_list[$k]['delivery_id'] = $params['store_id']; //商家id
$StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->find();
$StoreBranchProduct = StoreBranchProduct::where('id',$v['branch_product_id'])->withTrashed()->find();
$updateData[] = [
'id' => $v['branch_product_id'],
'stock' => $StoreBranchProduct['stock']-$v['cart_num'],