Files
zszq-trs/YLErpDAL/Modules/ApiModule/TradeApiHelper.cs
T
2024-05-09 14:06:26 +08:00

37 lines
999 B
C#

namespace YLErp.Modules.ApiModule
{
public static class TradeApiHelper
{
static readonly HttpClientWrap _httpClientWrap;
static TradeApiHelper()
{
_httpClientWrap = new HttpClientWrap(PS.Config.ErpElement.HedgingTradeUrl);
}
public static string PostJson(string apiPath, object postData)
{
if (_httpClientWrap.BaseAddress == null)
{
throw new ServiceException("HedgingTradeUrl未配置");
}
try
{
return _httpClientWrap.PostJson(apiPath, postData, null);
}
catch (Exception ex)
{
LogFactory.GetLogger("TradingAPI-Post").Error(apiPath, ex);
throw;
}
}
public static T PostJson<T>(string apiPath, object postData)
{
var res = PostJson(apiPath, postData);
return JsonHelper.Parse<T>(res);
}
}
}