| @@ -162,10 +162,11 @@ public class WxUserGrantController extends BaseController { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| @PostMapping("/getUserPhone") | @PostMapping("/getUserPhone") | ||||
| @ApiOperation(value = "授权后获取用户的手机号", notes = "{\"encryptedData\":\"string\",\"iv\":\"string\",\"sessionKey\":\"string\"}") | |||||
| @ApiOperation(value = "授权后获取用户的手机号", notes = "{\"appId\":\"string\",\"encryptedData\":\"string\",\"iv\":\"string\",\"sessionKey\":\"string\"}") | |||||
| public ResultData getUserPhone(@RequestBody Map<String, String> map) { | public ResultData getUserPhone(@RequestBody Map<String, String> map) { | ||||
| logger.info(map.toString()); | logger.info(map.toString()); | ||||
| String encryptedData = map.get("encryptedData"); | String encryptedData = map.get("encryptedData"); | ||||
| String appId = map.get("appId"); | |||||
| String iv = map.get("iv"); | String iv = map.get("iv"); | ||||
| String sessionKey = map.get("sessionKey"); | String sessionKey = map.get("sessionKey"); | ||||
| //登录凭证不能为空 | //登录凭证不能为空 | ||||
| @@ -184,7 +185,7 @@ public class WxUserGrantController extends BaseController { | |||||
| if (user == null) { | if (user == null) { | ||||
| return new ResultData(ErrorCode.UNLOGIN); | return new ResultData(ErrorCode.UNLOGIN); | ||||
| } | } | ||||
| WxAppinfo wxAppinfo = wxAppinfoServie.getCAppInfoFromRedis(user.getTenantId()); | |||||
| WxAppinfo wxAppinfo = wxAppinfoServie.getCAppInfoFromRedis(appId); | |||||
| if(wxAppinfo == null){ | if(wxAppinfo == null){ | ||||
| return new ResultData(ErrorCode.APPINFO_NOFUND); | return new ResultData(ErrorCode.APPINFO_NOFUND); | ||||
| } | } | ||||
| @@ -193,7 +194,6 @@ public class WxUserGrantController extends BaseController { | |||||
| // 解密 | // 解密 | ||||
| String phone = wxWeappService.decryptPhoneNoInfo(encryptedData, iv,sessionKey, user, wxAppinfo, false); | String phone = wxWeappService.decryptPhoneNoInfo(encryptedData, iv,sessionKey, user, wxAppinfo, false); | ||||
| resultMap.put("msg", "授权手机成功!"); | resultMap.put("msg", "授权手机成功!"); | ||||
| resultMap.put("phone", phone); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| }catch (Exception e) { | }catch (Exception e) { | ||||