|
|
@ -30,21 +30,21 @@ namespace BBWY.Test |
|
|
|
var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; |
|
|
|
var jdClient = GetJdClient(appKey, appSecret); |
|
|
|
|
|
|
|
var req_productList = new WareReadSearchWare4ValidRequest() |
|
|
|
{ |
|
|
|
orderField = "modified", |
|
|
|
orderType = "desc", |
|
|
|
pageSize = 10, |
|
|
|
pageNo = 1, |
|
|
|
field = "created" |
|
|
|
}; |
|
|
|
req_productList.wareId = "10022906311378,10022870207603"; |
|
|
|
//var req_productList = new WareReadSearchWare4ValidRequest()
|
|
|
|
//{
|
|
|
|
// orderField = "modified",
|
|
|
|
// orderType = "desc",
|
|
|
|
// pageSize = 10,
|
|
|
|
// pageNo = 1,
|
|
|
|
// field = "created"
|
|
|
|
//};
|
|
|
|
//req_productList.wareId = "10022906311378,10022870207603";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var rep_productList = jdClient.Execute(req_productList, token, DateTime.Now.ToLocalTime()); |
|
|
|
if (rep_productList.IsError) |
|
|
|
throw new BusinessException(string.IsNullOrEmpty(rep_productList.ErrorMsg) ? rep_productList.ErrMsg : rep_productList.ErrorMsg); |
|
|
|
//var rep_productList = jdClient.Execute(req_productList, token, DateTime.Now.ToLocalTime());
|
|
|
|
//if (rep_productList.IsError)
|
|
|
|
// throw new BusinessException(string.IsNullOrEmpty(rep_productList.ErrorMsg) ? rep_productList.ErrMsg : rep_productList.ErrorMsg);
|
|
|
|
//return new ProductListResponse()
|
|
|
|
//{
|
|
|
|
// Count = rep_productList.page.totalItem,
|
|
|
@ -58,42 +58,31 @@ namespace BBWY.Test |
|
|
|
//};
|
|
|
|
|
|
|
|
|
|
|
|
//SearchProductSkuRequest searchProductRequest = new SearchProductSkuRequest()
|
|
|
|
//{
|
|
|
|
// AppKey = appKey,
|
|
|
|
// AppSecret = appSecret,
|
|
|
|
// AppToken = token,
|
|
|
|
// Platform = Server.Model.Enums.Platform.京东,
|
|
|
|
// Spu = "10022849663452"
|
|
|
|
//};
|
|
|
|
SearchProductSkuRequest searchProductRequest = new SearchProductSkuRequest() |
|
|
|
{ |
|
|
|
AppKey = appKey, |
|
|
|
AppSecret = appSecret, |
|
|
|
AppToken = token, |
|
|
|
Platform = Server.Model.Enums.Platform.京东, |
|
|
|
Spu = "10022849663452" |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
////var jdClient = GetJdClient(searchProductRequest.AppKey, searchProductRequest.AppSecret);
|
|
|
|
//var req_skuList = new SkuReadSearchSkuListRequest()
|
|
|
|
//{
|
|
|
|
// pageSize = 50,//50
|
|
|
|
// field = "logo,saleAttrs,status"
|
|
|
|
//};
|
|
|
|
//var jdClient = GetJdClient(searchProductRequest.AppKey, searchProductRequest.AppSecret);
|
|
|
|
var req_skuList = new SkuReadSearchSkuListRequest() |
|
|
|
{ |
|
|
|
pageSize = 50,//50
|
|
|
|
field = "logo,saleAttrs,status,created" |
|
|
|
}; |
|
|
|
|
|
|
|
//if (!string.IsNullOrEmpty(searchProductRequest.Spu))
|
|
|
|
// req_skuList.wareId = searchProductRequest.Spu;
|
|
|
|
//else if (!string.IsNullOrEmpty(searchProductRequest.Sku))
|
|
|
|
// req_skuList.skuId = searchProductRequest.Sku;
|
|
|
|
if (!string.IsNullOrEmpty(searchProductRequest.Spu)) |
|
|
|
req_skuList.wareId = searchProductRequest.Spu; |
|
|
|
else if (!string.IsNullOrEmpty(searchProductRequest.Sku)) |
|
|
|
req_skuList.skuId = searchProductRequest.Sku; |
|
|
|
|
|
|
|
//var rep_skuList = jdClient.Execute(req_skuList, searchProductRequest.AppToken, DateTime.Now.ToLocalTime());
|
|
|
|
//if (rep_skuList.IsError)
|
|
|
|
// throw new BusinessException(string.IsNullOrEmpty(rep_skuList.ErrorMsg) ? rep_skuList.ErrMsg : rep_skuList.ErrorMsg);
|
|
|
|
//var response = ((JArray)rep_skuList.Json["jingdong_sku_read_searchSkuList_responce"]["page"]["data"]).Select(s => new ProductSkuResponse()
|
|
|
|
//{
|
|
|
|
// Id = s.Value<string>("skuId"),
|
|
|
|
// ProductId = s.Value<string>("wareId"),
|
|
|
|
// Price = s.Value<decimal>("jdPrice"),
|
|
|
|
// Title = string.Join("-", s["saleAttrs"].Select(a => a["attrValueAlias"][0].ToString())),
|
|
|
|
// Logo = $"https://img13.360buyimg.com/n9/s80x80_{s.Value<string>("logo")}",
|
|
|
|
// State = s.Value<int>("status")
|
|
|
|
//}).ToList();
|
|
|
|
var rep_skuList = jdClient.Execute(req_skuList, searchProductRequest.AppToken, DateTime.Now.ToLocalTime()); |
|
|
|
|
|
|
|
Console.WriteLine(JsonConvert.SerializeObject(rep_productList)); |
|
|
|
Console.WriteLine(JsonConvert.SerializeObject(rep_skuList)); |
|
|
|
Console.ReadKey(); |
|
|
|
} |
|
|
|
} |
|
|
|