wxr
2022-09-14 e22e6699a4ec73e81f45526eb8249379963e22d7
HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -5,7 +5,6 @@
using System.Text;
using HDL_ON.Entity;
using Newtonsoft.Json.Linq;
using Shared;
namespace HDL_ON.DAL.Server
{
@@ -45,14 +44,19 @@
        /// <param name="qType">时间查询类型:hour=近24小时、week=近一周、month = 近一月 </param>
        /// <param name="deviceId">设备ID</param>
        /// <param name="deviceKey">功能查询类型:pm25</param>
        /// <param name="time">具体查询的日期,金茂温控器使用</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);
@@ -144,6 +148,7 @@
            {
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(revertObj.Data.ToString());
                UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
                UserInfo.Current.AccessToken = revertData.accessToken;
                UserInfo.Current.RefreshToken = revertData.refreshToken;
                UserInfo.Current.LastTime = DateTime.Now;
                UserInfo.Current.SaveUserInfo();
@@ -335,6 +340,20 @@
            }
            var requestJson = HttpUtil.GetSignRequestJson(requestObj);
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_ForgetPwd, requestJson);
        }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="loginPwd"></param>
        /// <param name="loginNewPwd"></param>
        /// <returns></returns>
        public ResponsePackNew UpdataPassword(string loginPwd,string loginNewPwd)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("loginPwd", loginPwd);
            d.Add("loginNewPwd", loginNewPwd);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Update_Pwd, requestJson);
        }
        /// <summary>
@@ -1030,10 +1049,10 @@
#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 为空");
@@ -1058,15 +1077,9 @@
                //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();
@@ -1075,7 +1088,7 @@
                            OnAppConfig.Instance.PushId = pushId;
                            OnAppConfig.Instance.SaveConfig();
                            Utlis.WriteLine("PushId: " + pushId);
                            //new Alert("","提交pushToken成功"+ OnAppConfig.Instance.PushDeviceToken, "取消","确定").Show();
                            return true;
                        }
                    }
@@ -1083,7 +1096,7 @@
                }
                else
                {
                    Utlis.WriteLine("AddToken 失败");
                    //Utlis.WriteLine("AddToken 失败");
                }
                return false;
            }
@@ -1957,7 +1970,7 @@
        /// 获取设备列表
        /// </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);
@@ -2186,6 +2199,51 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson);
        }
        /// <summary>
        /// 设备扩展配置
        /// </summary>
        public ResponsePackNew DeviceExtSet(string deviceId,ExtSet extSet)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId",  deviceId );
            d.Add("extSet", extSet);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeviceExtSet, requestJson);
        }
        /// <summary>
        /// 获取设备消息规则配置
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetDeviceMessageRulesSet(string deviceId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDeviceMessageRulesSet, requestJson);
        }
        /// <summary>
        /// 设备消息规则配置
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="conditionIdentify"></param>
        /// <param name="push"></param>
        /// <returns></returns>
        public ResponsePackNew DeviceMessageRulesSet(string deviceId,string conditionIdentify,bool push)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            d.Add("deviceId", deviceId);
            d.Add("conditionIdentify", conditionIdentify);
            d.Add("push", push);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeviceMessageRulesSet, requestJson);
        }
        #endregion
@@ -2580,6 +2638,93 @@
            return pack;
        }
        /// <summary>
        /// 获取第三方品牌列表_Iot
        /// </summary>
        public ResponsePackNew Get3tyIotBrandList()
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList_Iot, requestJson);
            return pack;
        }
        /// <summary>
        /// 搜索第三方设备_iot
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Search3tyIotDevice(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Search3tyIotDevice, requestJson);
            return pack;
        }
        /// <summary>
        /// 搜索第三方设备功能列表_iot
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Get3tyIotDeviceFunctionList(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取第三方平台支持的设备类型列表
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Get3tyIotSupportSpkList(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyIotFunction, requestJson);
            return pack;
        }
        /// <summary>
        /// 设置第三方设备绑定的住宅
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Set3tyIotFunctionToHouse(List<string> deviceIds,string homeId, string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("deviceIds", deviceIds);
            d.Add("homeId", homeId);
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Setting3tyIotFunctionToHouse, requestJson);
            return pack;
        }
        /// <summary>
        /// 解绑第三方平台账号
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew Unbound3tyIotAccount(string companyId)
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("companyId", companyId);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Unbound3tyIotAccount, requestJson);
            return pack;
        }
        /// <summary>
        /// 获取绑定的第三方品牌列表
        /// </summary>
@@ -2624,6 +2769,25 @@
            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 ■ 门锁相关____________________________
@@ -2821,5 +2985,27 @@
            var requestJson = HttpUtil.GetSignRequestJson(d);
            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetCustomerInfo, requestJson);
        }
        #region 光伏储能
        /// <summary>
        /// 获取住宅下逆变器列表
        /// </summary>
        /// <returns></returns>
        public ResponsePackNew GetInverterList()
        {
            Dictionary<string, object> d = new Dictionary<string, object>();
            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
            var requestJson = HttpUtil.GetSignRequestJson(d);
            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetInverter_List, requestJson);
            return pack;
        }
        #endregion
    }
}