| | |
| | | |
| | | namespace Shared |
| | | { |
| | | /// <summary> |
| | | /// 接口请求封装 |
| | | /// </summary> |
| | | public class HttpServerRequest |
| | | { |
| | | |
| | | #region ■ 变量声明___________________________ |
| | | /// <summary> |
| | | /// 通用方法 |
| | |
| | | } |
| | | return revertObj.Code; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 注册、登录部分 |
| | | |
| | | |
| | | /// <summary> |
| | | /// 通用 发送验证码方法 |
| | | /// </summary> |
| | |
| | | /// <param name="code">验证码</param> |
| | | /// <param name="isPhone">是否手机</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew ValidataCodeAndRegister(string account, string password, string code, bool isPhone = false) |
| | | public ResponsePackNew ValidataCodeAndRegister(string name,string account, string password, string code, bool isPhone = false) |
| | | { |
| | | var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code};//, memberName = account |
| | | var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code, memberName = name};//, memberName = account |
| | | if (isPhone) |
| | | { |
| | | requestObj.memberPhone = account; |
| | |
| | | } |
| | | var requestJson = HttpUtil.GetSignRequestJson(requestObj); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_ForgetPwd, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改密码 |
| | | /// 提供新旧密码 |
| | | /// </summary> |
| | | /// <param name="oldPassword"></param> |
| | | /// <param name="newPassword"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew ModifyPassword (string oldPassword, string newPassword) { |
| | | var requestJson = HttpUtil.GetSignRequestJson (new UpdatePwdObj () { |
| | | loginPwd = oldPassword, |
| | | loginNewPwd = newPassword |
| | | }); |
| | | return HttpUtil.RequestHttpsPost (NewAPI.API_POST_Update_Pwd, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | UserConfig.Instance.HomeLists = new List<RegionInfoRes> (); |
| | | var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoResNew>> (resultObj.Data.ToString ()); |
| | | if (homeList == null || homeList.Count == 0) { |
| | | |
| | | UserConfig.Instance.SaveUserConfig (); |
| | | } else { |
| | | foreach (var mHome in homeList) { |
| | | var home = new RegionInfoRes () { |
| | | Id = mHome.Id, |
| | | Name = mHome.homeName, |
| | | IsOthreShare = mHome.IsOtherShare, |
| | | isRemoteControl = mHome.isRemoteControl, |
| | | isBindGateway = mHome.isBindGateway, |
| | | regionUrl = mHome.regionUrl, |
| | | }; |
| | | var home = RegionInfoResNewToHome (mHome); |
| | | UserConfig.Instance.HomeLists.Add (home); |
| | | } |
| | | //住宅被删除 |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="mHome"></param> |
| | | /// <returns></returns> |
| | | public RegionInfoRes RegionInfoResNewToHome (RegionInfoResNew mHome) |
| | | { |
| | | return new RegionInfoRes () { |
| | | Id = mHome.Id, |
| | | Name = mHome.homeName, |
| | | IsOthreShare = mHome.IsOtherShare, |
| | | isRemoteControl = mHome.isRemoteControl, |
| | | isBindGateway = mHome.isBindGateway, |
| | | regionUrl = mHome.regionUrl, |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 编辑住宅信息 |
| | | /// </summary> |
| | | /// <param name="editId">0 修改住宅名字、1 修改住宅地址</param> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据homeId删除指定 |
| | | /// </summary> |
| | | /// <param name="homeId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew AddHome (string homeName) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson (new AddOrUpdateHomeObj () { |
| | | homeName = homeName, |
| | | homeType = HomeTypeEnum.BUSPRO.ToString () |
| | | }) ; |
| | | return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_Home_AddHome, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据homeId删除指定 |
| | | /// </summary> |
| | | /// <param name="homeId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew DeleteHome (string homeId) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson (new HomeIdObj () { |
| | | homeId = homeId |
| | | }); |
| | | return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_Home_Delete, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 绑定网关 |
| | | /// </summary> |
| | | /// <param name="mac"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew BindGateway (BindGatewayObj newGateway) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson (newGateway); |
| | | return HttpUtil.RequestHttpsPostFroHome (NewAPI.API_POST_BindGateway, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取刷新当前住宅的网关列表 |
| | | /// </summary> |
| | | public string GetHomeGatewayList() |
| | |
| | | if (mHomeGatewayRes.Count > 0) |
| | | { |
| | | UserConfig.Instance.HomeGateway = mHomeGatewayRes[0]; |
| | | //if (mHomeGatewayRes[0].gatewayStatus) |
| | | //{ |
| | | // DriverLayer.Control.Ins.GatewayOnline = true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // DriverLayer.Control.Ins.GatewayOnline = false; |
| | | //} |
| | | UserConfig.Instance.SaveUserConfig(); |
| | | return revertObj.Code; |
| | | } |
| | |
| | | } |
| | | return revertObj.Code; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取住宅下的成员账号 |
| | |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetMqttRemoteInfoObj() |
| | | { |
| | | attachClientId = attachClientId, |
| | | attachClientId = attachClientId + "L1", |
| | | homeType = HomeTypeEnum.BUSPRO.ToString() |
| | | }); |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetMqttRemoteInfo, requestJson, UserConfig.Instance.CurrentRegion.regionUrl); |