From e209c5e490f56c80c209fbe9c3613069cc0dd70d Mon Sep 17 00:00:00 2001
From: manailin <261030956@qq.com>
Date: 星期二, 27 七月 2021 21:58:30 +0800
Subject: [PATCH] Merge branch 'test' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into test
---
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/LoginApi.java | 42 ++++++++++++++++++------------------------
1 files changed, 18 insertions(+), 24 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 f18b110..ec5d5af 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
@@ -10,6 +10,7 @@
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;
@@ -54,15 +55,20 @@
if (ObjectUtils.isEmpty(code)) {
return R.fail("缺少登录参数");
}
+ log.info(code);
WxMaService maService = wxMaConfiguration.getMaService();
WxMaJscode2SessionResult sessionInfo=null;
try {
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();
@@ -78,33 +84,14 @@
@ApiOperation(value = "维护用户基本信息(昵称、性别、头像)")
@PostMapping("updateUserWeiXinInfo")
public R updateUserWeiXinInfo(@RequestBody LoginRequest loginRequest){
- String encryptedData = loginRequest.getEncryptedData();
- String iv = loginRequest.getIv();
- boolean empty = ObjectUtils.isEmpty(iv);
- boolean empty1 = ObjectUtils.isEmpty(encryptedData);
- if (empty||empty1) {
- return R.fail("微信用户参数不全");
- }
- WxMaService maService = wxMaConfiguration.getMaService();
Long userId = this.getUserId();
boolean empty2 = ObjectUtils.isEmpty(userId);
if (empty2) {
throw new UnAuthenticationException();
}
- R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + "");
- LoginUserInfoVO loginUserInfoVO =r.getData();
- 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("微信解析基本信息失败");
- }
+ WxMaUserInfo wxUserInfo = loginRequest.getUserInfo();
if (null == wxUserInfo) {
- return R.fail("微信解析基本信息失败");
+ return R.fail("缺少基本信息参数");
}
String avatarUrl = wxUserInfo.getAvatarUrl();
String gender = wxUserInfo.getGender();
@@ -173,4 +160,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