| | |
| | | |
| | | public HttpServerRequest() |
| | | { |
| | | #if DEBUG |
| | | #if DEBUG1 |
| | | severAddress = debugSever; |
| | | #else |
| | | severAddress = relaseaSever; |
| | | #endif |
| | | } |
| | | |
| | | /// <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> |
| | | /// <returns></returns> |
| | | public ResponsePack GetSensorHistory(int subnetId,int deviceId,int bigClass,int minClass,int queryType,int loopId,int nowMonth,string mac) |
| | | { |
| | | 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); |
| | | |
| | | } |
| | | |
| | | public string GetRequestResultMsg(string resultCode) |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | #region 注册、登录部分 |
| | |
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Password\":" + "\"" + password + "\"" + "," + |
| | | "\"EnterPassword\":" + "\"" + entryPassword + "\"" + "," + |
| | | "\"Language\":" + "\"" + MainPage.LoginUser.language.ToLower() + "\"" + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage.ToLower() + "\"" + "," + |
| | | "\"Code\":" + "\"" + code + "\"" + "," + |
| | | "\"RegisterSoruce\":" + 0 + "," + |
| | | "\"AreaCode\":" + areaCode + |
| | |
| | | /// <summary> |
| | | /// 获取注册验证码 |
| | | /// </summary> |
| | | public ResponsePack GetPhoneRegisterVerCode(string account) |
| | | public ResponsePack GetRegisterVerCode(string account) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Company\":" + MainPage.Company + "," + |
| | | "\"Language\":" + "\"" + MainPage.LoginUser.language.ToLower() + "\"" + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage.ToLower() + "\"" + "," + |
| | | "\"AreaCode\":" + OnAppConfig.Instance.CountryNumber + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/RegisterSendVerCode", jsonString, false); |
| | |
| | | /// <summary> |
| | | /// 获取登录验证码 |
| | | /// </summary> |
| | | /// <param name="phoneNum">手机号码</param> |
| | | public ResponsePack GetPhoneLoginVerCode(string phoneNum) |
| | | public ResponsePack GetLoginVerCode(string account) |
| | | { |
| | | |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + phoneNum + "\"" + "," + |
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"AreaCode\":" + "86" + |
| | | "}"; |
| | | return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | |
| | | try |
| | | { |
| | | var headImageString = dataStr.GetValue("HeadImage").ToString(); |
| | | var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); |
| | | var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); |
| | | MainPage.LoginUser.headImagePageBytes = headImageBytes; |
| | | var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png"); |
| | | |
| | | #if DEBUG |
| | | Application.RunOnMainThread(() => |
| | | if (!string.IsNullOrEmpty(headImageString)) |
| | | { |
| | | new Tip() { CloseTime = 5, Text = filePath }.Show(MainPage.BasePageView); |
| | | }); |
| | | #endif |
| | | fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); |
| | | fs.Write(headImageBytes, 0, headImageBytes.Length); |
| | | fs.Flush(); |
| | | MainPage.LoginUser.headImagePagePath = filePath; |
| | | var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); |
| | | var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); |
| | | 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}"); |
| | |
| | | |
| | | var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/UpdateHeadImage", requestJson, true); |
| | | return revertObj.StateCode; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更改绑定账户的邮箱或者手机号 |
| | | /// </summary> |
| | | /// <param name="account"></param> |
| | | /// <returns></returns> |
| | | public string BindAccount(string account) |
| | | { |
| | | string jsonString = "{" + "\"Account\":" + "\"" + account + "\"" + "}"; |
| | | var responsePack = RequestHttps($"{severAddress}/ZigbeeUsers/BindAccount", jsonString, true); |
| | | return responsePack.StateCode; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 删除共享数据 |
| | | /// </summary> |
| | | /// <param name="shareData"></param> |
| | | /// <returns></returns> |
| | | public ResponsePack DeleteShareData(ShareData shareData) |
| | | { |
| | | 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 ResponsePack DeleteCurrentResidenceSharedData(ShareData shareData) |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add("SubAccountDistributedMark", shareData.SubAccountDistributedMark); |
| | | d.Add("HouseDistributedMark", shareData.HouseDistributedMark); |
| | | string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | return RequestHttps($"{severAddress}/ZigbeeDataShare/DeleteShareData", jsonString, true); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定子账号到住宅下 |
| | | /// </summary> |
| | | /// <param name="subAccount"></param> |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 备份部分 |
| | | /// <summary> |