From 1498b23be871aec99314da998569a94c9ab53607 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 29 Oct 2020 17:56:37 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/common/system/controller/LoginController.java | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java b/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java index e2bb955..12785f7 100644 --- a/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java +++ b/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java @@ -10,6 +10,7 @@ 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; @@ -17,7 +18,10 @@ import com.xcong.excoin.common.system.dto.RegisterDto; import com.xcong.excoin.configurations.properties.ApplicationProperties; import com.xcong.excoin.configurations.properties.SecurityProperties; +import com.xcong.excoin.modules.member.entity.MemberDeviceInfo; +import com.xcong.excoin.modules.member.service.MemberDeviceInfoService; import com.xcong.excoin.modules.member.service.MemberService; +import com.xcong.excoin.utils.HttpUtils; import com.xcong.excoin.utils.RedisUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -61,6 +65,9 @@ @Resource private RedisUtils redisUtils; + @Resource + private MemberDeviceInfoService memberDeviceInfoService; + @ApiOperation(value = "登陆接口", notes = "登陆接口") @PostMapping("/login") public Result login(@RequestBody @Validated LoginDto loginDto, HttpServletRequest request) { @@ -90,13 +97,13 @@ redisUtils.del(AppContants.PC_LOGIN_PREFIX + redisUtils.getString(redisMember)); } } - redisUtils.set(redisToken, JSONObject.toJSONString(loginUserBean), applicationProperties.getRedisExpire()); + redisUtils.set(redisToken, JSONObject.toJSONString(loginUserBean.getMemberEntity()), applicationProperties.getRedisExpire()); redisUtils.set(redisMember, token); Map<String, Object> authInfo = new HashMap<>(); // 开启debug模式,则将加密后的token返回 if (applicationProperties.isDebug()) { authInfo.put("token", token); - authInfo.put("rsaToken", generateAsaToken(token)); + authInfo.put("rsaToken", AppContants.TOKEN_START_WITH + generateAsaToken(token)); authInfo.put("user", loginUserBean); } else { authInfo.put("token", token); @@ -110,6 +117,7 @@ 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) { -- Gitblit v1.9.1