| | |
| | | import cn.hutool.crypto.asymmetric.SignAlgorithm; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.xcong.excoin.common.LoginUserUtils; |
| | | import com.xcong.excoin.common.annotations.SubmitRepeat; |
| | | import com.xcong.excoin.common.contants.AppContants; |
| | | import com.xcong.excoin.common.response.Result; |
| | | import com.xcong.excoin.common.system.bean.LoginUserBean; |
| | | import com.xcong.excoin.common.system.dto.LoginDto; |
| | | import com.xcong.excoin.common.system.dto.RegisterDto; |
| | | import com.xcong.excoin.common.system.vo.MemberInfoVo; |
| | | import com.xcong.excoin.configurations.properties.ApplicationProperties; |
| | | import com.xcong.excoin.configurations.properties.SecurityProperties; |
| | | import com.xcong.excoin.modules.member.entity.MemberEntity; |
| | | import com.xcong.excoin.modules.member.service.MemberService; |
| | | import com.xcong.excoin.utils.RedisUtils; |
| | | import io.swagger.annotations.Api; |
| | |
| | | redisUtils.set(redisToken, JSONObject.toJSONString(loginUserBean.getMemberEntity()), applicationProperties.getRedisExpire()); |
| | | redisUtils.set(redisMember, token); |
| | | Map<String, Object> authInfo = new HashMap<>(); |
| | | //获取返回的个人信息 |
| | | MemberInfoVo memberInfoVo = new MemberInfoVo(); |
| | | MemberEntity memberEntity = loginUserBean.getMemberEntity(); |
| | | memberInfoVo.setEmail(memberEntity.getEmail()); |
| | | memberInfoVo.setPhone(memberEntity.getPhone()); |
| | | memberInfoVo.setInviteId(memberEntity.getInviteId()); |
| | | memberInfoVo.setFingerprintState(memberEntity.getFingerprintState()); |
| | | // 开启debug模式,则将加密后的token返回 |
| | | if (applicationProperties.isDebug()) { |
| | | authInfo.put("token", token); |
| | | authInfo.put("rsaToken", AppContants.TOKEN_START_WITH + generateAsaToken(token)); |
| | | authInfo.put("user", loginUserBean); |
| | | authInfo.put("user", memberInfoVo); |
| | | } else { |
| | | authInfo.put("token", token); |
| | | authInfo.put("user", loginUserBean); |
| | | authInfo.put("user", memberInfoVo); |
| | | } |
| | | |
| | | authInfo.put("baseUrl", AppContants.BASE_URL_L2); |
| | | return Result.ok("success", authInfo); |
| | | } |
| | | |
| | |
| | | return rsa.encryptBase64(token + "_" + System.currentTimeMillis(), KeyType.PublicKey); |
| | | } |
| | | |
| | | @SubmitRepeat |
| | | @ApiOperation(value = "app注册接口", notes = "app注册接口,验证码必须输入可默认为123456") |
| | | @PostMapping(value = "/register") |
| | | public Result register(@RequestBody @Validated RegisterDto registerDto) { |