From 1a2061079e97a738ec7b8959bfd9a6e6c6997403 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 31 十月 2019 09:59:29 +0800
Subject: [PATCH] 2019.10.31

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs |   41 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs
old mode 100755
new mode 100644
index d94509b..448dc50
--- a/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountRegisterSuccess.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Text;
 using Shared.Common;
 using Shared.Phone.UserView;
 
@@ -11,7 +12,7 @@
         /// </summary>
         /// <param name="account"></param>
         /// <param name="password"></param>
-        public void Show(string account, string password)
+        public void Show(string account, string password,string OpenID="")
         {
             var dialog = new FrameLayout()
             {
@@ -85,7 +86,7 @@
             };
             AddChidren(willLogin);
 
-            AutoLogin(account, password);
+            AutoLogin(account, password,OpenID);
         }
 
         /// <summary>
@@ -93,7 +94,7 @@
         /// </summary>
         /// <param name="account"></param>
         /// <param name="password"></param>
-        private void AutoLogin(string account, string password)
+        private void AutoLogin(string account, string password, string OpenID = "")
         {
             new System.Threading.Thread(() =>
             {
@@ -106,10 +107,14 @@
                         CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.Logining));
                         Action action = async () => {
                             var loginSuccess = await HomePage.Instance.LoginByPWDAsync(account, password);
-                            if (loginSuccess == 1)
+                            if (loginSuccess==1)
                             {
                                 new System.Threading.Thread(async () =>
                                 {
+                                    if (string.IsNullOrEmpty(OpenID)==false)
+                                    {
+                                        BindAuthUser(Config.Instance.Guid, OpenID);
+                                    }
                                     ZigBee.Common.Application.Init();
 
                                     //鐧诲綍鎴愬姛
@@ -125,6 +130,9 @@
                                     {
                                         UserPage.Instance.Fresh();
                                         CommonPage.Loading.Hide();
+                                        this.RemoveFromParent();
+                                        CommonPage.Instance.RemoveViewByTag("Register");
+                                        CommonPage.Instance.RemoveViewByTag("Login");
                                     });
                                 })
                                 { IsBackground = true }.Start();
@@ -149,13 +157,32 @@
                     finally
                     {
                         CommonPage.Loading.Hide();
-                        this.RemoveFromParent();
-                        CommonPage.Instance.RemoveViewByTag("Register");
-                        CommonPage.Instance.RemoveViewByTag("Login");
                     }
                 });
             })
             { IsBackground = true }.Start();
         }
+
+        /// <summary>
+        /// 缁戝畾
+        /// </summary>
+        /// <param name="guid"></param>
+        /// <param name="openId"></param>
+        private void BindAuthUser(string guid, string openId)
+        {
+            new System.Threading.Thread(async () =>
+            {
+                var auth = new SendDataToServer.BindAuthUser
+                {
+                    AccountGuid = guid,
+                    OpenID = openId
+                };
+                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(auth);
+                var revert = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/BindAuthUserToAccount", Encoding.UTF8.GetBytes(requestJson));
+            })
+            {
+                IsBackground = true
+            }.Start();
+        }
     }
 }

--
Gitblit v1.8.0