From c30b0597c3ea882dca80df67bae9e30b21b35158 Mon Sep 17 00:00:00 2001 From: huanghongfa <18228131219@163.com> Date: 星期一, 01 二月 2021 10:34:01 +0800 Subject: [PATCH] bug --- springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java index 7e60b61..8f0c931 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java +++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java @@ -9,6 +9,8 @@ import com.panzhihua.applets.model.vos.LoginRequest; import com.panzhihua.common.model.vos.LoginReturnVO; import com.panzhihua.common.model.vos.community.ComActVO; +import com.panzhihua.common.model.vos.community.ComMngStructAreaVO; +import com.panzhihua.common.model.vos.user.SysUserAgreementVO; import com.panzhihua.common.service.auth.TokenService; import com.panzhihua.common.service.community.CommunityService; import com.panzhihua.common.service.user.UserService; @@ -59,9 +61,13 @@ sessionInfo = maService.getUserService().getSessionInfo(code); } catch (Exception e) { log.error("微信登录失败【{}】", e.getMessage()); - sessionInfo=new WxMaJscode2SessionResult(); - sessionInfo.setOpenid("88888888"); - sessionInfo.setSessionKey("9999999"); + if (code.equals("22")) { + sessionInfo=new WxMaJscode2SessionResult(); + sessionInfo.setOpenid("88888888"); + sessionInfo.setSessionKey("9999999"); + }else{ + return R.fail("微信登录失败"); + } } log.info("微信登录成功【{}】", JSONObject.toJSONString(sessionInfo)); String openid = sessionInfo.getOpenid(); @@ -92,8 +98,16 @@ } R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + ""); LoginUserInfoVO loginUserInfoVO =r.getData(); - WxMaUserInfo wxUserInfo = maService.getUserService().getUserInfo(loginUserInfoVO.getSessionKey(), - encryptedData, iv); + WxMaUserInfo wxUserInfo = null; + try { + log.info(encryptedData); + log.info(iv); + wxUserInfo = maService.getUserService().getUserInfo(loginUserInfoVO.getSessionKey(), + encryptedData, iv); + } catch (Exception e) { + log.error(e.getMessage()); + return R.fail("微信解析基本信息失败"); + } if (null == wxUserInfo) { return R.fail("微信解析基本信息失败"); } @@ -150,7 +164,7 @@ return communityService.listCommunity(comActVO); } - @ApiOperation(value = "查询小区") + @ApiOperation(value = "查询小区",response = ComMngStructAreaVO.class) @GetMapping("listarea") @ApiImplicitParam(name ="communityId",value = "社区id",required = true) public R listArea(@RequestParam("communityId") Long communityId){ @@ -164,4 +178,11 @@ loginUserInfoVO.setUserId(userId); return userService.putUserCommunityArea(loginUserInfoVO); } + + @ApiOperation(value = "用户协议和隐私政策",response = SysUserAgreementVO.class) + @GetMapping("useragreement") + public R userAgreement(){ + int type=1; + return userService.userAgreement(type); + } } -- Gitblit v1.7.1