| | |
| | | using System; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using Shared.Common; |
| | | |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 经纬度__________________________ |
| | | /// <summary> |
| | | /// ReceiveAppLatAndLon |
| | | /// </summary> |
| | | /// <param name="lat"></param> |
| | | /// <param name="lon"></param> |
| | | public async void ReceiveAppLatAndLon(string lat, string lon) |
| | | { |
| | | try |
| | | { |
| | | var requestObj = new SendDataToServer.ReceiveAppLatAndLonObj |
| | | { |
| | | Latitude = lat, |
| | | Longitude = lon |
| | | }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | var revertObj = await RequestHttpsZigbeeAsync("ProcessRange/ReceiveAppLatAndLon", System.Text.Encoding.UTF8.GetBytes(requestJson));
|
| | | //if (revertObj.StateCode.ToUpper() == "SUCCESS") |
| | | //{ |
| | | // System.Console.WriteLine("上传位置成功" + lat + lon); |
| | | //} |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求服务器方法 |
| | | /// 指定一个Url,和请求方法,数据,Cookie,得到响应的数据 |
| | | /// </summary> |
| | | /// <param name="requestUrl">请求Url</param> |
| | | /// <param name="byteData">请求的的数据</param> |
| | | /// <returns>得到响应的数据</returns> |
| | | public async System.Threading.Tasks.Task<Shared.Common.ResponseEntity.ResponsePack> RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData) |
| | | { |
| | | string result = await RequestHttpsZigbeeResultAsync(requestUrl, byteData); |
| | | if (result != null) |
| | | { |
| | | try |
| | | { |
| | | var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result); |
| | | return data; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | System.Console.WriteLine(ex.Message); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求服务器方法 |
| | | /// 指定一个Url,和请求方法,数据,Cookie,得到响应的数据 |
| | | /// </summary> |
| | | /// <param name="requestUrl">请求Url</param> |
| | | /// <param name="byteData">请求的的数据</param> |
| | | /// <returns>得到响应的数据</returns> |
| | | public async System.Threading.Tasks.Task<string> RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData) |
| | | { |
| | | var result = await RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData); |
| | | if (result != null) |
| | | { |
| | | return Encoding.UTF8.GetString(result); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求服务器方法 |
| | | /// 指定一个Url,和请求方法,数据,Cookie,得到响应的数据 |
| | | /// </summary> |
| | | /// <param name="requestUrl">请求Url</param> |
| | | /// <param name="byteData">请求的的数据</param> |
| | | /// <param name="requestMethod">POST 或者 GET 等等</param> |
| | | /// <returns>得到响应的数据</returns> |
| | | public async System.Threading.Tasks.Task<byte[]> RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST") |
| | | { |
| | | //请求Url的完成路径 |
| | | var fullUrl = $"{CommonPage.RequestHttpsHost}/{requestUrl}"; |
| | | return await CommonPage.Instance.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.LoginToken, requestMethod); |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |