From 09ac251a089f5bb79d59a12bf2f932dda12c4ca2 Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Thu, 10 Jul 2025 15:53:17 +0800 Subject: [PATCH] 小程序:微信授权登录;根据订单号查询订单操作日志 --- oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java | 18 +++++++----------- 1 files changed, 7 insertions(+), 11 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java b/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java index 9a1f84c..25a76cc 100644 --- a/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java +++ b/oying-system/src/main/java/com/oying/modules/security/rest/AuthController.java @@ -81,7 +81,7 @@ if (StringUtils.isBlank(code)) { throw new BadRequestException("验证码不存在或已过期"); } - if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { + if (!authUser.getCode().equalsIgnoreCase(code)) { throw new BadRequestException("验证码错误"); } // 获取用户信息 @@ -120,7 +120,7 @@ if (StringUtils.isBlank(code)) { throw new BadRequestException("验证码不存在或已过期"); } - if (StringUtils.isBlank(authUser.getCode()) || !authUser.getCode().equalsIgnoreCase(code)) { + if (!authUser.getCode().equalsIgnoreCase(code)) { throw new BadRequestException("验证码错误"); } // 获取用户信息 @@ -147,22 +147,18 @@ public static final String OLD = "OLD"; public static final String NEW = "NEW"; - @Log("微信授权登录") - @ApiOperation("微信授权登录") + @Log("小程序:微信授权登录") + @ApiOperation("小程序:微信授权登录") @AnonymousPostMapping(value = "/login/weixin") public ResponseEntity<Object> loginWeixin(@Validated @RequestBody AuthUserWeixinDto authUser, HttpServletRequest request) throws Exception { JSONObject jsonObject; - switch (authUser.getCode()) { + switch (authUser.getType()) { case OLD: jsonObject = weiXinService.code2Session(authUser.getCode()); String openid = jsonObject.getString("openid"); User userDto = userService.findByOpenid(openid); if (userDto == null) { - Map<String, Object> authInfo = new HashMap<String, Object>(2) {{ - put("token", openid); - put("member", null); - }}; - return ResponseEntity.ok(authInfo); + return ResponseEntity.ok(R.success(openid)); } authUser.setUsername(userDto.getUsername()); break; @@ -174,7 +170,7 @@ //创建用户 User user = new User(); user.setUsername(phone); - user.setNickName("LYHD-" + phone); + user.setNickName("OYING-" + phone); user.setUserType(ConstantsKey.BUYER); user.setEnabled(true); getRole(user); -- Gitblit v1.9.3