调整优惠券余额扣除

This commit is contained in:
luofei 2024-02-23 15:57:11 +08:00
parent b87c5a9f79
commit 9bf5deef2c
2 changed files with 16 additions and 1 deletions

View File

@ -266,4 +266,19 @@ class StoreCouponUserDao extends BaseDao
return $rate;
}
/**
* 批量扣除优惠券余额
* @param $coupons
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function reduceAll($coupons)
{
foreach ($coupons as $coupon) {
$this->reduce($coupon['coupon_user_id'], $coupon['coupon_price']);
}
}
}

View File

@ -1191,7 +1191,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
}
}
if (!empty($useCoupon[$order['mer_id']])) {
$storeCouponUserDao->reduceAll($order['cartInfo']['order']['store_coupon']);
$storeCouponUserDao->reduceAll($order['cartInfo']['order']['user_used_coupon']);
}
}