37 lines
999 B
C#
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);
|
|
}
|
|
}
|
|
}
|