tzy
2021-05-14 ee5f2543624a0e3ae9d046062b822727a31685e1
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -50,8 +50,8 @@
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("type", qType);
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", new List<string>() { deviceId });
            d.Add("key", new List<string>() { deviceKey });
            d.Add("deviceId",  deviceId );
            d.Add("key",  "value" );
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
@@ -930,6 +930,9 @@
        {
            try
            {
                //先清空推送ID,避免使用缓存的PushId为其它账号的情况,导致查询到其它账号的推送记录
                OnAppConfig.Instance.PushId = "";
                string deviceType = PhoneDeviceType.Android.ToString();
#if __IOS__
                deviceType = PhoneDeviceType.IOS.ToString();
@@ -2387,7 +2390,7 @@
        #endregion
        #region 萤石云SDK相关接口
        #region ■ 萤石云SDK相关接口_________________________
        /// <summary>
        /// 河东获取萤石云子账号token的接口
        /// </summary>
@@ -2400,7 +2403,7 @@
        #endregion
        #region 可视对讲
        #region ■ 可视对讲_________________________
        /// <summary>
        /// 检查住宅是否绑定丰林,并获取门口机列表
        /// </summary>
@@ -2414,5 +2417,129 @@
            return pack;
        }
        #endregion
        #region ■ 门锁历史记录________________________
        /// <summary>
        /// 获取门锁历史记录(按日期降序)
        /// </summary>
        /// <param name="i_device">设备对象</param>
        /// <returns></returns>
        public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device)
        {
            //测试
            var listLog = new List<Stan.DoorHistoryLog>();
            for (int i = 1; i <= 3; i++)
            {
                var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" };
                logInfo.Time = new DateTime(2000, 5, 6, 10, 45, 23).AddDays(i);
                listLog.Add(logInfo);
            }
            for (int i = 1; i <= 3; i++)
            {
                var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" };
                logInfo.Time = new DateTime(2001, 5, 6, 10, 45, 23).AddDays(i);
                listLog.Add(logInfo);
            }
            for (int i = 1; i <= 3; i++)
            {
                var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" };
                logInfo.Time = new DateTime(2002, 5, 6, 10, 45, 23).AddDays(i);
                listLog.Add(logInfo);
            }
            //按时间降序
            var listSortLog = new List<Stan.DoorHistoryLog>();
            foreach (var logInfo in listLog)
            {
                bool canAdd = true;
                for (int i = 0; i < listSortLog.Count; i++)
                {
                    if (logInfo.Time > listSortLog[i].Time)
                    {
                        //时间比当前的索引大,则插入到它的前面
                        listSortLog.Insert(i, logInfo);
                        canAdd = false;
                        break;
                    }
                }
                if (canAdd == true)
                {
                    //日期最小,则添加到末尾
                    listSortLog.Add(logInfo);
                }
            }
            //提示
            //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
            return listSortLog;
        }
        #endregion
        #region ■ 音箱语言控制相关_________________________
        /// <summary>
        /// 获取已授权的音箱列表
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetSpeakerList()
        {
            var requestJson = HttpUtil.GetSignRequestJson(new GetSpeakerObj
            {
                homeId = DB_ResidenceData.Instance.CurrentRegion.id,
            });
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_List_Get, requestJson);
        }
        /// <summary>
        /// 编辑音箱授权备注
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew UpdateSpeakerRemark(UpdateSpeakerRemarkObj remarkObj)
        {
            var requestJson = HttpUtil.GetSignRequestJson(remarkObj);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Remark_Update, requestJson);
        }
        /// <summary>
        /// 解除音箱绑定
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew UnbindSpeaker(string tokenId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("tokenId", tokenId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Unbind, requestJson);
        }
        /// <summary>
        /// 获取音箱分配的设备和场景列表
        /// </summary>
        /// <param name="getType">0 是查询全部 1是查询设备 2是查询场景</param>
        /// <param name="tokenId"></param>
        /// <returns></returns>
        public ResponsePackNew GetSpeakerDeviceList(int getType, string tokenId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("tokenId", tokenId);
            if (getType > 0)
            {
                d.Add("isDevice", getType == 1);
            }
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Get, requestJson);
        }
        /// <summary>
        /// 更新音箱控制的设备和场景目标
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew UpdateSpeakerDeviceList(UpdateSpeakerDeviceListObj updateSpeakerDeviceListObj)
        {
            var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson);
        }
        #endregion
    }
}