| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | const string APP_KEY = "HDL-HOME-APP-TEST"; |
| | | const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; |
| | | //public const string GlobalRequestHttpsHost = "http://59.41.255.150:7777";//mmmm |
| | | //const string APP_KEY = "CPEVRLRT"; |
| | | //const string SECRET_KEY = "CPEVRLSJCPEVRLSZ"; |
| | | |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </summary> |
| | |
| | | /// 特殊接口请求超时时间 |
| | | /// </summary> |
| | | public const int TIME_OUT_LONG = 20; |
| | | /////// <summary> |
| | | /////// Bearer 暂时设为空,从登陆成功的返回的headerPrefix参数动态获取 |
| | | /////// </summary> |
| | | /// <summary> |
| | | /// Bearer 暂时设为空,从登陆成功的返回的headerPrefix参数动态获取 |
| | | /// </summary> |
| | | //public const string TOKEN_BEARER = "Bearer "; |
| | | |
| | | #endregion |
| | |
| | | try |
| | | { |
| | | |
| | | |
| | | if (string.IsNullOrEmpty(urlHead)) |
| | | { |
| | | urlHead = HttpServerRequest.Ins.DataManager.GlobalRequestHttpsHost; |
| | | if (string.IsNullOrEmpty(urlHead)) |
| | | { |
| | | urlHead = "https://nearest.hdlcontrol.com"; |
| | | } |
| | | } |
| | | string requestFullUrl = urlHead + apiPath; |
| | | |
| | | |
| | |
| | | RestRequest request = new RestRequest(method); |
| | | request.Timeout = mTimeout * 1000; |
| | | request.AddHeader("content-type", "application/json"); |
| | | request.AddHeader("language", "cn"); |
| | | |
| | | request.AddHeader("Authorization", HttpServerRequest.Ins.DataManager.AccessToken); |
| | | |
| | | |
| | | if (bodyParameterJson != null) |
| | | { |
| | | request.AddParameter("application/json", bodyParameterJson, ParameterType.RequestBody); |
| | |
| | | } |
| | | else |
| | | { |
| | | var ddd =Newtonsoft.Json.JsonConvert.SerializeObject(response); |
| | | |
| | | return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR }; |
| | | } |
| | | |
| | |
| | | { |
| | | var responsePackNew = RequestHttpsBase(method, apiPath, bodyParameterJson, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); |
| | | //*****************Token过期处理***************** |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED) |
| | | if (responsePackNew.Code == StateCode.TOKEN_EXPIRED ) |
| | | { |
| | | //刷新Token |
| | | if (RefreshToken()) { |