文件:crmeb/app/services/order/StoreOrderRefundServices.php
方法:public function payOrderRefund(int $type, $order, array $refundData)
這個退款優(yōu)惠券有問題,場景復現(xiàn):
1、多個優(yōu)惠券商品(商品1、商品2、商品3)綁定的是同一個優(yōu)惠券(券1)信息;
2、同一個用戶:商品1、商品2、商品3都有下單,這是訂單1、訂單2、訂單3 的 virtual_info 的優(yōu)惠券id都是券1,并且都是未使用狀態(tài);
3、若是此時只有訂單1發(fā)起退款操作,看代碼邏輯是不是也會把 訂單2、訂單3 的券刪除?
//虛擬商品優(yōu)惠券退款處理
if ($order['virtual_type'] == 2) {
/** @var StoreCouponUserServices $couponUser */
$couponUser = app()->make(StoreCouponUserServices::class);
$res = $couponUser->delUserCoupon(['cid' => $order['virtual_info'], 'uid' => $order['uid'], 'status' => 0]);
if (!$res) throw new AdminException(400493);
/** @var StoreCouponIssueUserServices $couponIssueUser */
$couponIssueUser = app()->make(StoreCouponIssueUserServices::class);
$couponIssueUser->delIssueUserCoupon(['issue_coupon_id' => $order['virtual_info'], 'uid' => $order['uid']]);
}