You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.1 KiB
55 lines
2.1 KiB
2 years ago
|
using BBWYB.Common.Http;
|
||
|
using BBWYB.Common.Log;
|
||
|
using BBWYB.Common.Models;
|
||
|
using JD.Dto;
|
||
|
using Newtonsoft.Json;
|
||
|
using Yitter.IdGenerator;
|
||
|
|
||
|
namespace BBWYB.Server.Business.JD
|
||
|
{
|
||
|
public class JDBusiness : BaseBusiness, IDenpendency
|
||
|
{
|
||
|
private RestApiService restApiService;
|
||
|
private VenderBusiness venderBusiness;
|
||
|
public JDBusiness(IFreeSql fsql,
|
||
|
NLogManager nLogManager,
|
||
|
IIdGenerator idGenerator,
|
||
|
RestApiService restApiService,
|
||
|
VenderBusiness venderBusiness) : base(fsql, nLogManager, idGenerator)
|
||
|
{
|
||
|
this.restApiService = restApiService;
|
||
|
this.venderBusiness = venderBusiness;
|
||
|
}
|
||
|
|
||
|
public ApiResponse<IList<JDInStoreOrderDetail>> GetJDInStoreOrderDetailList(string sourceShopName, IList<string> poOrderNos)
|
||
|
{
|
||
|
var shop = venderBusiness.GetShopList(shopName: sourceShopName).FirstOrDefault();
|
||
|
if (shop == null)
|
||
|
return new ApiResponse<IList<JDInStoreOrderDetail>>() { Code = 0, Msg = $"未找到店铺{sourceShopName}" };
|
||
|
|
||
|
try
|
||
|
{
|
||
|
var httpResult = restApiService.SendRequest("https://yunding.qiyue666.com/", "api/PlatformSDK/GetJDInStorePurchaseOrderList", new
|
||
|
{
|
||
|
Platform = shop.PlatformId,
|
||
|
shop.AppKey,
|
||
|
shop.AppSecret,
|
||
|
shop.AppToken,
|
||
|
PoOrderNos = string.Join(',', poOrderNos)
|
||
|
}, null, HttpMethod.Post);
|
||
|
|
||
|
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
|
||
|
return new ApiResponse<IList<JDInStoreOrderDetail>>() { Code = 0, Msg = httpResult.Content };
|
||
|
|
||
|
|
||
|
var response = JsonConvert.DeserializeObject<ApiResponse<IList<JDInStoreOrderDetail>>>(httpResult.Content);
|
||
|
return response;
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
return new ApiResponse<IList<JDInStoreOrderDetail>>() { Code = 0, Msg = ex.Message };
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|