|
|
@ -117,6 +117,8 @@ public class ShopUserCouponController extends BaseController { |
|
|
|
@Operation(summary = "领取优惠券") |
|
|
|
@PostMapping("/take") |
|
|
|
public ApiResult<?> take(@RequestBody ShopUserCoupon userCoupon) { |
|
|
|
final User loginUser = getLoginUser(); |
|
|
|
if (loginUser == null) return fail("请先登录"); |
|
|
|
ShopCoupon coupon = couponService.getByIdRel(userCoupon.getCouponId()); |
|
|
|
if (coupon.getTotalCount() != -1 && coupon.getReceiveNum() >= coupon.getTotalCount()) return fail("已经被领完了"); |
|
|
|
List<ShopUserCoupon> userCouponList = shopUserCouponService.list( |
|
|
|