| | |
| | | package com.ruoyi.user.controller; |
| | | |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.admin.api.entity.*; |
| | | import com.ruoyi.admin.api.feignClient.AdminClient; |
| | |
| | | // 手机验证码校验获取缓存验证码 |
| | | Object phoneCodeRedis = redisService.getCacheObject(RedisConstants.USER_LOGIN_PHONE_CODE + phone); |
| | | if (null == phoneCodeRedis) { |
| | | return R.errorCode("登录失败,验证码已过期!"); |
| | | return R.errorCode("验证码错误!"); |
| | | } else { |
| | | // redis 验证码的value 为 code:时间戳 |
| | | String rCodeAndTime = String.valueOf(phoneCodeRedis); |
| | | String rCode = rCodeAndTime.split(":")[0]; |
| | | if (!rCode.equalsIgnoreCase(phoneCode)) { |
| | | return R.errorCode("登录失败,验证码无效!"); |
| | | return R.errorCode("验证码错误!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | } else { |
| | | user = new User(); |
| | | // 随机编号 |
| | | user.setUserNo(String.format(Constants.USER_NO_PRE, StringUtils.getCharAndNum(Constants.SIX))); |
| | | user.setUserNo(String.format(Constants.USER_NO_PRE, RandomUtil.randomNumbers(Constants.EIGHT))); |
| | | user.setState(Constants.ONE); |
| | | user.setNickname(phone); |
| | | user.setNickname(String.format(Constants.USER_NO_PRE, StringUtils.getCharAndNum(Constants.SIX))); |
| | | user.setPhone(phone); |
| | | user.setCity(loginPhoneRequest.getCity()); |
| | | user.setOpenId(loginPhoneRequest.getOpenId()); |
| | |
| | | if (!Constants.ZERO.equals(type) && !Constants.ONE.equals(type)) { |
| | | throw new GlobalException("获取类型异常!"); |
| | | } |
| | | return R.ok(adminClient.dataInfo(type).getData()); |
| | | R<Agreement> r = adminClient.agreementPolicy(type); |
| | | if (500 == r.getCode()) { |
| | | return R.fail(r.getMsg()); |
| | | } |
| | | return R.ok(r.getData()); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "轮播图列表", tags = {"用户端-首页"}) |
| | | @GetMapping(value = "/banner") |
| | | public R<List<Rotate>> banner() { |
| | | List<Rotate> data = adminClient.bannerList().getData(); |
| | | R<List<Rotate>> r = adminClient.bannerList(); |
| | | List<Rotate> data = r.getData(); |
| | | if (null == data) { |
| | | return R.fail(r.getMsg()); |
| | | } |
| | | for (Rotate datum : data) { |
| | | RecoveryServe recoveryServe = recoveryServeService.lambdaQuery() |
| | | .eq(RecoveryServe::getId, datum.getId()) |
| | | .eq(RecoveryServe::getIsDelete, 0).one(); |
| | | .eq(RecoveryServe::getId, datum.getRotateServeId()).one(); |
| | | if (null != recoveryServe) { |
| | | Integer classifyId = recoveryServe.getClassifyId(); |
| | | RecoveryClassify classify = recoveryClassifyService.lambdaQuery() |
| | | .eq(RecoveryClassify::getId, classifyId) |
| | | .eq(RecoveryClassify::getIsDelete, 0).one(); |
| | | .eq(RecoveryClassify::getId, classifyId).one(); |
| | | if (null != classify) { |
| | | String supClassify = classify.getSupClassify(); |
| | | if (Constants.RECOVERY.equals(supClassify)) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | |