|
@@ -374,9 +374,13 @@ class StoreCouponIssueServices extends BaseServices
|
|
|
$issueUserService = app()->make(StoreCouponIssueUserServices::class);
|
|
$issueUserService = app()->make(StoreCouponIssueUserServices::class);
|
|
|
/** @var StoreCouponUserServices $couponUserService */
|
|
/** @var StoreCouponUserServices $couponUserService */
|
|
|
$couponUserService = app()->make(StoreCouponUserServices::class);
|
|
$couponUserService = app()->make(StoreCouponUserServices::class);
|
|
|
- $this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
|
|
|
|
|
|
|
+ $this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo, $is_receive) {
|
|
|
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
|
|
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
|
|
|
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
|
|
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
|
|
|
|
|
+ if ($issueCouponInfo['total_count'] > 0 && $is_receive) {
|
|
|
|
|
+ $issueCouponInfo['remain_count'] -= 1;
|
|
|
|
|
+ $issueCouponInfo->save();
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|