mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-06-23 02:22:47 +08:00
微信扫码登录
This commit is contained in:
@@ -439,9 +439,18 @@ public class LoginServiceImpl implements ILoginService {
|
||||
throw new OperateException("获取access_token失败:"+e.getMessage());
|
||||
}
|
||||
|
||||
// 2、获取微信用户信息
|
||||
String accessToken = "";
|
||||
String openid = "";
|
||||
|
||||
// 3、存在则更新否则创建用户
|
||||
// 访问微信获取用户信息
|
||||
String baseUserInfoUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s";
|
||||
String userInfoUrl = String.format(baseUserInfoUrl, accessToken, openid);
|
||||
String resultUserInfo = null;
|
||||
try {
|
||||
resultUserInfo = HttpUtils.sendGet(userInfoUrl);
|
||||
} catch (Exception e) {
|
||||
throw new OperateException("获取用户信息失败:"+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user