| | |
| | | /// 绑定调试人员提交的住宅,一个住宅只能绑定一次 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew BindingResidence(string key) |
| | | public ResponsePackNew BindingResidence(string strUrl) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | //d.Add("homeId", homeId); |
| | | d.Add("secretKey", key); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindlingResidence, requestJson, HttpUtil.GlobalRequestHttpsHost); |
| | | try |
| | | { |
| | | if (strUrl.Contains("app/home/deliver") == false) |
| | | { |
| | | //非法的URL 返回一个自定义的状态码 |
| | | 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> |
| | | /// 通用 发送验证码方法 |
| | |
| | | homeRegionName = mHome.homeRegionName, |
| | | homeRegionId = mHome.homeRegionId, |
| | | Address = mHome.homeAddress, |
| | | isAllowCreateScene = mHome.isAllowCreateScene, |
| | | }; |
| | | UserInfo.Current.regionList.Add(home); |
| | | } |
| | |
| | | if (mHomeGatewayRes.Count > 0) |
| | | { |
| | | DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0]; |
| | | if(mHomeGatewayRes[0].gatewayStatus == "ON_LINE") |
| | | if(mHomeGatewayRes[0].gatewayStatus) |
| | | { |
| | | DriverLayer.Control.Ins.IsRemote = true; |
| | | //DriverLayer.Control.Ins.IsRemote = true; |
| | | DriverLayer.Control.Ins.GatewayOnline = true; |
| | | } |
| | | else |
| | | { |
| | | DriverLayer.Control.Ins.GatewayOnline = false; |
| | | } |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | return; |
| | |
| | | d.Add("userSceneIds",new List<string>() { seceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson); |
| | | } |
| | | /// <summary> |
| | | /// 添加场景 |
| | |
| | | d.Add("scenes", new List<Scene>() { scene }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson); |
| | | |
| | | MainPage.Log($"{pack.Data}"); |
| | | |
| | | return pack; |
| | | } |
| | | /// <summary> |
| | | /// 编辑场景 |
| | |
| | | { |
| | | d.Add("roomType", GetType); |
| | | } |
| | | d.Add("pageSize", "1000"); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson); |
| | | |