修改获取优惠卷时同一商品两个数量优惠卷选择问题
This commit is contained in:
parent
223ffb8fe3
commit
269856d09c
@ -124,6 +124,9 @@ class UserCouponService extends BaseService
|
||||
// 优惠卷最高金额
|
||||
$coupon_high_price = 0;
|
||||
|
||||
// 优惠卷最大数量
|
||||
$coupon_high_num = 0;
|
||||
|
||||
// 是否存在互斥卷
|
||||
$is_mutex = 0;
|
||||
|
||||
@ -201,15 +204,26 @@ class UserCouponService extends BaseService
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty($selected_coupon)) {
|
||||
if (empty($selected_coupons)) {
|
||||
$selected_coupons[] = $coupon; // 选中的优惠卷数据
|
||||
|
||||
// 满减/无门槛-最高价格
|
||||
if ($coupon['coupon_type'] == 1 || $coupon['coupon_type'] == 2){
|
||||
$coupon_high_price = $coupon['coupon_price'];
|
||||
}
|
||||
|
||||
// 数量
|
||||
if ($coupon['coupon_type'] == 3){
|
||||
$coupon_high_num = $coupon['min_usable_number'];
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// 处理存在互斥卷情况
|
||||
if ($is_mutex == 1) {
|
||||
// 满减/无门槛-最高价格
|
||||
if ($coupon['coupon_type'] == 1 || $coupon['coupon_type'] == 2){
|
||||
// 选择金额最高的为选中
|
||||
if ($coupon['coupon_price'] < $coupon_high_price){
|
||||
continue;
|
||||
@ -226,6 +240,25 @@ class UserCouponService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
// 数量
|
||||
if ($coupon['coupon_type'] == 3){
|
||||
// 选择金额最高的为选中
|
||||
if ($coupon['min_usable_number'] < $coupon_high_num){
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($coupon['min_usable_number'] > $coupon_high_num) {
|
||||
$coupon_high_num = $coupon['min_usable_number'];
|
||||
|
||||
// 选中的优惠卷数据置空
|
||||
$selected_coupons = array();
|
||||
$selected_coupons[] = $coupon;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$selected_coupons[] = $coupon; // 选中的优惠卷数据
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user