FB登录功能暂存;苹果有问题
This commit is contained in:
1 parent
6423007638
commit
769b75e2e2
7 files changed
+84
-12
No files matched your search
@@ -298,6 +298,18 @@ namespace Assets.Scripts.Apis
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnAppleIdLogin", new { appleUserId, token, phone, pwd, Captcha });
|
||||
return GetDataAfterSetCookie(r);
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnFacebookLoginCheck(string userId, string token)
|
||||
{
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLoginCheck", new { faceBookUserId = userId, token });
|
||||
return GetDataAfterSetCookie(r);
|
||||
}
|
||||
|
||||
public async Task<JsonResult<object>> OnFacebookLogin(string faceBookUserId, string token, string phone, string pwd, string Captcha)
|
||||
{
|
||||
var r = await PostAsync<JsonResult<object>>("NoAuth/v1/OnFacebookLogin", new { faceBookUserId, token, phone, pwd, Captcha });
|
||||
return GetDataAfterSetCookie(r);
|
||||
}
|
||||
private JsonResult<object> GetDataAfterSetCookie(JsonResult<object> r)
|
||||
{
|
||||
if (r.result)
|
||||
@@ -316,5 +328,7 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public delegate void ChangeLanguageDelegate();
|
||||
|
||||
public static class App
|
||||
{
|
||||
public static string Host = "http://192.168.0.101:5084/";
|
||||
public static string Host = "http://192.168.0.101:5085/";
|
||||
|
||||
public static string AppVersion = Application.version;
|
||||
|
||||
|
||||
@@ -154,9 +154,19 @@ public class LoginControllerMobile : MonoBehaviour, INativeOnMobileWxLoginResp
|
||||
/// <param name="res"></param>
|
||||
private void onFaceBookResp(ILoginResult res)
|
||||
{
|
||||
Debug.Log(res.ToString());
|
||||
if (string.IsNullOrEmpty(res.Error))
|
||||
{
|
||||
Debug.Log("用戶Id" + res.ResultDictionary["user_id"]);
|
||||
if (res.Cancelled)
|
||||
{
|
||||
Utils.showToast(null, App.GetLocalString("User deauthorisation"));
|
||||
}
|
||||
else
|
||||
{
|
||||
GetComponent<LoginController>()
|
||||
.OnFacebookLoginCheck(res.ResultDictionary["user_id"].ToString(), res.ResultDictionary["access_token"].ToString());
|
||||
Debug.Log("用戶Id" + res.ResultDictionary["user_id"]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -507,6 +507,38 @@ public class LoginController : BaseScene
|
||||
transform.Find("Panel").Find("Version").GetComponent<Text>().text = $"V{App.AppVersion}";
|
||||
#endif
|
||||
}
|
||||
private string fbUserId = "";
|
||||
private string fbToken = "";
|
||||
|
||||
public async void OnFacebookLoginCheck(string userId, string token)
|
||||
{
|
||||
fbUserId = userId;
|
||||
fbToken = token;
|
||||
signType = 3;
|
||||
var res = await ConfigHelper.userApi.OnFacebookLoginCheck(userId, token);
|
||||
if (res.result) //判断是否成功登录
|
||||
{
|
||||
var data = JObject.FromObject(res.data);
|
||||
if (data.ContainsKey("success") && data.Value<string>("success") == "False")
|
||||
{
|
||||
goSign();
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshWx3(data.ToObject<UserResultModel>(), 1);
|
||||
wxLogin3.gameObject.SetActive(true);
|
||||
signContainer.gameObject.SetActive(false);
|
||||
pageNums = 3;
|
||||
MobileAni(true);
|
||||
StartScrollPanel(2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.showToast(null, res.errMsg);
|
||||
}
|
||||
}
|
||||
|
||||
private string appleUserId = "";
|
||||
private string appleToken = "";
|
||||
private int signType { get; set; }
|
||||
@@ -789,7 +821,7 @@ public class LoginController : BaseScene
|
||||
//Timer t = new Ti
|
||||
if (r.result)
|
||||
{
|
||||
if (signType == 1 || signType == 2)
|
||||
if (isThird())
|
||||
{
|
||||
if (r.data.Value<bool>("isExist"))
|
||||
{
|
||||
@@ -850,7 +882,7 @@ public class LoginController : BaseScene
|
||||
signForm.cpassword.text = "";
|
||||
StartScrollSign(0);
|
||||
}
|
||||
//0-普通 1-微信 2-苹果
|
||||
//0-普通 1-微信 2-苹果 3-facebook
|
||||
private async void goRegNext(int signType = 0)
|
||||
{
|
||||
var Email = signForm.email;
|
||||
@@ -881,9 +913,13 @@ public class LoginController : BaseScene
|
||||
wxInfoJson.Value<string>("unionId"),
|
||||
wxInfoJson.Value<string>("openId"));
|
||||
}
|
||||
else if (signType == 2)
|
||||
else if (signType == 2)
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId,appleToken,Email.text,Password.text,Captcha.text);
|
||||
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, Password.text, Captcha.text);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnFacebookLogin(fbUserId, fbToken, Email.text, Password.text, Captcha.text);
|
||||
}
|
||||
if (r != null && r.result)
|
||||
{
|
||||
@@ -910,7 +946,11 @@ public class LoginController : BaseScene
|
||||
//苹果登录
|
||||
r = await ConfigHelper.userApi.OnAppleIdLogin(appleUserId, appleToken, Email.text, "", Captcha.text);
|
||||
}
|
||||
else
|
||||
else if (signType == 3)
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnFacebookLogin(fbUserId, fbToken, Email.text, "", Captcha.text);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.userApi.OnWebWxLogin(Email.text,
|
||||
Captcha.text,
|
||||
@@ -1218,6 +1258,10 @@ public class LoginController : BaseScene
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
//signPage1.Find("signThird").GetComponent<Button>().onClick.AddListener(() => { ; });
|
||||
}
|
||||
bool isThird()
|
||||
{
|
||||
return signType > 0;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
@@ -1247,7 +1291,7 @@ public class LoginController : BaseScene
|
||||
if (type == 0)
|
||||
{
|
||||
pageNums = 4;
|
||||
if (signType != 2)
|
||||
if (signType < 2)
|
||||
{
|
||||
signType = 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user