|
@@ -1346,15 +1346,17 @@ class WholeController extends Curd
|
|
|
$couponUseJson = [];
|
|
|
if (!empty($params['join_order_member_id']) && !empty($params['preferential'])) {
|
|
|
$couponResult = OrderService::payUseCoupon($params['join_order_member_id'], $params['goodsContentList'], $params['preferential'], $params['order_amount_total']);
|
|
|
- if ($couponResult['pay_amount'] != $params['order_amount_pay']) {
|
|
|
+ if (!empty($couponResult['pay_amount']) && $couponResult['pay_amount'] != $params['order_amount_pay']) {
|
|
|
throw new BusinessException("计算优惠后,实付金额错误!");
|
|
|
}
|
|
|
// 组装优惠券使用数据,存主表优惠里
|
|
|
- $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
- if (!empty($order->order_discount_json)) {
|
|
|
- $orderDiscountJson = json_decode($order->order_discount_json, true);
|
|
|
- if (!empty($orderDiscountJson)) {
|
|
|
- $couponUseJson = json_encode(array_merge($orderDiscountJson, json_decode($couponUseJson, true)));
|
|
|
+ if (!empty($couponResult['use_coupon_json'])) {
|
|
|
+ $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
+ if (!empty($order->order_discount_json)) {
|
|
|
+ $orderDiscountJson = json_decode($order->order_discount_json, true);
|
|
|
+ if (!empty($orderDiscountJson)) {
|
|
|
+ $couponUseJson = json_encode(array_merge($orderDiscountJson, json_decode($couponUseJson, true)));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1768,7 +1770,9 @@ class WholeController extends Curd
|
|
|
throw new BusinessException("计算优惠后,实付金额错误!");
|
|
|
}
|
|
|
// 组装优惠券使用数据,存主表优惠里
|
|
|
- $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
+ if (!empty($couponResult['use_coupon_json'])) {
|
|
|
+ $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
+ }
|
|
|
}
|
|
|
// 存储优惠信息
|
|
|
$params['order_discount_json'] = json_encode($this->discountRecord($couponUseJson, $params));
|
|
@@ -2344,11 +2348,13 @@ class WholeController extends Curd
|
|
|
$couponUseJson = [];
|
|
|
if (!empty($params['join_order_member_id']) && !empty($params['preferential'])) {
|
|
|
$couponResult = OrderService::payUseCoupon($params['join_order_member_id'], $params['goodsContentList'], $params['preferential'], $params['order_amount_total']);
|
|
|
- if ($couponResult['pay_amount'] != $params['order_amount_pay']) {
|
|
|
+ if (!empty($couponResult['pay_amount']) && $couponResult['pay_amount'] != $params['order_amount_pay']) {
|
|
|
throw new BusinessException("计算优惠后,实付金额错误!");
|
|
|
}
|
|
|
// 组装优惠券使用数据,存主表优惠里
|
|
|
- $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
+ if (!empty($couponResult['use_coupon_json'])) {
|
|
|
+ $couponUseJson = $couponResult['use_coupon_json'];
|
|
|
+ }
|
|
|
}
|
|
|
// 存储优惠信息
|
|
|
$params['order_discount_json'] = json_encode($this->discountRecord($couponUseJson, $params));
|