|
|
@@ -50,6 +50,26 @@ namespace CallCenterAPI.WechatSDK
|
|
50
|
50
|
}
|
|
51
|
51
|
|
|
52
|
52
|
/// <summary>
|
|
|
53
|
+ /// 获取用户信息
|
|
|
54
|
+ /// </summary>
|
|
|
55
|
+ /// <param name="wxLoginDto"></param>
|
|
|
56
|
+ /// <returns></returns>
|
|
|
57
|
+ public static WxLoginDto GetUserInfo(WxLoginDto wxLoginDto)
|
|
|
58
|
+ {
|
|
|
59
|
+ if (string.IsNullOrWhiteSpace(wxLoginDto.Code))
|
|
|
60
|
+ {
|
|
|
61
|
+ var url = OAuthApi.GetAuthorizeUrl(AppId, wxLoginDto.RedirectUrl, "qwertyuidfghjkl", OAuthScope.snsapi_userinfo);
|
|
|
62
|
+ wxLoginDto.RedirectUrl = url;
|
|
|
63
|
+ return wxLoginDto;
|
|
|
64
|
+ }
|
|
|
65
|
+ var access = OAuthApi.GetAccessToken(AppId, AppSecret, wxLoginDto.Code);
|
|
|
66
|
+ wxLoginDto.OpenId = access.openid;
|
|
|
67
|
+ wxLoginDto.UserInfo = OAuthApi.GetUserInfo(access.access_token, access.openid);
|
|
|
68
|
+
|
|
|
69
|
+ return wxLoginDto;
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
|
72
|
+ /// <summary>
|
|
53
|
73
|
/// 获取common的token
|
|
54
|
74
|
/// </summary>
|
|
55
|
75
|
/// <returns></returns>
|