| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | //已签到日期 |
| | | @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/has/sign") |
| | | public R<List<TAppUserSign>> hasSign() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | DateTime startOfMonth = DateUtil.beginOfMonth(new Date()); |
| | | DateTime endOfMonth = DateUtil.endOfMonth(new Date()); |
| | | // 获取用户的所有签到记录 |
| | | List<TAppUserSign> signRecords = signService.lambdaQuery() |
| | | .between(TAppUserSign::getSignDay, startOfMonth, endOfMonth) |
| | | .eq(TAppUserSign::getAppUserId, userId) |
| | | .orderByDesc(TAppUserSign::getSignDay) |
| | | .list(); |
| | | return R.ok(signRecords); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //已连续签到多少天 |
| | | |
| | | @ApiOperation(value = "本月已连续签到天数", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/continue/sign") |
| | | public R continueSign() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | int days = signDayUtil.calculateContinuousSignDays(userId); |
| | | return R.ok(days); |
| | | } |
| | | |
| | | |
| | | |
| | | //积分变化记录用 |