From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/Common/Logic/HdlMemberLogic.cs | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 215 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Common/Logic/HdlMemberLogic.cs b/ZigbeeApp/Shared/Phone/Common/Logic/HdlMemberLogic.cs
new file mode 100644
index 0000000..0c49b14
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/Common/Logic/HdlMemberLogic.cs
@@ -0,0 +1,215 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone
+{
+ /// <summary>
+ /// 鎴愬憳鐨勯�昏緫涓氬姟
+ /// </summary>
+ public class HdlMemberLogic
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 鏈湴瀹夐槻鏁版嵁
+ /// </summary>
+ private static HdlMemberLogic m_Current = null;
+ /// <summary>
+ /// 鏈湴瀹夐槻鏁版嵁
+ /// </summary>
+ public static HdlMemberLogic Current
+ {
+ get
+ {
+ if (m_Current == null)
+ {
+ m_Current = new HdlMemberLogic();
+ }
+ return m_Current;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 鎴愬憳鍒楄〃___________________________
+
+ /// <summary>
+ /// 鑾峰彇鎴愬憳鍒楄〃淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ public List<MemberInfoRes> GetMemberListInfo(ShowNetCodeMode mode = ShowNetCodeMode.No)
+ {
+ var pra = new { homeId = Common.Config.Instance.Home.Id };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/child/account/findAll", RestSharp.Method.POST, pra, null, null, CheckMode.A璐﹀彿鏉冮檺);
+ //妫�娴嬬姸鎬佺爜
+ if (HdlCheckLogic.Current.CheckNetCode(result, mode) == false)
+ {
+ return null;
+ }
+ var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<MemberInfoRes>>(result.Data.ToString());
+
+ var listCheck = new List<string>();
+ var listShowInfo = new List<MemberInfoRes>();
+ foreach (MemberInfoRes infoRes in listInfo)
+ {
+ if (listCheck.Contains(infoRes.ChildAccountId) == true
+ || infoRes.Account == HdlUserCenterResourse.UserInfo.UserPhone
+ || infoRes.Account == HdlUserCenterResourse.UserInfo.UserEmail)
+ {
+ //濡傛灉鏄畠鑷繁鐨勮瘽锛屼笉鏄剧ず
+ continue;
+ }
+ if (infoRes.ChildAccountType == "ADMIN")
+ {
+ infoRes.AccountType = 1;
+ }
+ if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1 && infoRes.AccountType != 0)
+ {
+ //涓嶈兘澶熻幏鍙栨潈闄愮瓑绾ф瘮浠栭珮鐨�(涓讳汉鑷繁鍙互鏃犺杩欎釜鍒ゆ柇)
+ continue;
+ }
+
+ listCheck.Add(infoRes.ChildAccountId);
+ //娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
+ listShowInfo.Add(infoRes);
+ }
+ return listShowInfo;
+ }
+
+ #endregion
+
+ #region 鈻� 鎴愬憳鏉冮檺___________________________
+
+ /// <summary>
+ /// 璁剧疆杩滅▼鎿嶄綔鏉冮檺
+ /// </summary>
+ /// <param name="i_childAccountId">瀛愯处鍙风殑涓婚敭</param>
+ /// <param name="i_statu">true:鍙互杩滅▼鎿嶄綔 false:涓嶅彲浠ヨ繙绋嬫搷浣�</param>
+ /// <param name="mode">澶辫触鏃舵槸鍚︽樉绀簍ip娑堟伅</param>
+ /// <returns></returns>
+ public bool SetRemoteOperationPermissions(string i_childAccountId, bool i_statu, ShowNetCodeMode mode = ShowNetCodeMode.YES)
+ {
+ var pra = new { childAccountId = i_childAccountId, homeId = Common.Config.Instance.Home.Id, isRemoteControl = i_statu };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/child/account/update", RestSharp.Method.POST, pra, null, null, CheckMode.A璐﹀彿鏉冮檺);
+ //妫�娴嬬姸鎬佺爜
+ if (HdlCheckLogic.Current.CheckNetCode(result, mode) == false)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /// <summary>
+ /// 缂栬緫鎴愬憳鐨勬潈闄�
+ /// </summary>
+ /// <param name="i_childAccountId">瀛愯处鍙风殑涓婚敭</param>
+ /// <param name="i_authorityNo">1:鏅�氭垚鍛� 3:绠$悊鍛�</param>
+ /// <returns></returns>
+ public bool EditorMemberAuthority(string i_childAccountId, int i_authorityNo)
+ {
+ string authorityDiv = i_authorityNo == 3 ? "ADMIN" : "ORDINARY";
+ var pra = new { homeId = Common.Config.Instance.Home.Id, childAccountId = i_childAccountId, childAccountType = authorityDiv };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/child/account/update", RestSharp.Method.POST, pra);
+ //妫�娴嬬姸鎬佺爜
+ if (HdlCheckLogic.Current.CheckNetCode(result, ShowNetCodeMode.YES) == false)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ #endregion
+
+ #region 鈻� 鍒犻櫎鎴愬憳___________________________
+
+ /// <summary>
+ /// 鍒犻櫎鎴愬憳
+ /// </summary>
+ /// <param name="i_childAccountId">瀛愯处鍙风殑涓婚敭</param>
+ /// <param name="mode">澶辫触鏃舵槸鍚︽樉绀簍ip娑堟伅</param>
+ /// <returns></returns>
+ public bool DeleteMember(string i_childAccountId, ShowNetCodeMode mode = ShowNetCodeMode.YES)
+ {
+ var pra = new { childAccountId = i_childAccountId, homeId = Common.Config.Instance.Home.Id };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/child/account/delete", RestSharp.Method.POST, pra, null, null, CheckMode.A璐﹀彿鏉冮檺);
+ //妫�娴嬬姸鎬佺爜
+ if (HdlCheckLogic.Current.CheckNetCode(result, mode) == false)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ #endregion
+
+ #region 鈻� 娣诲姞鎴愬憳___________________________
+
+ /// <summary>
+ /// 娣诲姞鎴愬憳
+ /// </summary>
+ /// <param name="i_account">瀛愯处鍙风殑Phone鎴栬�匛mail</param>
+ /// <param name="i_nickName">澶囨敞瀛愯处鍙风殑鏄电О</param>
+ /// <param name="mode">澶辫触鏃舵槸鍚︽樉绀簍ip娑堟伅</param>
+ /// <returns></returns>
+ public MemberInfoRes AddMember(string i_account, string i_nickName, ShowNetCodeMode mode = ShowNetCodeMode.YES)
+ {
+ var pra = new
+ {
+ account = i_account,
+ childAccountType = "ORDINARY",
+ homeId = Common.Config.Instance.Home.Id,
+ isRemoteControl = true,
+ nickName = i_nickName
+ };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("home-wisdom/app/child/account/add", RestSharp.Method.POST, pra, null, null, CheckMode.A璐﹀彿鏉冮檺, false, 3, true);
+ //妫�娴嬬姸鎬佺爜
+ if (HdlCheckLogic.Current.CheckNetCode(result, mode) == false)
+ {
+ return null;
+ }
+ var info = Newtonsoft.Json.JsonConvert.DeserializeObject<MemberInfoRes>(result.Data.ToString());
+
+ return info;
+ }
+
+ #endregion
+
+ #region 鈻� 鎼滅储璐﹀彿___________________________
+
+ /// <summary>
+ /// 鏍规嵁璐﹀彿,妫�绱㈣处鍙风殑鍩烘湰淇℃伅
+ /// </summary>
+ /// <param name="i_account">閭鎴栬�呮墜鏈哄彿</param>
+ /// <returns></returns>
+ public AccountInfoResult SearchNormalInfoByAccount(string i_account)
+ {
+ var pra = new { account = i_account };
+ var result = HdlHttpLogic.Current.RequestResponseFromZigbeeHttps("smart-footstone/member/memberInfo/getMemberInfoByAccount", RestSharp.Method.POST, pra, null, null, CheckMode.A涓嶆娴�, false, 3, true);
+ if (result == null)
+ {
+ //缃戝叧杩炴帴澶辫触,璇风‘璁ょ綉缁�
+ HdlMessageLogic.Current.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uGatewayIsNotLinkAndCheckNetwork));
+ return null;
+ }
+ if (result.Code == HttpMessageEnum.A10010)
+ {
+ //璐﹀彿涓嶅瓨鍦�
+ return new AccountInfoResult();
+ }
+ var info = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result.Data.ToString());
+ info.Account = i_account;
+ if (info.MemberName == string.Empty)
+ {
+ info.MemberName = info.Account;
+ }
+ //涓嬭浇澶村儚
+ info.HeadImage = HdlAccountLogic.Current.DownLoadAccountPictrue(i_account);
+
+ return info;
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0