| | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.constant.CacheConstants; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.exception.ServiceException; |
| | | import com.xinquan.common.core.utils.WebUtils; |
| | | import com.xinquan.common.core.utils.page.BeanUtils; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.redis.service.RedisService; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.course.api.domain.Course; |
| | |
| | | private RemoteOrderService remoteOrderService; |
| | | @Resource |
| | | private RemoteUserService remoteUserService; |
| | | @GetMapping("/getUserByPhone/{phone}") |
| | | public R<AppUser> getUserByPhone(@PathVariable("phone")String phone) { |
| | | AppUser one = appUserService.lambdaQuery().eq(AppUser::getCellPhone, phone).ne(AppUser::getUserStatus, 3) |
| | | .one(); |
| | | return R.ok(one); |
| | | } |
| | | @GetMapping("/getAllUserList") |
| | | public R<List<AppUser>> getAllUserList() { |
| | | List<AppUser> list = appUserService.list(); |
| | |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | // 校验验证码 |
| | | if (!verifyCaptcha(phone, code, |
| | | CacheConstants.APP_CHANGE_PHONE_CODE_PREFIX)) { |
| | | throw new ServiceException("验证码不正确"); |
| | | } |
| | | AppUser byId = appUserService.getById(userId); |
| | | |
| | | byId.setCellPhone(phone); |
| | | boolean b = appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | private boolean verifyCaptcha(String cellPhone, String captcha, String keyPrefix) { |
| | | |
| | | if (com.xinquan.common.core.utils.StringUtils.isNotBlank(cellPhone) && com.xinquan.common.core.utils.StringUtils.isNotBlank(captcha)) { |
| | | String key = keyPrefix + cellPhone; |
| | | String code = redisService.getCacheObject(key); |
| | | // 万能验证码 |
| | | if (captcha.equals("123456") || (com.xinquan.common.core.utils.StringUtils.isNotBlank(code) && code.equals( |
| | | captcha))) { |
| | | redisService.deleteObject(key); |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | @PostMapping("/deleteUser") |
| | | @ApiOperation(value = "注销账号", tags = {"设置"}) |
| | |
| | | consecutiveDays++; |
| | | currentDate = currentDate.minusDays(1); |
| | | } |
| | | appUser.setContinuity(consecutiveDays); |
| | | appUser.setToday(consecutiveDays); |
| | | // 根据等级查询疗愈名称和图标 |
| | | UserLevelSetting data = remoteBannerService.getIconNameByLevel(level).getData(); |
| | |
| | | @PostMapping("/getUserByPhone") |
| | | @ApiOperation(value = "根据用户手机号查询用户信息") |
| | | public R<AppUserDetailVO> getCurrentUser(String phone) { |
| | | AppUser one = appUserService.lambdaQuery().eq(AppUser::getCellPhone, phone).one(); |
| | | AppUserDetailVO appUserDetailVO = new AppUserDetailVO(); |
| | | appUserDetailVO.setId(one.getId()); |
| | | appUserDetailVO.setCellPhone(one.getCellPhone()); |
| | | appUserDetailVO.setAvatar(one.getAvatar()); |
| | | appUserDetailVO.setNickname(one.getNickname()); |
| | | return R.ok(appUserDetailVO); |
| | | AppUser one = appUserService.lambdaQuery().eq(AppUser::getCellPhone, phone) |
| | | .ne(AppUser::getUserStatus,3).one(); |
| | | if (one!=null){ |
| | | AppUserDetailVO appUserDetailVO = new AppUserDetailVO(); |
| | | appUserDetailVO.setId(one.getId()); |
| | | appUserDetailVO.setCellPhone(one.getCellPhone()); |
| | | appUserDetailVO.setAvatar(one.getAvatar()); |
| | | appUserDetailVO.setNickname(one.getNickname()); |
| | | return R.ok(appUserDetailVO); |
| | | |
| | | }else { |
| | | return R.fail("未查询到账户信息"); |
| | | } |
| | | } |
| | | @PostMapping("/getUserBalance") |
| | | @ApiOperation(value = "查询当前用户余额") |