| | |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser byId = appUserService.getById(userid); |
| | | |
| | | CouponInfo data = couponClient.detail(couponId).getData(); |
| | | R<CouponInfo> detail = couponClient.detail(couponId); |
| | | CouponInfo data = detail.getData(); |
| | | //检验当前优惠券是否存在 |
| | | if (data==null){ |
| | | return R.fail("当前优惠券不存在,请刷新后重试"); |
| | |
| | | UserCoupon userCoupon = new UserCoupon(); |
| | | userCoupon.setAppUserId(userid); |
| | | if (data.getPeriodType()==1) { |
| | | userCoupon.setStartTime(data.getPeriodStartTime().atTime(0,0,0)); |
| | | userCoupon.setEndTime(data.getPeriodEndTime().atTime(0,0,0)); |
| | | userCoupon.setStartTime(data.getPeriodStartTime().atTime(0, 0, 0)); |
| | | userCoupon.setEndTime(data.getPeriodEndTime().atTime(23, 59, 59)); |
| | | }else { |
| | | userCoupon.setStartTime(now); |
| | | userCoupon.setEndTime(now.plusDays(data.getPeriodDays())); |