JLChen
2020-11-23 eb51679c618d5027070fbd6f3c0519f0f17e7d7d
HDL_ON/DAL/Server/HttpUtil.cs
@@ -4,6 +4,7 @@
using System.Net;
using System.Security.Cryptography;
using System.Text;
using HDL_ON.Entity;
using RestSharp;
using Shared;
@@ -11,6 +12,7 @@
{
    public class HttpUtil
    {
        #region HttpUtil 全局常量
        ///// <summary>
        ///// API_HTTPS
@@ -80,6 +82,27 @@
        //    }
        //    return mResponsePackNew;
        //}
        /// <summary>
        /// POST请求方法 body参数
        /// 针对住宅相关接口封装
        /// 调用住宅当前所在区域域名
        /// 如果是分享住宅,使用主人的token进行相关操作
        /// </summary>
        /// <param name="apiPath"></param>
        /// <param name="bodyParameterJson"></param>
        /// <param name="mTimeout"></param>
        /// <returns></returns>
        public static ResponsePackNew RequestHttpsPostFroHome(string apiPath, string bodyParameterJson, int mTimeout = 10)
        {
            string urlHead = DB_ResidenceData.residenceData.residecenInfo.regionUrl;
            var replaceToken = "";
            if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
            {
                replaceToken = DB_ResidenceData.residenceData.MasterToken;
            }
            return RequestHttps(Method.POST, apiPath, bodyParameterJson, null, null, urlHead, replaceToken, mTimeout);
        }
        /// <summary>
        /// POST请求方法 body参数
@@ -204,20 +227,20 @@
                    }
                    catch (Exception ex)
                    {
                        HDL_ON.Utlis.WriteLine(ex.Message);
                        HDL_ON.Common.Utlis.WriteLine(ex.Message);
                        return new ResponsePackNew() { Code = "DATA_EXCEPTION" };
                    }
                }
                else
                {
                    HDL_ON.Utlis.WriteLine(response.Content);
                    HDL_ON.Common.Utlis.WriteLine(response.Content);
                    return new ResponsePackNew() { Code = "NETWORK_ERROR" };
                }
            }
            catch (Exception ex)
            {
                HDL_ON.Utlis.WriteLine(ex.Message);
                HDL_ON.Common.Utlis.WriteLine(ex.Message);
                return new ResponsePackNew() { Code = "NETWORK_ERROR" };
            }
@@ -285,7 +308,7 @@
            }
            catch (Exception ex)
            {
                HDL_ON.Utlis.WriteLine(ex.Message);
                HDL_ON.Common.Utlis.WriteLine(ex.Message);
                return null;
            }
            #endregion
@@ -376,20 +399,20 @@
                    }
                    catch (Exception ex)
                    {
                        HDL_ON.Utlis.WriteLine(ex.Message);
                        HDL_ON.Common.Utlis.WriteLine(ex.Message);
                        return new ResponsePackNew() { Code = "DATA_EXCEPTION" };
                    }
                }
                else
                {
                    HDL_ON.Utlis.WriteLine(response.Content);
                    HDL_ON.Common.Utlis.WriteLine(response.Content);
                    return new ResponsePackNew() { Code = "NETWORK_ERROR" };
                }
            }
            catch (Exception ex)
            {
                HDL_ON.Utlis.WriteLine(ex.Message);
                HDL_ON.Common.Utlis.WriteLine(ex.Message);
                return new ResponsePackNew() { Code = "NETWORK_ERROR" };
            }