From 8444084e6aa11efa23287e7f82474ac22378a5c4 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 01 四月 2025 16:03:19 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java | 27 ++++++++++++++++++++------- 1 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java index 6c749ca..dcd1562 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/QwH5Controller.java @@ -37,8 +37,11 @@ @Autowired private TokenService tokenService; - @Value("${h5.redirectUriBase}") - private String redirectUriBase; + @Value("${h5.redirectMerchantUriBase}") + private String redirectMerchantUriBase; + + @Value("${h5.redirectEmployeeUriBase}") + private String redirectEmployeeUriBase; /** @@ -51,7 +54,17 @@ @ApiOperation("构造网页授权链接") public R<OauthUrlVo> oauthUrl(@ApiParam(value = "授权重定向地址", required = true) @RequestParam("redirectUri") String redirectUri) throws UnsupportedEncodingException { // 普通应用 - redirectUri = redirectUriBase + redirectUri; + redirectUri = redirectMerchantUriBase + redirectUri; + String oauthRedirectUrl = URLEncoder.encode(redirectUri,"utf-8"); + String oauthUrl = qywxInnerService.getOauthUrl(oauthRedirectUrl); + return R.ok(new OauthUrlVo(oauthUrl)); + } + + @GetMapping({"/h5/oauthStaffUrl"}) + @ApiOperation("构造网页授权链接") + public R<OauthUrlVo> oauthStaffUrl(@ApiParam(value = "授权重定向地址", required = true) @RequestParam("redirectUri") String redirectUri) throws UnsupportedEncodingException { + // 普通应用 + redirectUri = redirectEmployeeUriBase + redirectUri; String oauthRedirectUrl = URLEncoder.encode(redirectUri,"utf-8"); String oauthUrl = qywxInnerService.getOauthUrl(oauthRedirectUrl); return R.ok(new OauthUrlVo(oauthUrl)); @@ -62,10 +75,10 @@ @ApiOperation("通过code获取员工端用户登录") public R<OauthUserVo> oauthStaff(@ApiParam(value = "成员授权获取到的code", required = true) @RequestParam("code") String code) throws IOException { // 通过code获取访问用户敏感信息 - //JSONObject result = qywxInnerService.getOauthUser(code); - //QwUserDetailDto qwUserDetail = JSONObject.parseObject(result.toJSONString(), QwUserDetailDto.class); - QwUserDetailDto qwUserDetail = new QwUserDetailDto(); - qwUserDetail.setMobile("17780704874"); + JSONObject result = qywxInnerService.getOauthUser(code); + QwUserDetailDto qwUserDetail = JSONObject.parseObject(result.toJSONString(), QwUserDetailDto.class); + //QwUserDetailDto qwUserDetail = new QwUserDetailDto(); + //qwUserDetail.setMobile("17780704874"); if(StringUtils.isBlank(qwUserDetail.getMobile())){ throw new ServiceException("企业微信未授权手机号,无法登录"); } -- Gitblit v1.7.1