|
|
|
@ -71,7 +71,6 @@ class CouponRebateService implements CouponRebateServiceInterface |
|
|
|
|
|
|
|
$success = []; |
|
|
|
$fail = []; |
|
|
|
$isr = []; |
|
|
|
|
|
|
|
//读写锁,完全控制,性能低
|
|
|
|
$coupons = Coupon::whereIn('id', $ids)->lockForUpdate() |
|
|
|
@ -128,14 +127,14 @@ class CouponRebateService implements CouponRebateServiceInterface |
|
|
|
$couponReceive->send_user_id = $sendUserId; |
|
|
|
$couponReceive->phone = $phone; |
|
|
|
|
|
|
|
// if ( $couponReceive->save() && $coupon->save() ) {
|
|
|
|
// $success[] = $coupon;
|
|
|
|
// $receiveSsdb[] = $coupon->id;;
|
|
|
|
// }
|
|
|
|
if ( $couponReceive->save() && $coupon->save() ) { |
|
|
|
$success[] = $coupon; |
|
|
|
$receiveSsdb[] = $coupon->id;; |
|
|
|
} |
|
|
|
}else{ |
|
|
|
$fail[] = $coupon; |
|
|
|
$receiveSsdb[] = $coupon->id; |
|
|
|
$result['status'] = 2; |
|
|
|
$result['status'] = 3; |
|
|
|
$result['coupon_text'] = '您已领取!赶快去下单吧~'; |
|
|
|
|
|
|
|
$errorData['msg'] = '用户已经领取了优惠券'; |
|
|
|
|