Merge pull request 'fix(order): 修复下单时未检查商品状态导致的异常' (#382) from dev into main

Reviewed-on: #382
This commit is contained in:
mkm 2024-12-11 18:01:36 +08:00
commit 1e2c7b2d89

View File

@ -92,13 +92,13 @@ class OrderLogic extends BaseLogic
self::$fresh_price = 0; //生鲜金额
/** 计算价格 */
$off_activity = Config::where('name', 'off_activity')->value('value');
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
$field = 'id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose,is_show';
foreach ($cart_select as $k => $v) {
if($source==0){
$source=$v['source'];
}
if ($source == 2) {
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose';
$field = 'product_id,product_id id,store_name,image,unit,price,vip_price,cost,purchase,cate_id,store_info,rose,status';
$find = StoreBranchProduct::where(['product_id' => $v['product_id'], 'store_id' => $params['store_id']])->field($field)->find();
if($find && $find['status']==0){
throw new BusinessException('订单存在下架商品请更换后下单');