| | |
| | | { |
| | | public class Send |
| | | { |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | | public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID; |
| | | /// <summary> |
| | | /// 网关ID |
| | | /// </summary> |
| | | public static string gatewayId = DriverLayer.Control.Ins.GatewayId; |
| | | |
| | | ///// <summary> |
| | | ///// 网关ID |
| | | ///// </summary> |
| | | //public static string gatewayId =Entity.DB_ResidenceData.residenceData.HomeGateway.gatewayId; |
| | | ///// <summary> |
| | | ///// 住宅ID |
| | | ///// </summary> |
| | | //public static string homeId = Entity.DB_ResidenceData.residenceData.HomeGateway.homeId; |
| | | //public static string homeId = Entity.DB_ResidenceData.residenceData.CurReginID; |
| | | ///// <summary> |
| | | ///// 网关ID(秀桡有网关ID却返回是MAC) |
| | | ///// </summary> |
| | | //public static string gatewayId = DriverLayer.Control.Ins.GatewayId; |
| | | |
| | | /// <summary> |
| | | /// 网关ID(获取嘉乐网关ID) |
| | | /// </summary> |
| | | public static string gatewayId |
| | | { |
| | | get |
| | | { |
| | | if (Entity.DB_ResidenceData.residenceData.HomeGateway == null) |
| | | { |
| | | return ""; |
| | | } |
| | | return Entity.DB_ResidenceData.residenceData.HomeGateway.gatewayId; |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 住宅ID |
| | | /// </summary> |
| | | public static string homeId = Entity.DB_ResidenceData.residenceData.residecenInfo.RegionID; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取逻辑ID列表 |
| | |
| | | { |
| | | var jObject = new JObject { { "homeId", homeId } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_List); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | getLogicIdList(); |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | |
| | | } |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | getLogic(listIdList); |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | |
| | | logicjArray.Add(logicIfon); |
| | | var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } }; |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | AddLogic(logic); |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | |
| | | logicjArray.Add(logicIfon); |
| | | var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } }; |
| | | responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Update); |
| | | |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | updateLogic(logic); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | jArray.Add(logic.userLogicId); |
| | | var jObject = new JObject { { "userLogicIds", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | delLogic(logic); |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | |
| | | jArray.Add(job); |
| | | var jObject = new JObject { { "logics", jArray } }; |
| | | var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable); |
| | | //如果是token过期则刷新token |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | { |
| | | RefreshToken(); |
| | | switchLogic(logic); |
| | | } |
| | | return responsePackNew; |
| | | } |
| | | /// <summary> |
| | |
| | | return HttpUtil.RequestHttpsPost(api_Url, requestJson); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 刷新Token |
| | | /// </summary> |
| | | public static void RefreshToken() |
| | | { |
| | | IMessageCommon.Current.StartRefreshToken(); |
| | | } |
| | | |
| | | } |
| | | } |