| | |
| | | namespace HDL_ON.DAL.Server |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.DAL.Server |
| | | { |
| | | public partial class HttpServerRequest |
| | | { |
| | | |
| | | /* |
| | | * json格式 |
| | | "{" + |
| | | "\"sss\":" + "\"" + sss + "\"" + "," + |
| | | "\"xxx\":" + xxx + "," + |
| | | "}"; |
| | | */ |
| | | |
| | | #region 注册、登录部分 |
| | | /// <summary> |
| | | /// 账号登录-使用密码 |
| | | /// </summary> |
| | | public ResponsePack LoginByPassword(string account,string password,int company) |
| | | public ResponsePack LoginByPassword(string account, string password) |
| | | { |
| | | var requestObj = new LoginObj() { Account = account, Password = password, Company = company }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | var revertObj = RequestHttps(HttpRequesMethods.Login.ToString(), requestJson, ""); |
| | | return revertObj; |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Password\":" + "\"" + password + "\"" + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/Login", jsonString, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 手机号码注册张吗 |
| | | /// 手机号码注册 |
| | | /// </summary> |
| | | /// <param name="mobileNumber"></param> |
| | | /// <param name="password"></param> |
| | | /// <param name="language"></param> |
| | | public ResponsePack RegisterPhone(string mobileNumber, string password, string language) |
| | | { |
| | | var requestObj = new SignInObj() { Account = mobileNumber, Password = password, Language = language }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | return RequestHttps(HttpRequesMethods.SignIn.ToString(), requestJson, ""); |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + mobileNumber + "\"" + "," + |
| | | "\"Password\":" + "\"" + password + "\"" + "," + |
| | | "\"Language\":" + "\"" + language + "\"" + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/SignIn", jsonString, false); |
| | | } |
| | | |
| | | public ResponsePack GetAreaCode() |
| | | { |
| | | string requestJson = "{}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/GetAreaCode", requestJson, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证验证码 |
| | | /// 验证短信或者邮箱验证码,之后注册 |
| | | /// </summary> |
| | | public ResponsePack ValidateSmsCode(string mobileNumber, string code) |
| | | { |
| | | var requestObj = new ValidateSmsCodeObj() { Phone = mobileNumber, Code = code }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | return RequestHttps(HttpRequesMethods.ValidateSmsCode.ToString(), requestJson, ""); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证手机号是否已经被注册 |
| | | /// </summary> |
| | | /// <param name="phoneNum">手机号码</param> |
| | | public ResponsePack IsExistingAccount(string phoneNum) |
| | | { |
| | | var requestObj = new IsExistingAccountObj() { Account = phoneNum }; |
| | | var requesetJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | return RequestHttps(HttpRequesMethods.IsExistingAccount.ToString(), requesetJson, ""); |
| | | } |
| | | /// <summary> |
| | | /// 获取验证码 |
| | | /// </summary> |
| | | /// <param name="phoneNum">手机号码</param> |
| | | public ResponsePack GetPhoneVerificationCode(string phoneNum, int company) |
| | | { |
| | | var requestObj = new SignPhoneObj() { Phone = phoneNum, Company = company }; |
| | | var requesetJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | return RequestHttps(HttpRequesMethods.SignPhone.ToString(), requesetJson, ""); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证验证码 |
| | | /// </summary> |
| | | /// <param name="mobileNumber"></param> |
| | | /// <param name="vCode"></param> |
| | | /// <param name="account">账号</param> |
| | | /// <param name="password">密码</param> |
| | | /// <param name="entryPassword">确认密码</param> |
| | | /// <param name="code">验证码</param> |
| | | /// <param name="areaCode"></param> |
| | | /// <returns></returns> |
| | | public ResponsePack SendSms(string mobileNumber, string vCode) |
| | | public ResponsePack ValidataCodeAndRegister(string account, string password, string entryPassword, string code, int areaCode) |
| | | { |
| | | var requestObj = new ValidateSmsCodeObj() { Phone = mobileNumber, Code = vCode }; |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | return RequestHttps(HttpRequesMethods.ValidateSmsCode.ToString(), requestJson, ""); |
| | | //var requestObj = new ValidateSmsCodeObj() { Phone = accout, Code = code }; |
| | | //var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj); |
| | | string requestJson = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Password\":" + "\"" + password + "\"" + "," + |
| | | "\"EnterPassword\":" + "\"" + entryPassword + "\"" + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | "\"Code\":" + "\"" + code + "\"" + "," + |
| | | "\"RegisterSoruce\":" + 0 + "," + |
| | | "\"AreaCode\":" + areaCode + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/ValidataCodeAndRegisterAccount", requestJson, false); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取注册验证码 |
| | | /// </summary> |
| | | public ResponsePack GetPhoneRegisterVerCode(string account) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Company\":" + MainPage.Company + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | "\"AreaCode\":" + UserConfig.Instance.CountryNumber + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/RegisterSendVerCode", jsonString, false); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取登录验证码 |
| | | /// </summary> |
| | | /// <param name="phoneNum">手机号码</param> |
| | | public ResponsePack GetPhoneLoginVerCode(string phoneNum) |
| | | { |
| | | |
| | | string jsonString = "{" +
|
| | | "\"Phone\":" + "\"" + phoneNum + "\"" + "," + |
| | | "\"Company\":" + MainPage.Company + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送验证码 |
| | | /// </summary> |
| | | public ResponsePack SendSms(string account) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Company\":" + MainPage.Company + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | "\"AreaCode\":" + UserConfig.Instance.CountryNumber + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/LoginSendVerCode", jsonString, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 验证验证码 |
| | | /// </summary> |
| | | /// <param name="account"></param> |
| | | /// <param name="code"></param> |
| | | /// <returns></returns> |
| | | public ResponsePack ValidatorCode(string account, string code, int countryIndex) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Code\":" + "\"" + code + "\"" + "," + |
| | | "\"Language\":" + "\"" + Language.CurrentLanguage + "\"" + "," + |
| | | "\"AreaCode\":" + countryIndex + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/ValidatorCode", jsonString, false); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 重设密码 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePack ResetPassword(string account, string password, string rePassword, int countryIndex) |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"Account\":" + "\"" + account + "\"" + "," + |
| | | "\"Password\":" + "\"" + password + "\"" + "," + |
| | | "\"AgainPassword\":" + "\"" + rePassword + "\"" + "," + |
| | | "\"AreaCode\":" + countryIndex + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/ResetPassword", jsonString, false); |
| | | } |
| | | #endregion |
| | | |
| | | #region 住宅部分 |
| | | /// <summary> |
| | | /// 获取住宅列表 |
| | | /// </summary> |
| | | public ResponsePack GetHomePager() |
| | | { |
| | | string jsonString = "{" +
|
| | | "\"RequestVersion\":" + "\"" + MainPage.VersionString + "\"" + "," + |
| | | "\"RequestSource\":" + "\"" + "1" + "\"" + "," + |
| | | "\"HomeType\":" + "\"" + "1" + "\"" + "," + |
| | | "\"LoginAccessToken\":" + "\"" + MainPage.LoginUser.LoginTokenString + "\"" + |
| | | "}"; |
| | | return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager", jsonString,false); |
| | | } |
| | | |
| | | |
| | | |
| | | #endregion |
| | | } |
| | | } |