/// <summary> /// 获取Redis的URL地址 /// </summary> /// <returns></returns> public static string GetRedisURL(string UrlName, string Application, string FuncationName) { UrlName = SingleXmlInfo.GetInstance().GetWebApiConfig(UrlName); Application = SingleXmlInfo.GetInstance().GetWebApiConfig(Application); string Url = UrlName + Application + "/api/RedisAPI/" + FuncationName; return(Url); }
/// <summary> /// 删除商品图片URL地址 /// </summary> /// <returns></returns> public static string DeleteCommodityImg(string UrlName, string Application) { UrlName = SingleXmlInfo.GetInstance().GetWebApiConfig(UrlName); Application = SingleXmlInfo.GetInstance().GetWebApiConfig(Application); string Url = UrlName + Application + "/api/imgUpload/DeleteCommodityImg"; return(Url); }
/// <summary> /// 图片上传URL地址 /// </summary> /// <returns></returns> public static string GetImgUploadURL(string UrlName, string Application) { UrlName = SingleXmlInfo.GetInstance().GetWebApiConfig(UrlName); Application = SingleXmlInfo.GetInstance().GetWebApiConfig(Application); string Url = UrlName + Application + "/api/imgUpload/Upload"; return(Url); }
/// <summary> /// 定义公有方法提供一个全局访问点,同时你也可以定义公有属性来提供全局访问点 /// </summary> /// <returns></returns> public static SingleXmlInfo GetInstance() { // 当第一个线程运行到这里时,此时会对locker对象 "加锁", // 当第二个线程运行该方法时,首先检测到locker对象为"加锁"状态,该线程就会挂起等待第一个线程解锁 // lock语句运行完之后(即线程运行完之后)会对该对象"解锁" // 双重锁定只需要一句判断就可以了 if (uniqueInstance == null) { lock (locker) { // 如果类的实例不存在则创建,否则直接返回 if (uniqueInstance == null) { uniqueInstance = new SingleXmlInfo(); } } } return(uniqueInstance); }
///// <summary> ///// httppost请求(带参数) ///// </summary> ///// <param name="Url">URL地址</param> ///// <param name="model">Model实体类</param> ///// <returns></returns> //public static async Task<string> HttpRequest<T>(string Url, T model) //{ // string Result = string.Empty; // string Str = JsonConvert.SerializeObject(model, JSetting); // ///打印请求日志 // LogHelper.LogRequest(Str); // HttpContent httpContent = new StringContent(Str); // HttpClient httpClient = new HttpClient(); // httpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0"); // httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); // try // { // var res = await httpClient.PostAsync(Url, httpContent); // if (res.StatusCode == HttpStatusCode.OK) // { // var response = res.Content.ReadAsStringAsync().Result; // return response; // } // //HttpResponseMessage response = httpClient.PostAsync(Url, httpContent).Result; // //Result = response.Content.ReadAsStringAsync().Result; // } // catch (Exception ex) // { // Console.Write(ex.Message); // } // httpClient.Dispose(); // return Result; //} #endregion #region 访问地址 /// <summary> /// 访问地址 /// </summary> /// <param name="Application">应用名</param> /// <param name="ClassName">类库名</param> /// <returns></returns> public static string GetURL(string Application, string ClassName) { string IP = SingleXmlInfo.GetInstance().GetWebApiConfig("serverIp"); Application = SingleXmlInfo.GetInstance().GetWebApiConfig(Application); //string Url = IP + Application + "/" + ClassName + ".dll/TServerMethods/Transaction/"; #region 原地址 //string Url = "http://119.23.35.37/App/" + ClassName + ".dll/TServerMethods/Transaction/"; //string Url = "http://172.18.5.250/App/" + ClassName + ".dll/TServerMethods/Transaction/"; //string Url = "http://172.18.5.250/OperatingPlatform/" + ClassName + ".dll/TServerMethods/Transaction/"; //string Url = "http://172.18.5.250/MerchantPlatform/" + ClassName + ".dll/TServerMethods/Transaction/"; // string Url = "http://119.23.35.37/MerchantPlatform/" + ClassName + ".dll/TServerMethods/Transaction/"; //string Url = "http://172.18.5.250/PayManagePlatform/" + ClassName + ".dll/TServerMethods/Transaction/"; //string Url = "http://192.168.1.51:8010/" + ClassName + "/" + ClassName + ".dll/TServerMethods/Transaction/"; string Url = "http://192.168.1.218:8080/TServerMethods/Transaction/"; #endregion return(Url); }
/// <summary> /// 获取图片保存URL地址 /// </summary> /// <returns></returns> public static string ImgURL() { string Url = SingleXmlInfo.GetInstance().GetWebApiConfig("imgIp"); return(Url); }