|
@@ -1312,8 +1312,8 @@ class WholeController extends Curd
|
|
|
|
|
|
if ($order->order_status_payment != 'SUCCESS') {
|
|
|
_syslog("订单", "支付异常,检查是否有轮询");
|
|
|
- // 恢复优惠券
|
|
|
- $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'ACTIVED');
|
|
|
+ // 恢复优惠券到已占用
|
|
|
+ $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'WAITING');
|
|
|
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|
|
@@ -1762,8 +1762,8 @@ class WholeController extends Curd
|
|
|
}
|
|
|
if ($order->order_status_payment != 'SUCCESS') {
|
|
|
_syslog("订单", "支付异常,检查是否有轮询");
|
|
|
- // 恢复优惠券
|
|
|
- $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'ACTIVED');
|
|
|
+ // 恢复优惠券到已占用
|
|
|
+ $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'WAITING');
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|
|
|
_syslog("订单", "订单支付成功");
|
|
@@ -2502,8 +2502,8 @@ class WholeController extends Curd
|
|
|
|
|
|
if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
|
|
|
_syslog("订单", "支付异常,检查是否有轮询");
|
|
|
- // 恢复优惠券
|
|
|
- $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'ACTIVED');
|
|
|
+ // 恢复优惠券到已占用
|
|
|
+ $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'WAITING');
|
|
|
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|
|
@@ -2542,10 +2542,12 @@ class WholeController extends Curd
|
|
|
foreach ($coupon as $key => $item) {
|
|
|
if (!empty($item['coupon_id']) && !empty($item['coupon_detail_id'])) {
|
|
|
foreach ($item['coupon_detail_id'] as $detailId) {
|
|
|
- CouponDetail::where('join_detail_coupon_id', $item['coupon_id'])
|
|
|
- ->where('coupon_detail_id', $detailId)
|
|
|
- ->where('coupon_detail_status','<>','USED')
|
|
|
- ->update($updateData);
|
|
|
+ if (substr($detailId, 0, 4) == 'CUDT') {
|
|
|
+ CouponDetail::where('join_detail_coupon_id', $item['coupon_id'])
|
|
|
+ ->where('coupon_detail_id', $detailId)
|
|
|
+ ->where('coupon_detail_status', 'WAITING')
|
|
|
+ ->update($updateData);
|
|
|
+ }
|
|
|
}
|
|
|
unset($coupon[$key]);
|
|
|
}
|
|
@@ -2568,7 +2570,7 @@ class WholeController extends Curd
|
|
|
{
|
|
|
if (!empty($coupon) && is_array($coupon)) {
|
|
|
$updateData['coupon_detail_status'] = $status;
|
|
|
- if ($status == 'ACTIVED') {
|
|
|
+ if ($status == 'ACTIVED' || $status == 'WAITING') {
|
|
|
$updateData['coupon_detail_used_datetime'] = '';
|
|
|
} elseif ($status == 'USED') {
|
|
|
$updateData['coupon_detail_used_datetime'] = date('Y-m-d H:i:s');
|
|
@@ -3049,8 +3051,8 @@ class WholeController extends Curd
|
|
|
|
|
|
if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
|
|
|
_syslog("订单", "支付异常,检查是否有轮询");
|
|
|
- // 恢复优惠券
|
|
|
- $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'ACTIVED');
|
|
|
+ // 恢复优惠券到已占用
|
|
|
+ $this->changeOrderCouponStatus(json_decode($couponUseJson, true), 'WAITING');
|
|
|
|
|
|
return json_throw(2001, '支付异常', ['order_id' => $params['orderId']]);
|
|
|
}
|