41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Work._29Tools.BLL;
|
|
using WxOrder.Framework.Commons;
|
|
|
|
namespace Work.ERP.API
|
|
{
|
|
public class ERPHttp
|
|
{
|
|
public static string e57PostResponse(string _url, string _data)
|
|
{
|
|
return HttpResponseWXBLL.e57PostResponse(ERPConfig.Domain + _url, _data, "");
|
|
}
|
|
public static Task<string> e57PostResponseAsync(string _url, string _data)
|
|
{
|
|
return HttpResponseWXBLL.e57PostResponseAsync(ERPConfig.Domain + _url, _data);
|
|
}
|
|
public static async Task<T> e57PostResponseAsync<T>(string _url, string _data) where T : Result, new()
|
|
{
|
|
try
|
|
{
|
|
string content = await HttpResponseWXBLL.e57PostResponseAsync(ERPConfig.Domain + _url, _data);
|
|
return JsonConvert.DeserializeObject<T>(content);
|
|
}
|
|
catch (JsonException)
|
|
{
|
|
return new T { Code = 0, Msg = "数据解析失败" };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return new T { Code = 0, Msg = ex.Message };
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|