From 67ed2f4a0ebe1b265a563bad3f82627ed78c3054 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 20 十一月 2020 15:48:11 +0800
Subject: [PATCH] 2020-11-20 1.修改替换正则检测方法。2.修改请求失败tip方法。3.增加隐私政策功能。

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |   98 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 63 insertions(+), 35 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index f6110e1..b31745f 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -266,12 +266,15 @@
         /// <summary>
         /// 楠岃瘉楠岃瘉鐮�
         /// </summary>
-        /// <param name="account"></param>
-        /// <param name="code"></param>
+        /// <param name="verifyType">楠岃瘉绫诲瀷</param>
+        /// <param name="account">楠岃瘉璐﹀彿</param>
+        /// <param name="code">楠岃瘉鐮�</param>
+        /// <param name="isPhone">鏄惁鎵嬫満</param>
+        /// <param name="verifySuccessFail">楠岃瘉閫氳繃鍚庯紝楠岃瘉鐮佹槸鍚﹀け鏁�</param>
         /// <returns></returns>
-        public ResponsePackNew ValidatorCode(VerifyType verifyType, string account, string code, bool isPhone)
+        public ResponsePackNew ValidatorCode(VerifyType verifyType, string account, string code, bool isPhone, bool verifySuccessFail = true)
         {
-            var requestObj = new VerifyCodeCheckObj() { verifyCode = code, verifyType = (int)verifyType };
+            var requestObj = new VerifyCodeCheckObj() { verifyCode = code, verifyType = (int)verifyType , verifySuccessFail = verifySuccessFail };
             if (isPhone)
             {
                 //鎵嬫満
@@ -309,7 +312,7 @@
         /// 鑾峰彇鐢ㄦ埛淇℃伅
         /// </summary>
         /// <returns></returns>
-        public void GetUserInfo()
+        public void GetUserInfo(bool bGetHeadImage = true)
         {
             var requestJson = HttpUtil.GetSignRequestJson(new NullObj());
             var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson);
@@ -319,33 +322,37 @@
                 MainPage.LoginUser.userEmailInfo = info.memberEmail;
                 MainPage.LoginUser.userMobileInfo = info.memberPhone;
                 MainPage.LoginUser.userName = info.memberName;
-
-                var headImageBytes = DownHeadImage();
-                if (headImageBytes != null)
+                MainPage.LoginUser.areaCode = info.memberPhonePrefix;
+                //鏄惁闇�瑕佽幏鍙栧ご鍍�
+                if (bGetHeadImage)
                 {
-                    MainPage.LoginUser.headImagePageBytes = headImageBytes;
-                    FileStream fs = null;
-                    try
+                    var headImageBytes = DownHeadImage();
+                    if (headImageBytes != null)
                     {
                         MainPage.LoginUser.headImagePageBytes = headImageBytes;
-                        var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
-                        fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
-                        fs.Write(headImageBytes, 0, headImageBytes.Length);
-                        fs.Flush();
-                        MainPage.LoginUser.headImagePagePath = filePath;
-                    }
-                    catch (Exception ex)
-                    {
-                        MainPage.Log($"download headImage error : {ex.Message}");
-                    }
-                    finally
-                    {
-                        if (fs != null)
+                        FileStream fs = null;
+                        try
                         {
-                            fs.Close();
+                            MainPage.LoginUser.headImagePageBytes = headImageBytes;
+                            var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
+                            fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
+                            fs.Write(headImageBytes, 0, headImageBytes.Length);
+                            fs.Flush();
+                            MainPage.LoginUser.headImagePagePath = filePath;
                         }
-                    }
+                        catch (Exception ex)
+                        {
+                            MainPage.Log($"download headImage error : {ex.Message}");
+                        }
+                        finally
+                        {
+                            if (fs != null)
+                            {
+                                fs.Close();
+                            }
+                        }
 
+                    }
                 }
 
                 MainPage.LoginUser.SaveUserInfo();
@@ -458,11 +465,24 @@
             else
             {
                 //閭
-                requestObj.memberMail = account;
+                requestObj.memberEmail = account;
             }
             var requestJson = HttpUtil.GetSignRequestJson(requestObj);
-            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson).Code;
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_BindWithAccount, requestJson).Code;
         }
+
+        /// <summary>
+        /// 瑙g粦鎵嬫満鎴栬�呴偖绠�
+        /// </summary>
+        /// <param name="isPhone"></param>
+        /// <returns></returns>
+        public string UnBindAccount(bool isPhone)
+        {
+            var requestObj = new UnBindAccountObj() { unBindLabel = isPhone ? "PHONE": "EMAIL" };
+            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UnbindWithAccount, requestJson).Code;
+        }
+
         #endregion
 
         #region 浣忓畢閮ㄥ垎
@@ -623,20 +643,28 @@
         public ResponsePackNew GetResidenceMemberAccount()
         {
             var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new HomeIdObj() { homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID });
-            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Child_FindAll, requestJson, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl);
+            var replaceToken = MainPage.LoginUser.loginTokenString;
+            //濡傛灉褰撳墠鎵�鍒嗕韩浣忓畢鍜屼负绠$悊鍛橈紝鏇挎崲涓轰富浜簍oken
+            //寰呭鐞�...
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Child_FindAll, requestJson, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
         }
 
         /// <summary>
         /// 鍒犻櫎浣忓畢涓嬬殑鎴愬憳璐﹀彿
         /// </summary>
         /// <returns></returns>
-        public ResponsePack DeleteResidenceMemberAccount(string memberAccount)
+        public ResponsePackNew DeleteResidenceMemberAccount(ResidenceMemberInfo subaccount)
         {
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            d.Add("SubAccount", memberAccount);
-            d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
-            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-            return RequestHttps($"{severAddress}/ZigbeeUsers/DeletedSubAccount", jsonString, true);
+            var requestObj = new ChildDeleteObj()
+            {
+                childAccountId = subaccount.childAccountId,
+                homeId = subaccount.homeId
+            };
+            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+            var replaceToken = MainPage.LoginUser.loginTokenString;
+            //濡傛灉褰撳墠鎵�鍒嗕韩浣忓畢鍜屼负绠$悊鍛橈紝鏇挎崲涓轰富浜簍oken
+            //寰呭鐞�...
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Child_Delete, requestJson, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
         }
 
         /// <summary>

--
Gitblit v1.8.0