| | |
| | | |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.account.api.model.UserSignRecord; |
| | | import com.ruoyi.account.dto.SignBackRDto; |
| | | import com.ruoyi.account.service.AppUserService; |
| | | import com.ruoyi.account.service.UserSignRecordService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.api.feignClient.PointSettingClient; |
| | | import com.ruoyi.other.api.feignClient.SystemConfigClient; |
| | | import com.ruoyi.other.api.feignClient.VipGoodClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | @Resource |
| | | private UserSignRecordService userSignRecordService; |
| | | @Resource |
| | | private AppUserService appUserService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private PointSettingClient pointSettingClient; |
| | | @Resource |
| | | private SystemConfigClient systemConfigClient; |
| | | @ResponseBody |
| | | @GetMapping("/sign") |
| | | @ApiOperation(value = "签到", tags = {"小程序-签到"}) |
| | | public R<AppUser> change(){ |
| | | public R<SignBackRDto> sign(){ |
| | | Long userId1 = tokenService.getLoginUserApplet().getUserid(); |
| | | AppUser byId = appUserService.getById(userId1); |
| | | //获取当前用户的会员信息 |
| | | R<PointSetting> pointSetting = pointSettingClient.getPointSetting(byId.getVipId()); |
| | | UserSignRecord userSignRecord = new UserSignRecord(); |
| | | userSignRecord.setAppUserId(userId1); |
| | | userSignRecord.setCreateTime(LocalDateTime.now()); |
| | | userSignRecord.setRedAmount(new BigDecimal(0)); |
| | | if (pointSetting.getData() != null) { |
| | | userSignRecord.setPoint(pointSetting.getData().getSignPoint()); |
| | | }else { |
| | | userSignRecord.setPoint(0); |
| | | } |
| | | R<BigDecimal> bigDecimalR = systemConfigClient.redPackegeSet(); |
| | | userSignRecord.setRedAmount(bigDecimalR.getData()); |
| | | userSignRecord.setSignDay(LocalDate.now()); |
| | | return R.ok(); |
| | | |
| | | SignBackRDto signBackRDto = new SignBackRDto(); |
| | | signBackRDto.setPoint(userSignRecord.getPoint()); |
| | | signBackRDto.setRedAmount(userSignRecord.getRedAmount()); |
| | | userSignRecordService.save(userSignRecord); |
| | | return R.ok(signBackRDto); |
| | | } |
| | | |
| | | } |