From 5986f63b75bd81c6cef262c670e9251c038cbf5d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 17 十二月 2019 17:21:07 +0800 Subject: [PATCH] 合并一个版本 --- ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs | 34 ++++++++++++++++++++++++---------- 1 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs index 3cab11a..54e7481 100755 --- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs +++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs @@ -387,6 +387,7 @@ Config.Instance.MD5PWD = revertData.MD5PWD; Config.Instance.Guid = revertData.Guid; Config.Instance.LoginDateTime = DateTime.Now; + Config.Instance.LoginToken = revertData.Token; if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null) { Config.Instance.AccountList.Add(revertData.Account); @@ -394,11 +395,12 @@ Config.Instance.Save(); var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID(); - var homes = await House.GetHomeLists(); + var homes = await House.GetHomeLists(); + //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ + await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); //鍚姩ZigBee ZigBee.Common.Application.Init(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); + Shared.Common.Room.InitAllRoom(); Application.RunOnMainThread(() => { @@ -543,11 +545,11 @@ HomePage.Instance.ShowLoginLoadView(); }); var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID(); - var homes = await House.GetHomeLists(); + var homes = await House.GetHomeLists(); + //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ + await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); //鍚姩ZigBee ZigBee.Common.Application.Init(); - //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼ - await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread(); Shared.Common.Room.InitAllRoom(); Application.RunOnMainThread(() => { @@ -571,7 +573,7 @@ { IsBackground = true }.Start(); } }; - //} + //} //}; #endif @@ -652,7 +654,19 @@ AccessToken = authRes.access_token, RefreshToken = authRes.refresh_token, OpenID = authRes.openid - }; + }; + //鑾峰彇寰俊鏄电О + var strUrl = "https://api.weixin.qq.com/sns/userinfo?access_token=" + authRes.access_token; + strUrl += "&openid=" + authRes.openid; + var byteData = await Common.CommonPage.Instance.DoRequestZigbeeHttpsInterface(strUrl, null, null, "GET"); + if (byteData == null) + { + return false; + } + var receipData = System.Text.Encoding.UTF8.GetString(byteData); + var nickData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserCenter.NicknameInfo>(receipData); + auth.UserName = nickData.nickname; + var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(auth); var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/InsertOrUpdateAuthUser", System.Text.Encoding.UTF8.GetBytes(requestJson)); if (revertObj == null) @@ -675,13 +689,13 @@ Config.Instance.Save(); return true; } - else + else { return false; } } - + /// <summary> /// phone/email 閫夋嫨 -- Gitblit v1.8.0