| | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Value("${h5.redirectUriBase}") |
| | | private String redirectUriBase; |
| | | @Value("${h5.redirectMerchantUriBase}") |
| | | private String redirectMerchantUriBase; |
| | | |
| | | @Value("${h5.redirectEmployeeUriBase}") |
| | | private String redirectEmployeeUriBase; |
| | | |
| | | |
| | | /** |
| | |
| | | @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)); |
| | |
| | | @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("企业微信未授权手机号,无法登录"); |
| | | } |