wxr
2020-03-31 002a3f2e9d2f9579c01f88af12bd8a320003569f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
using Shared;
 
namespace HDL_ON.DAL.Server
{
    public partial class HttpServerRequest
    {
 
        /*
         * json格式
           "{" +
              "\"sss\":" + "\"" + sss + "\"" + "," +
              "\"xxx\":" + xxx + "," +
           "}";
 
            获取返回的数据
            var sss = Newtonsoft.Json.Linq.JObject.FromObject("sss");
            var xxx = homeJsonStr.GetValue("xxx").ToString(),
              */
 
        //public ResponsePack GetCityId(string lon,string lat)
        //{
        //    string jsonString = "{" +
        //                        "\"Account\":" + "\"" + lon + "\"" + "," +
        //                        "\"Password\":" + "\"" + lat + "\"" +
        //                        "}";
        //    return RequestHttps(@"https://global.hdlcontrol.com/HangZhouHdlCloudApi/ZigbeeUsers/Login", jsonString, false);
        //    //string url = $"https://developer.hdlcontrol.com/Weather/Weather/FindCity/?lon={arg1}&lat={arg2}";
        //}
 
        #region 注册、登录部分
        /// <summary>
        /// 账号登录-使用密码
        /// </summary>
        public ResponsePack LoginByPassword(string account, string password)
        {
            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)
        {
            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>
        /// <param name="account">账号</param>
        /// <param name="password">密码</param>
        /// <param name="entryPassword">确认密码</param>
        /// <param name="code">验证码</param>
        /// <param name="areaCode"></param>
        /// <returns></returns>
        public ResponsePack ValidataCodeAndRegister(string account, string password, string entryPassword, string code, int areaCode)
        {
            //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
    }
}