|
|
|
using BBWYB.Common.Http;
|
|
|
|
using QuanTan.SDK.Client.Supplier;
|
|
|
|
using QuanTan.SDK.Models.Supplier;
|
|
|
|
using SDKAdapter.OperationPlatform.Models;
|
|
|
|
using SDKAdapter.PurchasePlatform.Models;
|
|
|
|
|
|
|
|
namespace SDKAdapter.OperationPlatform.Client
|
|
|
|
{
|
|
|
|
public class OP_QuanTanClient : OP_PlatformClient
|
|
|
|
{
|
|
|
|
private QuanTan_Supplier_ProductClient supplier_ProductClient;
|
|
|
|
private QuanTan_Supplier_OrderClient supplier_OrderClient;
|
|
|
|
|
|
|
|
public OP_QuanTanClient(RestApiService restApiService) : base(restApiService)
|
|
|
|
{
|
|
|
|
this.supplier_ProductClient = new QuanTan_Supplier_ProductClient(restApiService);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override AdapterEnums.PlatformType Platform => AdapterEnums.PlatformType.拳探;
|
|
|
|
|
|
|
|
public override OP_ProductListResponse GetProductList(OP_QueryProductRequest request)
|
|
|
|
{
|
|
|
|
var qtResponse = supplier_ProductClient.GetProductList(new QuanTan_Supplier_SearchSpuRequest()
|
|
|
|
{
|
|
|
|
page = request.PageIndex,
|
|
|
|
pageSize = request.PageSize,
|
|
|
|
productId = request.Spu,
|
|
|
|
storeId = request.AppToken
|
|
|
|
}, request.AppKey, request.AppSecret);
|
|
|
|
|
|
|
|
if (qtResponse.Status != 200)
|
|
|
|
throw new Exception(qtResponse.Message);
|
|
|
|
|
|
|
|
return new OP_ProductListResponse()
|
|
|
|
{
|
|
|
|
Count = qtResponse.Data.Count,
|
|
|
|
Items = qtResponse.Data.List.Select(qtp => new OP_ProductResponse()
|
|
|
|
{
|
|
|
|
Id = qtp.ProductId,
|
|
|
|
BrandName = string.Empty,
|
|
|
|
CreateTime = null,
|
|
|
|
Logo = qtp.Image,
|
|
|
|
ProductItemNum = string.Empty,
|
|
|
|
State = 0,
|
|
|
|
Title = qtp.ProductName
|
|
|
|
}).ToList()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public override OP_ProductSkuListResponse GetProductSkuList(OP_QueryProductSkuRequest request)
|
|
|
|
{
|
|
|
|
var qtResponse = supplier_ProductClient.GetProductSkuList(new QuanTan_Supplier_SearchSkuRequest()
|
|
|
|
{
|
|
|
|
page = request.PageIndex,
|
|
|
|
pageSize = request.PageSize,
|
|
|
|
storeId = request.AppToken,
|
|
|
|
productId = request.Spu
|
|
|
|
}, request.AppKey, request.AppSecret);
|
|
|
|
|
|
|
|
if (qtResponse.Status != 200)
|
|
|
|
throw new Exception(qtResponse.Message);
|
|
|
|
|
|
|
|
return new OP_ProductSkuListResponse()
|
|
|
|
{
|
|
|
|
Count = qtResponse.Data.Count,
|
|
|
|
Items = qtResponse.Data.List.Select(qtps => new OP_ProductSkuResponse()
|
|
|
|
{
|
|
|
|
CreateTime = null,
|
|
|
|
Id = qtps.ProductSku,
|
|
|
|
Logo = qtps.SkuImage,
|
|
|
|
Price = qtps.SkuPrice,
|
|
|
|
ProductId = qtps.ProductId,
|
|
|
|
State = 0,
|
|
|
|
Title = qtps.SkuName
|
|
|
|
}).ToList()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
public override OP_OrderListResponse GetOrderList(OP_QueryOrderRequest request)
|
|
|
|
{
|
|
|
|
var qtResponse = supplier_OrderClient.GetOrderList(new QuanTan_Supplier_QueryOrderReuqest()
|
|
|
|
{
|
|
|
|
storeId = request.AppToken
|
|
|
|
|
|
|
|
}, request.AppKey, request.AppSecret);
|
|
|
|
return base.GetOrderList(request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|