From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 06 七月 2021 09:39:03 +0800
Subject: [PATCH] 2021-07-06 1.更新
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 1409 +++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 947 insertions(+), 462 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 04842d1..4658ffe 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1,12 +1,10 @@
-锘縰sing System;
+锘縰sing System;
using System.Collections.Generic;
using System.IO;
-using System.Net;
+using System.Net;
using System.Text;
-using HDL_ON.DAL.Net;
using HDL_ON.Entity;
using Newtonsoft.Json.Linq;
-using Shared;
namespace HDL_ON.DAL.Server
{
@@ -39,34 +37,48 @@
{
}
+ #region kaede ___________浼犳劅鍣ㄥ巻鍙叉暟鎹甠_________________
/// <summary>
/// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹�
/// </summary>
- /// <param name="subnetId"></param>
- /// <param name="deviceId"></param>
- /// <param name="bigClass"></param>
- /// <param name="minClass"></param>
- /// <param name="queryType"></param>
- /// <param name="loopId"></param>
- /// <param name="nowMonth"></param>
- /// <param name="mac"></param>
+ /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈� </param>
+ /// <param name="deviceId">璁惧ID</param>
+ /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param>
/// <returns></returns>
- public ResponsePack GetSensorHistory(int subnetId, int deviceId, int bigClass, int minClass, int queryType, int loopId, int nowMonth, string mac)
+ public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey)
{
Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("SubnetID", subnetId);
- d.Add("DeviceID", deviceId);
- d.Add("LargeType", bigClass);
- d.Add("SmallType", minClass);
- d.Add("QueryType", queryType);
- d.Add("loopId", loopId);
- d.Add("NowMonth", nowMonth);
- d.Add("MAC", DB_ResidenceData.residenceData.residenceGatewayMAC);
- d.Add("LocalTimeZone", 8);
- var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString, true);
+ d.Add("type", qType);
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceId", new List<string>() { deviceId });
+ d.Add("key", new List<string>() { deviceKey });
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
}
+ /// <summary>
+ /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹�
+ /// </summary>
+ /// <param name="deviceId">璁惧ID</param>
+ /// <param name="pageSize">椤甸潰澶у皬</param>
+ /// <param name="pageNo">椤靛彿</param>
+ /// <returns></returns>
+ public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceId", deviceId);
+ d.Add("pageSize", pageSize);
+ d.Add("pageNo", pageNo);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
+ }
+
+
+
+
+ #endregion
//public string GetRequestResultMsg(string resultCode)
//{
@@ -101,42 +113,71 @@
public ResponsePackNew GetRegionByAccount(string account)
{
var requestJson = HttpUtil.GetSignRequestJson(new RegionByAccountObj() { account = account });
- return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson);
+ return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.GlobalRequestHttpsHost);
}
/// <summary>
/// 鍒锋柊Token
/// </summary>
/// <returns></returns>
- public bool RefreshToken()
+ public string RefreshToken()
{
var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj()
{
- refreshToken = UserInfo.Current.refreshToken,
+ refreshToken = UserInfo.Current.RefreshToken,
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson);
if (revertObj.Code.ToUpper() == StateCode.SUCCESS)
{
var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString());
- UserInfo.Current.loginTokenString = revertData.headerPrefix + revertData.accessToken;
- UserInfo.Current.lastTime = DateTime.Now;
+ UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
+ UserInfo.Current.RefreshToken = revertData.refreshToken;
+ UserInfo.Current.LastTime = DateTime.Now;
UserInfo.Current.SaveUserInfo();
- return true;
}
- return false;
+ return revertObj.Code;
}
#endregion
+ /// <summary>
+ /// 缁戝畾璋冭瘯浜哄憳鎻愪氦鐨勪綇瀹�,涓�涓綇瀹呭彧鑳界粦瀹氫竴娆�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew BindingResidence(string strUrl)
+ {
+ try
+ {
+ if (strUrl.Contains("app/home/deliver") == false)
+ {
+ //闈炴硶鐨刄RL 杩斿洖涓�涓嚜瀹氫箟鐨勭姸鎬佺爜
+ return new ResponsePackNew() { Code = "-100" };
+ }
+ var client = new RestSharp.RestClient(strUrl);
+
+ var request = new RestSharp.RestRequest(RestSharp.Method.GET);
+ request.Timeout = 5 * 1000;
+ request.AddHeader("content-type", "application/json");
+ request.AddHeader("Authorization", UserInfo.Current.LoginTokenString);
+
+ var response = client.Execute(request);
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ catch
+ {
+ return null;
+ }
+ }
#region 娉ㄥ唽銆佺櫥褰曢儴鍒�
- /// <summary>
- /// 鑾峰彇璇锋眰鎻愪氦鐨勮瑷�鍙傛暟
- /// </summary>
- public string GetPostLanguageType()
- {
- return Language.CurrentLanguage == "Chinese" ? LanguageTypeEnum.CHINESE.ToString() : LanguageTypeEnum.ENGLISH.ToString();
- }
+
/// <summary>
/// 閫氱敤 鍙戦�侀獙璇佺爜鏂规硶
@@ -151,7 +192,7 @@
var requestObj = new VerifyCodeSendObj()
{
verifyType = (int)verifyType,
- languageType = GetPostLanguageType()
+ languageType = Utlis.GetPostLanguageType()
};
// 鏄惁鏄墜鏈�
if (isPhone)
@@ -211,7 +252,7 @@
/// <returns></returns>
public ResponsePackNew ValidataCodeAndRegister(string account, string password, string code, bool isPhone = false)
{
- var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code, memberName = account };
+ var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code};//, memberName = account
if (isPhone)
{
requestObj.memberPhone = account;
@@ -282,7 +323,7 @@
/// 鑾峰彇鐢ㄦ埛淇℃伅
/// </summary>
/// <returns></returns>
- public void GetUserInfo(bool bGetHeadImage = true)
+ public string GetUserInfo(bool bGetHeadImage = true)
{
var requestJson = HttpUtil.GetSignRequestJson(new NullObj());
var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfo, requestJson);
@@ -292,101 +333,46 @@
UserInfo.Current.userEmailInfo = info.memberEmail;
UserInfo.Current.userMobileInfo = info.memberPhone;
UserInfo.Current.userName = info.memberName;
- UserInfo.Current.areaCode = info.memberPhonePrefix;
+
+ if (!string.IsNullOrEmpty(info.memberPhonePrefix))
+ {
+ UserInfo.Current.areaCode = info.memberPhonePrefix;
+ }
//鏄惁闇�瑕佽幏鍙栧ご鍍�
if (bGetHeadImage)
{
- var headImageBytes = DownHeadImage();
- if (headImageBytes != null && headImageBytes.Length > 0)
+ //2020-12-15 淇敼澶村儚鏂规
+ if (!string.IsNullOrEmpty(info.memberHeadIcon))
{
- UserInfo.Current.headImagePageBytes = headImageBytes;
- FileStream fs = null;
- try
- {
- UserInfo.Current.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();
- UserInfo.Current.headImagePagePath = filePath;
- }
- catch (Exception ex)
- {
- MainPage.Log($"download headImage error : {ex.Message}");
- }
- finally
- {
- if (fs != null)
- {
- fs.Close();
- }
- }
+ var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(info.memberHeadIcon);
+ if (headImageBytes != null && headImageBytes.Length > 0)
+ {
+ UserInfo.Current.headImagePagePath = info.memberHeadIcon;
+ //UserInfo.Current.headImagePagePath = imageKey;
+ }
}
}
UserInfo.Current.SaveUserInfo();
MainPage.Log("鑾峰彇鐢ㄦ埛淇℃伅鎴愬姛銆�");
}
-
-
- // Dictionary<string, object> d = new Dictionary<string, object>();
- //var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/GetAccountInfo", requestJson, true);
-
- //if (revertObj.StateCode.ToUpper() == StateCode.SUCCESS)
- //{
- // var dataStr = JObject.FromObject(revertObj.ResponseData);
- // //"DistributedMark": "96439601-fd26-4768-8440-1d9dfa32c109", < !--甯愬彿Id-- >
- // UserInfo.Current.userEmailInfo = dataStr.GetValue("Email").ToString();
- // UserInfo.Current.userMobileInfo = dataStr.GetValue("Phone").ToString();
- // FileStream fs = null;
- // try
- // {
- // var headImageString = dataStr.GetValue("HeadImage").ToString();
- // if (!string.IsNullOrEmpty(headImageString))
- // {
- // var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString);
- // var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString);
- // UserInfo.Current.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();
- // UserInfo.Current.headImagePagePath = filePath;
- // }
- // }
- // catch (Exception ex)
- // {
- // MainPage.Log($"download headImage error : {ex.Message}");
- // }
- // finally
- // {
- // if (fs != null)
- // {
- // fs.Close();
- // }
- // }
- // // "GesturePwd": null, < !--鎵嬪娍瀵嗙爜-- >
- // // "StringPwd": null , < !--瀛楃涓插瘑鐮�-- >
- // UserInfo.Current.userName = dataStr.GetValue("UserName").ToString();
-
- // Application.RunOnMainThread(() =>
- // {
- // });
-
- // UserInfo.Current.SaveUserInfo();
- // MainPage.Log("鑾峰彇鐢ㄦ埛淇℃伅鎴愬姛銆�");
- //}
-
+ return resultObj.Code;
}
/// <summary>
- /// 涓嬭浇鐢ㄦ埛澶村儚
+ /// 鑾峰彇鐢ㄦ埛澶村儚
/// </summary>
- public byte[] DownHeadImage()
+ /// <param name="userId"></param>
+ public void GetUserHeadImageByKey(string imageKey)
{
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Head_Down, null);
+ var headImageBytes = ImageUtlis.Current.DownHeadImageByImageKey(imageKey);
+
+ if (headImageBytes != null && headImageBytes.Length > 0)
+ {
+ //UserInfo.Current.headImagePageBytes = headImageBytes;
+ UserInfo.Current.headImagePagePath = imageKey;
+ }
}
/// <summary>
@@ -403,19 +389,31 @@
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
}
- /// <summary>
- /// 鏇存柊鐢ㄦ埛澶村儚
- /// </summary>
- /// <param name="vs"></param>
- /// <returns></returns>
- public string UpdataUserHeadImage(string fileName)
- {
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- byte[] bytes = new byte[fs.Length];
- fs.Read(bytes, 0, bytes.Length);
- var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
- return revertObj.Code;
- }
+ ///// <summary>
+ ///// 鏇存柊鐢ㄦ埛澶村儚
+ ///// </summary>
+ ///// <param name="userName"></param>
+ ///// <returns></returns>
+ //public ResponsePackNew UpdateMemberHeadIcon(string memberHeadIcon)
+ //{
+ // var requestJson = HttpUtil.GetSignRequestJson(new UpdateMemberHeadIconRes()
+ // {
+ // memberHeadIcon = memberHeadIcon
+ // });
+ // return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
+ //}
+
+ ///// <summary>
+ ///// 鏇存柊鐢ㄦ埛澶村儚
+ ///// </summary>
+ ///// <param name="vs"></param>
+ ///// <returns></returns>
+ //public string UpdataUserHeadImage(string fileName)
+ //{
+ // byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
+ // var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
+ // return revertObj.Code;
+ //}
/// <summary>
/// 鏇存敼缁戝畾璐︽埛鐨勯偖绠辨垨鑰呮墜鏈哄彿
@@ -462,20 +460,17 @@
/// </summary>
public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL)
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new GetHomeListObj() { homeType = homeType.ToString() });
+ var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() });
var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
if (resultObj.Code == StateCode.SUCCESS)
{
+ UserInfo.Current.regionList = new List<RegionInfoRes>();
var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoResNew>>(resultObj.Data.ToString());
if (homeList == null || homeList.Count == 0)
{
-
-
}
else
{
- UserInfo.Current.regionList = new List<RegionInfoRes>();
-
foreach (var mHome in homeList)
{
var home = new RegionInfoRes()
@@ -485,6 +480,7 @@
IsOthreShare = mHome.IsOtherShare,
accountType = mHome.accountType,
isRemoteControl = mHome.isRemoteControl,
+ isBindGateway = mHome.isBindGateway,
longitude = mHome.longitude,
latitude = mHome.latitude,
deliverstatus = mHome.deliverstatus,
@@ -494,97 +490,60 @@
homeRegionName = mHome.homeRegionName,
homeRegionId = mHome.homeRegionId,
Address = mHome.homeAddress,
+ isAllowCreateScene = mHome.isAllowCreateScene,
};
- if (home.IsOthreShare)
+ if (home.isBindGateway)
{
- continue;
+ UserInfo.Current.regionList.Add(home);
}
- UserInfo.Current.regionList.Add(home);
}
-
- if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
+ if(UserInfo.Current.regionList.Count== 0)
{
- DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ return "null";
}
- DB_ResidenceData.residenceData.SaveResidenceData();
- UserInfo.Current.SaveUserInfo();
+ //-------濡傛灉璐﹀彿鏄娆$櫥褰�
+ if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID))
+ {
+ //鍒锋柊褰撳墠浣忓畢
+ DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
+ DB_ResidenceData.Instance.SaveResidenceData();
+ UserInfo.Current.SaveUserInfo();
+ //鍒锋柊涓�娆′綇瀹呯綉鍏�
+ GetHomeGatewayList();
+ }
+ else
+ {
+ //浣忓畢琚垹闄�
+ var findHome = UserInfo.Current.regionList.Find((obj) => obj.RegionID == DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ if (findHome == null)
+ {
+ Shared.Application.RunOnMainThread(() =>
+ {
+ DB_ResidenceData.Instance.CurrentRegion = UserInfo.Current.regionList[0];
+ GetHomeGatewayList();
+ DB_ResidenceData.Instance.SaveResidenceData();
+ UserInfo.Current.SaveUserInfo();
+ Action action = () =>
+ {
+ MainPage.GoUserPage(true);
+ };
+ new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action);
+ });
+ }
+ else
+ {
+ //鍒锋柊褰撳墠浣忓畢
+ DB_ResidenceData.Instance.CurrentRegion = findHome;
+ DB_ResidenceData.Instance.SaveResidenceData();
+ UserInfo.Current.SaveUserInfo();
+ //鍒锋柊涓�娆′綇瀹呯綉鍏�
+ GetHomeGatewayList();
+ }
+ }
}
-
}
return resultObj.Code;
-
- //string jsonString = "{" +
- // "\"RequestVersion\":" + "\"" + MainPage.VersionString + "\"" + "," +
- // "\"RequestSource\":" + "\"" + "2" + "\"" + "," +
- // "\"HomeType\":" + "\"" + "1" + "\"" + "," +
- // "\"LoginAccessToken\":" + "\"" + UserInfo.Current.loginTokenString + "\"" +
- // "}";
- //var responsePack = RequestHttps($"{severAddress}/App/GetHomePager", jsonString, false);
-
- //if (responsePack.StateCode.ToUpper() == StateCode.SUCCESS_CODE)
- //{
- // var dataStr = JObject.FromObject(responsePack.ResponseData);
- // //娌℃湁浣忓畢
- // if (dataStr.GetValue("PageData").ToString() == "[]")
- // {
-
- // }
- // else
- // {
- // //{
- // // {
- // // "Id": "1107487",
- // // "HomeStatus": 2,
- // // "UserGuid": "22980",
- // // "Name": "鍟�",
- // // "Address": null,
- // // "Longitude": 0.0,
- // // "Latitude": 0.0,
- // // "RegionName": null,
- // // "Company": null,
- // // "ContactPerson": null,
- // // "ContactPersonPhone": null,
- // // "Remarks": null,
- // // "ChangeDate": null,
- // // "AccountType": 0,
- // // "CreatedOnUtc": "2020-05-27T06:52:03",
- // // "IsOthreShare": false,
- // // "MainUserDistributedMark": null,
- // // "HomeGateways": [
- // // {
- // // "GatewayUniqueId": "4E47323347591243"
- // // }
- // // ]
- // //}}
- // UserInfo.Current.regionList = new List<RegionInfoRes>();
- // foreach (var jsonData in dataStr.GetValue("PageData"))
- // {
- // var homeJsonStr = JObject.FromObject(jsonData);
- // var home = new RegionInfoRes()
- // {
- // RegionID = homeJsonStr.GetValue("Id").ToString(),
- // RegionName = homeJsonStr.GetValue("RegionName").ToString(),
- // Name = homeJsonStr.GetValue("Name").ToString(),
- // Address = homeJsonStr.GetValue("Address").ToString(),
- // IsOthreShare = (bool)homeJsonStr.GetValue("IsOthreShare"),
- // homeGateways = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGateways>>(homeJsonStr.GetValue("HomeGateways").ToString()),
- // };
- // if (home.IsOthreShare)
- // {
- // continue;
- // }
- // UserInfo.Current.regionList.Add(home);
- // if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
- // {
- // DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
- // }
- // }
- // DB_ResidenceData.residenceData.SaveResidenceData();
- // UserInfo.Current.SaveUserInfo();
- // }
- //}
- //return responsePack.StateCode;
}
/// <summary>
@@ -597,7 +556,7 @@
{
var requestObj = new AddOrUpdateHomeObj()
{
- homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
+ homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
};
if (editId == 0)
@@ -609,48 +568,73 @@
requestObj.Address = editName;
}
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+ var requestJson = HttpUtil.GetSignRequestJson(requestObj);
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_UpdateHome, requestJson);
}
/// <summary>
- /// 鑾峰彇鍒锋柊褰撳墠浣忓畢缃戝叧鎺ュ彛
+ /// 鑾峰彇鍒锋柊褰撳墠浣忓畢鐨勭綉鍏冲垪琛�
/// </summary>
- public void GetHomeGatewayList()
+ public string GetHomeGatewayList()
{
- if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.residecenInfo.RegionID)) return;
- var nowhomeId = DB_ResidenceData.residenceData.residecenInfo.RegionID;
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new HomeIdObj() { homeId = nowhomeId });
- var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson);
- if (revertObj.Code == StateCode.SUCCESS)
+ try
{
- var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGatewayInfo>>(revertObj.Data.ToString());
- if (nowhomeId == DB_ResidenceData.residenceData.residecenInfo.RegionID)
+ if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return "";
+ var nowhomeId = DB_ResidenceData.Instance.CurrentRegion.RegionID;
+ var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = nowhomeId });
+ var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson);
+ if (revertObj.Code == StateCode.SUCCESS)
{
- if (mHomeGatewayRes != null)
+ var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGatewayInfo>>(revertObj.Data.ToString());
+ if (nowhomeId == DB_ResidenceData.Instance.CurrentRegion.RegionID)
{
- if (mHomeGatewayRes.Count > 0)
+ if (mHomeGatewayRes != null)
{
- DB_ResidenceData.residenceData.residenceGatewayMAC = mHomeGatewayRes[0].mac;
+ if (mHomeGatewayRes.Count > 0)
+ {
+ DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
+ DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
+ DB_ResidenceData.Instance.SaveResidenceData();
+ return revertObj.Code;
+ }
}
- else
- {
- DB_ResidenceData.residenceData.residenceGatewayMAC = "";
-
- }
- DB_ResidenceData.residenceData.SaveResidenceData();
- }
-
- if (mHomeGatewayRes != null)
- {
- //Utlis.WriteLine ("鑾峰緱褰撳墠浣忓畢缃戝叧涓暟锛�" + mHomeGatewayRes.content.Count);
+ //鍏朵綑鎯呭喌娓呯┖缃戝叧淇℃伅
+ DB_ResidenceData.Instance.HomeGateway = null;
+ DB_ResidenceData.Instance.SaveResidenceData();
}
}
+ else
+ {
+ //鎻愮ず閿欒
+ }
+ return revertObj.Code;
}
- else
+ catch
{
- //鎻愮ず閿欒
+ return "";
}
+ }
+ /// <summary>
+ /// 鑾峰彇缃戝叧淇℃伅
+ /// </summary>
+ public string GetGatewayInfo()
+ {
+ if (DB_ResidenceData.Instance.HomeGateway == null)
+ return StateCode.NETWORK_ERROR;
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);
+ var jsonString = HttpUtil.GetSignRequestJson(d);
+ var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGatewayInfo, jsonString);
+ if (revertObj.Code == StateCode.SUCCESS)
+ {
+ var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString());
+ if (mHomeGatewayRes != null)
+ {
+ DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
+ }
+ }
+ return revertObj.Code;
}
/// <summary>
@@ -659,7 +643,7 @@
/// <returns></returns>
public ResponsePackNew GetResidenceMemberAccount()
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new HomeIdObj() { homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID });
+ var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID });
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_FindAll, requestJson);
}
@@ -674,7 +658,7 @@
childAccountId = subaccount.childAccountId,
homeId = subaccount.homeId
};
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+ var requestJson = HttpUtil.GetSignRequestJson(requestObj);
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Delete, requestJson);
}
@@ -686,9 +670,9 @@
/// <returns></returns>
public ResponsePackNew EditSubAccountNickName(string nickName, string childAccountId)
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new UpdateChildNickNameObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildNickNameObj()
{
- homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
+ homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
childAccountId = childAccountId,
nickName = nickName,
});
@@ -703,124 +687,166 @@
/// <returns></returns>
public ResponsePackNew ChangeCreateSceneState(bool isAllow, string childAccountId)
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new UpdateChildAllowCreateSceneObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new UpdateChildAllowCreateSceneObj()
{
- homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
+ homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
childAccountId = childAccountId,
isAllowCreateScene = isAllow,
});
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
}
+ #region 鏂版暟鎹垎浜�
/// <summary>
- /// 鑾峰彇浣忓畢涓嬪瓙璐﹀彿鐨勫叡浜暟鎹垪琛�
+ /// 娣诲姞鍒嗕韩
/// </summary>
+ /// <param name="addShareObj"></param>
+ /// <returns></returns>
+ public ResponsePackNew AddShareData(AddShareObj addShareObj)
+ {
+ var requestJson = HttpUtil.GetSignRequestJson(addShareObj);
+
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_Add, requestJson);
+ }
+
+ /// <summary>
+ /// 鍒犻櫎鍒嗕韩
+ /// </summary>
+ /// <param name="deleteShareObj"></param>
+ /// <returns></returns>
+ public ResponsePackNew DeleteShareData(DeleteShareObj deleteShareObj)
+ {
+ var requestJson = HttpUtil.GetSignRequestJson(deleteShareObj);
+
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_Delete, requestJson);
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍒嗕韩
+ /// </summary>
+ /// <param name="addShareObj"></param>
/// <returns></returns>
public ResponsePackNew GetShareDataByMemberAccount(string childAccountId)
{
- //Dictionary<string, object> d = new Dictionary<string, object>();
- //d.Add("DistributedMark", memberId);
- //d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetShareDataBySubAccount", jsonString, true);
-
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new HomeShareFindAll()
+ var requestJson = HttpUtil.GetSignRequestJson(new GetShareObj()
{
- homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
- childAccountId = childAccountId
+ homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID,
+ childAccountId = childAccountId,
});
- return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_FindAll, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson);
}
+ #endregion
- /// <summary>
- /// 涓嬭浇鍗曚釜鍒嗕韩鏂囦欢
- /// </summary>
- /// <returns></returns>
- public byte[] GetShareData(ShareData shareData)
- {
- //Dictionary<string, object> d = new Dictionary<string, object>();
- //d.Add("DistributedMark", memberId);
- //d.Add("HouseDistributedMark", hId);
- //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetOneShareData", jsonString, true);
+ ///// <summary>
+ ///// 鑾峰彇浣忓畢涓嬪瓙璐﹀彿鐨勫叡浜暟鎹垪琛�
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePackNew GetShareDataByMemberAccount(string childAccountId)
+ //{
+ // //Dictionary<string, object> d = new Dictionary<string, object>();
+ // //d.Add("DistributedMark", memberId);
+ // //d.Add("HouseDistributedMark", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ // //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetShareDataBySubAccount", jsonString, true);
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new ShareFileDownObj()
- {
- homeId = shareData.homeId,
- homeShareId = shareData.id
- });
- var replaceToken = "";
- if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
- {
- replaceToken = DB_ResidenceData.residenceData.MasterToken;
- }
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Home_Share_DownOne, requestJson, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
+ // var requestJson = HttpUtil.GetSignRequestJson(new HomeShareFindAll()
+ // {
+ // homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID,
+ // childAccountId = childAccountId
+ // });
+ // return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_FindAll, requestJson);
- }
+ //}
- /// <summary>
- /// 澧炲姞鍏变韩鏁版嵁鍒楄〃
- /// </summary>
- /// <returns></returns>
- public ResponsePackNew AddShareData(ShareData shareData)
- {
- //Dictionary<string, object> d = new Dictionary<string, object>();
- //d.Add("ShareName", shareData.ShareName);
- //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
- //d.Add("ShareDataBytes", shareData.ShareDataBytes);
- //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
- //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //return RequestHttps($"{severAddress}/ZigbeeDataShare/AddShareData", jsonString, true);
+ ///// <summary>
+ ///// 涓嬭浇鍗曚釜鍒嗕韩鏂囦欢
+ ///// </summary>
+ ///// <returns></returns>
+ //public byte[] GetShareData(ShareData shareData)
+ //{
+ // //Dictionary<string, object> d = new Dictionary<string, object>();
+ // //d.Add("DistributedMark", memberId);
+ // //d.Add("HouseDistributedMark", hId);
+ // //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // //return RequestHttps($"{severAddress}/ZigbeeDataShare/GetOneShareData", jsonString, true);
- var queryDic = new Dictionary<string, object>();
- queryDic.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- queryDic.Add("childAccountId", shareData.childAccountId);
- queryDic.Add("fileName", shareData.fileName);
- var replaceToken = "";
- if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
- {
- replaceToken = DB_ResidenceData.residenceData.MasterToken;
- }
- return HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Home_Share_Add, shareData.ShareDataBytes, queryDic, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
- }
+ // var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new ShareFileDownObj()
+ // {
+ // homeId = shareData.homeId,
+ // homeShareId = shareData.id
+ // });
+ // var replaceToken = "";
+ // if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
+ // {
+ // replaceToken = DB_ResidenceData.residenceData.MasterToken;
+ // }
+ // return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Home_Share_DownOne, requestJson, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
- /// <summary>
- /// 澧炲姞鍏变韩鏁版嵁
- /// </summary>
- /// <returns></returns>
- public ResponsePackNew EditShareData(ShareData shareData)
- {
- return AddShareData(shareData);
- //Dictionary<string, object> d = new Dictionary<string, object>();
- //d.Add("DistributedMark", shareData.DistributedMark);
- //d.Add("ShareName", shareData.ShareName);
- //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
- //d.Add("ShareDataBytes", shareData.ShareDataBytes);
- //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
- //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //return RequestHttps($"{severAddress}/ZigbeeDataShare/EditShareData", jsonString, true);
- }
+ //}
- /// <summary>
- /// 鍒犻櫎鍏变韩鏁版嵁
- /// </summary>
- /// <param name="shareData"></param>
- /// <returns></returns>
- public ResponsePackNew DeleteShareData(ShareData shareData)
- {
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new ShareFileDownObj()
- {
- homeId = shareData.homeId,
- homeShareId = shareData.id
- });
- return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_Delete, requestJson);
- //Dictionary<string, string> d = new Dictionary<string, string>();
- //d.Add("DistributedMark", shareData.DistributedMark);
- //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
- //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- //return RequestHttps($"{severAddress}/ZigbeeDataShare/DeleteShareData", jsonString, true);
- }
+ ///// <summary>
+ ///// 澧炲姞鍏变韩鏁版嵁鍒楄〃
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePackNew AddShareData(ShareData shareData)
+ //{
+ // //Dictionary<string, object> d = new Dictionary<string, object>();
+ // //d.Add("ShareName", shareData.ShareName);
+ // //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+ // //d.Add("ShareDataBytes", shareData.ShareDataBytes);
+ // //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
+ // //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // //return RequestHttps($"{severAddress}/ZigbeeDataShare/AddShareData", jsonString, true);
+
+ // var queryDic = new Dictionary<string, object>();
+ // queryDic.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ // queryDic.Add("childAccountId", shareData.childAccountId);
+ // queryDic.Add("fileName", shareData.fileName);
+ // var replaceToken = "";
+ // if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
+ // {
+ // replaceToken = DB_ResidenceData.residenceData.MasterToken;
+ // }
+ // return HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Home_Share_Add, shareData.ShareDataBytes, queryDic, null, DB_ResidenceData.residenceData.residecenInfo.regionUrl, replaceToken);
+ //}
+
+ ///// <summary>
+ ///// 澧炲姞鍏变韩鏁版嵁
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePackNew EditShareData(ShareData shareData)
+ //{
+ // return AddShareData(shareData);
+ // //Dictionary<string, object> d = new Dictionary<string, object>();
+ // //d.Add("DistributedMark", shareData.DistributedMark);
+ // //d.Add("ShareName", shareData.ShareName);
+ // //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+ // //d.Add("ShareDataBytes", shareData.ShareDataBytes);
+ // //d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark);
+ // //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // //return RequestHttps($"{severAddress}/ZigbeeDataShare/EditShareData", jsonString, true);
+ //}
+
+ ///// <summary>
+ ///// 鍒犻櫎鍏变韩鏁版嵁
+ ///// </summary>
+ ///// <param name="shareData"></param>
+ ///// <returns></returns>
+ //public ResponsePackNew DeleteShareData(ShareData shareData)
+ //{
+ // var requestJson = HttpUtil.GetSignRequestJson(new ShareFileDownObj()
+ // {
+ // homeId = shareData.homeId,
+ // homeShareId = shareData.id
+ // });
+ // return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Home_Share_Delete, requestJson);
+ // //Dictionary<string, string> d = new Dictionary<string, string>();
+ // //d.Add("DistributedMark", shareData.DistributedMark);
+ // //d.Add("HouseDistributedMark", shareData.HouseDistributedMark);
+ // //string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // //return RequestHttps($"{severAddress}/ZigbeeDataShare/DeleteShareData", jsonString, true);
+ //}
///// <summary>
///// 鍒犻櫎瀛愯处鍙峰綋鍓嶄綇瀹呯殑鎵�鏈夊叡浜暟鎹�
///// </summary>
@@ -843,44 +869,25 @@
public ResponsePackNew BindResidenceMemberAccount(string subAccount, string nickName)
{
//娣诲姞瀛愯处鍙�
- var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.residenceData.residecenInfo.RegionID, account = subAccount, nickName = nickName };
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+ var requestObj = new ChildAddObj() { homeId = DB_ResidenceData.Instance.CurrentRegion.RegionID, account = subAccount, nickName = nickName };
+ var requestJson = HttpUtil.GetSignRequestJson(requestObj);
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Add, requestJson);
}
- /// <summary>
- /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
- /// </summary>
- /// <returns></returns>
- public ResponsePack GetResidenceMemberAccountInfo(string account)
- {
- Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("Account", account);
- string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
- }
+ ///// <summary>
+ ///// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePack GetResidenceMemberAccountInfo(string account)
+ //{
+ // Dictionary<string, object> d = new Dictionary<string, object>();
+ // d.Add("Account", account);
+ // string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
+ //}
- /// <summary>
- /// 涓嬭浇瀛愯处鍙风敤鎴峰ご鍍�
- /// </summary>
- /// <param name="subaccoun"></param>
- /// <returns></returns>
- public byte[] DownChildHeadImage(ResidenceMemberInfo subaccount)
- {
- var requestObj = new ChildBaseObj()
- {
- childAccountId = subaccount.childAccountId,
- homeId = subaccount.homeId
- };
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
- var replaceToken = "";
- if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
- {
- replaceToken = DB_ResidenceData.residenceData.MasterToken;
- }
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Child_DownloadHeadImage, requestJson,null);
- }
+
#endregion
@@ -891,12 +898,12 @@
{
try
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new GetMqttRemoteInfoObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new GetMqttRemoteInfoObj()
{
attachClientId = attachClientId,
homeType = HomeTypeEnum.BUSPRO.ToString()
});
- var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetMqttRemoteInfo, requestJson, DB_ResidenceData.residenceData.residecenInfo.regionUrl);
+ var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetMqttRemoteInfo, requestJson, DB_ResidenceData.Instance.CurrentRegion.regionUrl);
if (revertObj.Code == StateCode.SUCCESS)
{
return Newtonsoft.Json.JsonConvert.DeserializeObject<MqttInfo>(revertObj.Data.ToString());
@@ -925,13 +932,16 @@
#if __IOS__
deviceType = PhoneDeviceType.IOS.ToString();
#endif
- //鏄惁鐢熸垚妯″紡
+ //鏄惁鐢熶骇妯″紡
bool isProduce = true;
#if DEBUG
isProduce = false;
#endif
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) return false;
+ if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) {
+ Utlis.WriteLine("PushDeviceToken 涓虹┖");
+ return false;
+ }
var mAddpushinfoObj = new AddpushinfoObj()
{
@@ -939,9 +949,10 @@
deviceName = OnAppConfig.Instance.PhoneName,
deviceType = deviceType,
produce = isProduce,
-
};
- var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj);
+
+ //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj);
+ var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj);
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_AddToken, mAddpushinfoJson);
if (revertObj.Code == StateCode.SUCCESS)
{
@@ -951,15 +962,17 @@
if (!string.IsNullOrEmpty(pushId))
{
OnAppConfig.Instance.PushId = pushId;
- OnAppConfig.Instance.SaveUserConfig();
+ OnAppConfig.Instance.SaveConfig();
+ Utlis.WriteLine("PushId: " + pushId);
+
return true;
}
}
- Utlis.WriteLine("AddToken 鎴愬姛");
+
}
else
{
- Utlis.WriteLine("AddToken 澶辫触");
+ //Utlis.WriteLine("AddToken 澶辫触");
}
return false;
}
@@ -969,15 +982,33 @@
}
}
+
/// <summary>
/// 鏌ヨ鎺ㄩ�佷俊鎭垪琛�
/// </summary>
+ /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅</param>
/// <returns></returns>
- public ResponsePackNew PushSerivceGetpushmessagelist()
+ public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0)
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new GetMessageListObj()
+ string pushType = null;
+
+ if (queryType == 1)
{
- pushId = OnAppConfig.Instance.PushId
+ pushType = PushType.Default.ToString();
+ }
+ else if (queryType == 2)
+ {
+ pushType = PushType.Alarm.ToString();
+ }
+ else if (queryType == 3)
+ {
+ pushType = PushType.Prompt.ToString();
+ }
+
+ var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
+ {
+ pushId = OnAppConfig.Instance.PushId,
+ pushType = pushType
});
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson);
}
@@ -990,7 +1021,7 @@
{
if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new PushIdObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
pushId = OnAppConfig.Instance.PushId
});
@@ -1016,7 +1047,7 @@
if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
try
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new PushIdObj() {
+ var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() {
pushId = OnAppConfig.Instance.PushId
});
@@ -1048,7 +1079,7 @@
try
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new PushIdObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
pushId = OnAppConfig.Instance.PushId
});
@@ -1080,7 +1111,7 @@
try
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new PushMsgIdObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj()
{
msgId = msgId
});
@@ -1113,7 +1144,7 @@
try
{
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(new PushMsgIdObj()
+ var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj()
{
msgId = msgId
});
@@ -1125,7 +1156,7 @@
}
else
{
-
+ IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code);
}
return false;
}
@@ -1134,6 +1165,47 @@
return false;
}
}
+
+ /// <summary>
+ /// 娉ㄥ唽鎺ㄩ��
+ /// </summary>
+ public void RegisteredPush()
+ {
+ new System.Threading.Thread(() =>
+ {
+ var success = PushSerivceAddPushInfo();
+ if (success)
+ {
+ Utlis.WriteLine("鎺ㄩ�佹敞鍐屾垚鍔�");
+ }
+ else
+ {
+ Utlis.WriteLine("鎺ㄩ�佹敞鍐屽け璐�");
+ }
+ })
+ { IsBackground = true }.Start();
+ }
+
+ /// <summary>
+ /// 娉ㄩ攢鎺ㄩ��
+ /// </summary>
+ public void SignOutPush()
+ {
+ new System.Threading.Thread(() =>
+ {
+ var success = PushSerivceSignOut();
+ if (success)
+ {
+ Utlis.WriteLine("鎺ㄩ�佹敞閿�鎴愬姛");
+ }
+ else
+ {
+ Utlis.WriteLine("鎺ㄩ�佹敞閿�澶辫触");
+ }
+ })
+ { IsBackground = true }.Start();
+ }
+
#endregion
#region 妫�娴嬫洿鏂�
@@ -1143,33 +1215,16 @@
/// <returns></returns>
public ResponsePackNew CheckAppVersion()
{
- var requestObj = new ForceUpdateObj()
+ var requestObj = new AppVersionCheckObj()
{
};
-#if Android
- requestObj.DeviceType = 1;
-#endif
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+
+ var requestJson = HttpUtil.GetSignRequestJson(requestObj);
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_CheckAppVersion, requestJson);
}
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ResponsePackNew GetAppVersion()
- {
- var requestObj = new ForceUpdateObj()
- {
- };
-#if Android
- requestObj.DeviceType = 1;
-#endif
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
- return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetAppVersion, requestJson);
- }
#endregion
@@ -1240,52 +1295,6 @@
#endregion
- #region mqtt杩滅▼杩炴帴锛堟棫锛�
- /// <summary>
- /// 璇锋眰Mqtt鏁版嵁
- /// </summary>
- /// <param name="dataStringJson">璇锋眰鐨勫弬鏁�.</param>
- public ResponsePack RequestMqttInfo(string dataStringJson)
- {
- ResponsePack revertObj = null;
-
- var webClient = new WebClient();
- #region
- webClient.Headers.Add("CONTENT-TYPE", "application/json");
- var url = "https://global.hdlcontrol.com/ProposedProductionApi/EmqMqtt/GetConnMqttInfo";
-
- byte[] bytes = null;
- try
- {
- bytes = webClient.UploadData(url, Encoding.UTF8.GetBytes(dataStringJson));
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.Message);
- revertObj = new ResponsePack() { StateCode = "Net_Error" };
- }
-
- string responseString = null;
- if (bytes != null)
- {
- responseString = Encoding.UTF8.GetString(bytes);
- }
-
- if (responseString != null)
- {
- try
- {
- revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString);
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- }
- return revertObj;
- #endregion
- }
- #endregion
#region 澶囦唤閮ㄥ垎
///// <summary>
@@ -1761,5 +1770,481 @@
#endregion
+ #region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��
+ /// <summary>
+ /// 鑾峰彇璁惧鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew GetDeviceList()
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);
+ //d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//鍙帶鍙傛暟锛屽綋闇�瑕佸垎椤佃幏鍙栵紝鎬庝箞鐭ラ亾鍒嗛〉鎬绘暟
+ //d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ //d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ //d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
+ }
+ /// <summary>
+ /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑缁戝畾杩囩殑璁惧鍒楄〃
+ /// </summary>
+ /// <param name="productPlatform"></param>
+ /// <param name="productBrand"></param>
+ /// <returns></returns>
+ public ResponsePackNew Get3TyBrandBindDeviceList(string productPlatform, string productBrand)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("productPlatform", productPlatform);
+ d.Add("productBrand", productBrand);
+ d.Add("networkConfig", true);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
+ }
+ /// <summary>
+ /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑璁惧鍒楄〃
+ /// </summary>
+ /// <param name="productPlatform"></param>
+ /// <param name="productBrand"></param>
+ /// <returns></returns>
+ public ResponsePackNew Get3TyBrandDeviceList(string productPlatform,string productBrand)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("categoryType", 1);
+ d.Add("productPlatform", productPlatform);
+ d.Add("productBrand", productBrand);
+ d.Add("networkConfig", true);
+
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson);
+ }
+
+ /// <summary>
+ /// 鑾峰彇璁惧璇︽儏
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew GetDeviceInfo(string functionId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", new List<string>() { functionId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
+ }
+
+ /// <summary>
+ /// 鑾峰彇璁惧璇︽儏鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew GetDeviceInfoList(List<string> functionIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", functionIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
+ }
+ /// <summary>
+ /// 鍒锋柊璁惧鐘舵��
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew RefreshDeviceStatus(List<string> functionIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", functionIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ MainPage.Log($"璇诲彇璁惧鐘舵�侊細{requestJson}");
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_RefreshDeviceStatus, requestJson);
+ }
+
+ /// <summary>
+ /// 鎺у埗璁惧
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew ControlDevice(List<ApiAlinkControlActionObj> actionObjs)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway == null ? "0" : DB_ResidenceData.Instance.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId);
+ d.Add("actions", actionObjs);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ MainPage.Log($"{requestJson}");
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson);
+ }
+ /// <summary>
+ /// 缂栬緫璁惧淇℃伅
+ /// 缁戝畾鍏崇郴銆佸悕绉般�佹敹钘�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew UpdataDevcieInfo(Function function)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceId", function.deviceId);
+ d.Add("name", function.name);
+ d.Add("collect", function.collect);
+ d.Add("roomIds", function.roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+ }
+ /// <summary>
+ /// 鏇存柊璁惧缁戝畾鎴块棿淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew UpdataDevcieBindRoomInfo(Function function)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceId", function.deviceId);
+ d.Add("roomIds", function.roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+ }
+
+
+ /// <summary>
+ /// 璁惧缁戝畾鎴块棿
+ /// </summary>
+ public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", deviceIds);
+ d.Add("roomIds", roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_BindDeviceToRoom, requestJson);
+ }
+ /// <summary>
+ /// 璁惧瑙g粦鎴块棿
+ /// </summary>
+ public string UnbindDeviceToRoom(string deviceId, string roomId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", new List<string>() { deviceId });
+ d.Add("roomIds", new List<string>() { roomId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UnbindDeviceToRoom, requestJson).Code;
+ }
+ /// <summary>
+ /// 璁惧鍚嶇О淇敼
+ /// </summary>
+ public string EditDeviceName(string deviceId, string deviceName)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceId", deviceId);
+ d.Add("name", deviceName);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDeviceName, requestJson).Code;
+ }
+ /// <summary>
+ /// 鏀惰棌璁惧
+ /// </summary>
+ public ResponsePackNew CollectDevice(string deviceId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds",new List<string>() { deviceId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectDevice, requestJson);
+ }
+ /// <summary>
+ /// 鍙栨秷鏀惰棌璁惧
+ /// </summary>
+ public ResponsePackNew CancelCollectDevice(string deviceId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("deviceIds", new List<string>() { deviceId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson);
+ }
+
+ #endregion
+
+ #region Kaede --鍦烘櫙鍔熻兘--------------------------
+ /// <summary>
+ /// 鑾峰彇鍦烘櫙鍒楄〃
+ /// 鎴块棿ID鍙┖锛岄粯璁ゆ煡璇綇瀹呬笅鎵�鏈夋埧闂�
+ /// </summary>
+ /// <param name="roomId">鎴块棿ID</param>
+ /// <returns></returns>
+ public ResponsePackNew GetSceneList(string roomId = null)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ if (roomId != null)
+ {
+ d.Add("roomId", roomId);
+ }
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
+ }
+ /// <summary>
+ /// 鑾峰彇鍦烘櫙璇︽儏
+ /// </summary>
+ /// <param name="seceneId">鍦烘櫙ID</param>
+ /// <returns></returns>
+ public ResponsePackNew GetSceneInfo(string seceneId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("userSceneIds",new List<string>() { seceneId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
+ }
+
+ /// <summary>
+ /// 鑾峰彇鍦烘櫙璇︽儏鍒楄〃
+ /// </summary>
+ /// <param name="seceneId">鍦烘櫙ID</param>
+ /// <returns></returns>
+ public ResponsePackNew GetSceneListInfo(List<string> seceneIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("userSceneIds", seceneIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
+ }
+
+ /// <summary>
+ /// 娣诲姞鍦烘櫙
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew AddScene(Scene scene)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("scenes", new List<Scene>() { scene });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson);
+
+ MainPage.Log($"{pack.Data}");
+
+ return pack;
+ }
+ /// <summary>
+ /// 缂栬緫鍦烘櫙
+ /// </summary>
+ /// <param name="scene"></param>
+ /// <returns></returns>
+ public ResponsePackNew EditScene(Scene scene)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("scenes", new List<Scene>() { scene });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditSecne, requestJson);
+ }
+ /// <summary>
+ /// 鍒犻櫎鍦烘櫙
+ /// </summary>
+ /// <returns></returns>
+ public string DeleteScene(string userSceneId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("userSceneIds", new List<string>() { userSceneId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteSecne, requestJson).Code;
+ }
+ /// <summary>
+ /// 鎵ц鍦烘櫙
+ /// </summary>
+ /// <returns></returns>
+ public string ExecuteScene(string userSceneId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("userSceneIds", new List<string>() { userSceneId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ExecuteSecne, requestJson).Code;
+ }
+ /// <summary>
+ /// 鏀惰棌鍦烘櫙
+ /// </summary>
+ /// <param name="userSceneId"></param>
+ /// <returns></returns>
+ public string CollectScene(string userSceneId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("userSceneIds", new List<string>() { userSceneId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectScene, requestJson).Code;
+ }
+ /// <summary>
+ /// 鍙栨秷鏀惰棌鍦烘櫙
+ /// </summary>
+ /// <param name="userSceneId"></param>
+ /// <returns></returns>
+ public string CancelCollectScene(string userSceneId)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("userSceneIds", new List<string>() { userSceneId });
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
+ }
+ #endregion
+
+ #region Kaede --鎴块棿鍔熻兘--------------------------
+ /// <summary>
+ /// 鑾峰彇鎴块棿鍒楄〃
+ /// </summary>
+ /// <param name="GetType">鑾峰彇绫诲瀷锛歊OOM\FLOOR;涓嶈緭鍏ヨ繑鍥炲叏閮�</param>
+ /// <returns></returns>
+ public ResponsePackNew GetRoomList(string GetType = "All")
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ if (GetType != "All")
+ {
+ d.Add("roomType", GetType);
+ }
+ d.Add("pageSize", "1000");
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson);
+
+ return pack;
+ }
+ /// <summary>
+ /// 娣诲姞鎴块棿\妤煎眰
+ /// 妤煎眰涔熷睘浜庢埧闂�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew AddRoom(List<SpatialInfo> rooms)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("rooms", rooms);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddRoom, requestJson);
+ //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+ //if (revData != null)
+ //{
+ // SpatialInfo.CurrentSpatial.UpdateSpatialList(revData, OptionType.Update);
+ //}
+ return pack;
+ }
+ /// <summary>
+ /// 淇敼鎴块棿淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew UpdateRoom(List<SpatialInfo> rooms)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("rooms", rooms);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UpdateRoom, requestJson);
+ //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+ //if (revData != null)
+ //{
+ // SpatialInfo.CurrentSpatial.UpdateSpatialList(revData,OptionType.Update);
+ //}
+ return pack;
+ }
+ /// <summary>
+ /// 鍒犻櫎鎴块棿
+ /// </summary>
+ /// <param name="roomIds"></param>
+ /// <returns></returns>
+ public ResponsePackNew DeleteRoom(List<string> roomIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ d.Add("ids", roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DelRoom, requestJson);
+ return pack;
+ }
+
+ #endregion
+
+
+ #region Kaede --鎴块棿鍔熻兘--------------------------
+ /// <summary>
+ /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛�
+ /// </summary>
+ public ResponsePackNew Get3tyBrandList()
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList, requestJson);
+
+ return pack;
+ }
+ /// <summary>
+ /// 鑾峰彇缁戝畾鐨勭涓夋柟鍝佺墝鍒楄〃
+ /// </summary>
+ public ResponsePackNew Get3tyBindBrandList()
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBindBrandList, requestJson);
+
+ return pack;
+ }
+
+ #endregion
+
+ #region 钀ょ煶浜慡DK鐩稿叧鎺ュ彛
+ /// <summary>
+ /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙�
+ /// </summary>
+ public ResponsePackNew EZGetChildToken()
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson);
+ }
+ #endregion
+
+
+ #region 鍙瀵硅
+ /// <summary>
+ /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew CheckFlVideo()
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson);
+ return pack;
+ }
+ #endregion
}
}
\ No newline at end of file
--
Gitblit v1.8.0