| | |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.DAL.Server |
| | | { |
| | |
| | | /// <param name="deviceId">设备ID</param> |
| | | /// <param name="deviceKey">功能查询类型:pm25</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey) |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey, string time = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("type", qType); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("key", deviceKey); |
| | | if (time != "") |
| | | { |
| | | d.Add("time", time); |
| | | } |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); |
| | |
| | | #endif |
| | | //是否生产模式 |
| | | bool isProduce = true; |
| | | #if DEBUG |
| | | isProduce = true; |
| | | #endif |
| | | |
| | | if (HttpUtil.GlobalRequestHttpsHost == "https://test-gz.hdlcontrol.com") |
| | | { |
| | | isProduce = false; |
| | | } |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) |
| | | { |
| | | Utlis.WriteLine("PushDeviceToken 为空"); |
| | |
| | | |
| | | //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj); |
| | | var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj); |
| | | |
| | | Utlis.WriteLine("mAddpushinfoJson: " + mAddpushinfoJson); |
| | | |
| | | //new Alert("", , "取消", "确定").Show(); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_AddToken, mAddpushinfoJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //new Alert("", "提交pushToken成功" + OnAppConfig.Instance.PushDeviceToken, "取消", "确定").Show(); |
| | | |
| | | if (revertObj.Data != null) |
| | | { |
| | | var pushId = revertObj.Data.ToString(); |
| | |
| | | OnAppConfig.Instance.PushId = pushId; |
| | | OnAppConfig.Instance.SaveConfig(); |
| | | Utlis.WriteLine("PushId: " + pushId); |
| | | //new Alert("","提交pushToken成功"+ OnAppConfig.Instance.PushDeviceToken, "取消","确定").Show(); |
| | | |
| | | return true; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("AddToken 失败"); |
| | | //Utlis.WriteLine("AddToken 失败"); |
| | | } |
| | | return false; |
| | | } |
| | |
| | | /// 获取设备列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetDeviceList(string pageSize="",string pageNo ="") |
| | | public ResponsePackNew GetDeviceList(string pageSize = "", string pageNo = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Check, requestJson); |
| | | return pack; |
| | | } |
| | | /// <summary> |
| | | /// 获取门口机徘徊报警数据 |
| | | /// </summary> |
| | | /// <param name="deviceId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetAlarmRecords(string deviceId, int pageSize, int pageNo, string alarmType = "PROWLER_ALARM") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("alarmType", alarmType); |
| | | d.Add("pageSize", pageSize); |
| | | d.Add("pageNo", pageNo); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_ALARM_RECORDS, requestJson); |
| | | return pack; |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 门锁相关____________________________ |