调整微信登录
This commit is contained in:
1 parent
5671b35dce
commit
432e02e3de
4 files changed
+44
-41
No files matched your search
@@ -11,14 +11,6 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
public class ThirdPartApi : ApiBase
|
||||
{
|
||||
public async Task<JObject> GetWxAccessToken(string code)
|
||||
{
|
||||
return await GetThirdPartAsync<JObject>($"https://api.weixin.qq.com/sns/oauth2/access_token?appid={App.WxAppId}&secret={App.WxAppSecret}&code={code}&grant_type=authorization_code");
|
||||
}
|
||||
public async Task<JObject> GetWxUserInfo(string accessToken, string openId)
|
||||
{
|
||||
return await GetThirdPartAsync<JObject>($"https://api.weixin.qq.com/sns/userinfo?access_token=" + accessToken + "&openid=" + openId);
|
||||
}
|
||||
public async Task<IpToGeoModel> GetLocationInfo()
|
||||
{
|
||||
return await GetThirdPartAsync<IpToGeoModel>("https://ip.seeip.org/geoip");
|
||||
|
||||
@@ -185,7 +185,25 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionIdByCode(string code,string state)
|
||||
{
|
||||
var r = await GetAsync<JsonResult<object>>($"NoAuth/v1/OnWebWxLogin?code={code}&state={state}");
|
||||
if (r.result)
|
||||
{
|
||||
var data = JObject.FromObject(r.data);
|
||||
if (data.Value<string>("success") != null && data.Value<string>("success") == "False")
|
||||
{
|
||||
return r;
|
||||
}
|
||||
else
|
||||
{
|
||||
var user = data.ToObject<UserResultModel>();
|
||||
user.cookie = cookies[0].Value;
|
||||
r.data = user;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
public async Task<JsonResult<object>> OnWebWxLoginCheckUnionId(string unionId, string openId)
|
||||
{
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/OnWebWxLoginCheckUnionId", new { unionId, openId });
|
||||
@@ -205,11 +223,11 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
return r;
|
||||
}
|
||||
public async Task<JsonResult<object>> OnWebWxLogin(string Phone, string Captcha
|
||||
, string UnionId, string WxWebOpenId, string WxHeadImg, string NickName, int? Sex, string Password)
|
||||
public async Task<JsonResult<object>> OnWebWxLogin(string Phone, string Captcha,
|
||||
string Password, string UnionId, string WxWebOpenId)
|
||||
{
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/OnWebWxLogin",
|
||||
new { Phone, Captcha, UnionId, WxWebOpenId, WxHeadImg, NickName, Sex, Pwd = Password });
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnWebWxLogin",
|
||||
new { Phone, Captcha, UnionId, openId = WxWebOpenId, Pwd = Password });
|
||||
if (r.result)
|
||||
{
|
||||
var u = JObject.FromObject(r.data);
|
||||
|
||||
Reference in new issue
Block a user