From 23fb45dd846ed8b62304c408c6bbe64265d4ac8b Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 20 十二月 2019 18:57:16 +0800
Subject: [PATCH] 代码合并

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogin.cs
index 6bdec6f..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);
@@ -572,7 +573,7 @@
                             { IsBackground = true }.Start();
                         }
                     };
-            //}
+                //}
             //};
 #endif
 
@@ -653,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)

--
Gitblit v1.8.0