shanji 3 years ago
parent
commit
fc53ddf79f
  1. 5
      BBWY.Server.Business/PlatformSDK/JDBusiness.cs
  2. 1
      BBWY.Server.Model/BBWY.Server.Model.csproj
  3. 9
      BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs
  4. 5
      BBWY.Server.Model/Dto/Response/Product/ProductResponse.cs
  5. 2
      BBWY.Test/JDProductAPITest.cs
  6. 20
      BBWY.Test/Program.cs

5
BBWY.Server.Business/PlatformSDK/JDBusiness.cs

@ -120,7 +120,7 @@ namespace BBWY.Server.Business
var req_skuList = new SkuReadSearchSkuListRequest()
{
pageSize = 50,//50
field = "logo,saleAttrs,status,created"
field = "logo,saleAttrs,status,created,,barCode,categoryId,multiCateProps"
};
if (!string.IsNullOrEmpty(searchProductSkuRequest.Spu))
@ -140,7 +140,8 @@ namespace BBWY.Server.Business
Title = s["saleAttrs"] != null ? string.Join("-", s["saleAttrs"].Select(a => a["attrValueAlias"][0].ToString())) : string.Empty,
Logo = $"https://img13.360buyimg.com/n9/s80x80_{s.Value<string>("logo")}",
State = s.Value<int>("status"),
CreateTime = s.Value<long>("created").StampToDateTime()
CreateTime = s.Value<long>("created").StampToDateTime(),
Source = searchProductSkuRequest.IsContainSource ? s : null
}).ToList();
}

1
BBWY.Server.Model/BBWY.Server.Model.csproj

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="FreeSql" Version="2.6.100" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>

9
BBWY.Server.Model/Dto/Request/Product/SearchProductSkuRequest.cs

@ -1,4 +1,6 @@
namespace BBWY.Server.Model.Dto
using Newtonsoft.Json.Linq;
namespace BBWY.Server.Model.Dto
{
public class SearchProductSkuRequest : PlatformRequest
{
@ -11,5 +13,10 @@
/// 多个Sku逗号间隔
/// </summary>
public string Sku { get; set; }
/// <summary>
/// 是否包含源
/// </summary>
public bool IsContainSource { get; set; }
}
}

5
BBWY.Server.Model/Dto/Response/Product/ProductResponse.cs

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Text;
@ -57,6 +58,8 @@ namespace BBWY.Server.Model.Dto
public int State { get; set; }
public DateTime? CreateTime { get; set; }
public JToken? Source { get; set; }
}
public class SimpleProductSkuResponse

2
BBWY.Test/ProductAPITest.cs → BBWY.Test/JDProductAPITest.cs

@ -7,7 +7,7 @@ using System.Text;
namespace BBWY.Test
{
public class ProductAPITest
public class JDProductAPITest
{
public void GetSkus(IJdClient client, string token, string spu)
{

20
BBWY.Test/Program.cs

@ -14,14 +14,24 @@ namespace BBWY.Test
{
var appkey = "120EA9EC65AB017567D78CC1139EEEA5";
var appSecret = "8a42bc2301e8439b896e99f5475e0a9b";
var token = "2ace3023200c4ea9aa682bbf8bffee18jztm"; //"b46065ef5b894f2297686e28d39cb37a2mdy";//"2ace3023200c4ea9aa682bbf8bffee18jztm";
//0e61c4a8ec3e4df4b5836e10884db9220yth 齐盛
//2ace3023200c4ea9aa682bbf8bffee18jztm 布莱特玩具
var token = "0e61c4a8ec3e4df4b5836e10884db9220yth"; //"b46065ef5b894f2297686e28d39cb37a2mdy";//"";
//10023500913672 含赠品SPU
//10022515718131 需要进行赠品上架的SPU
IJdClient client = GetJdClient(appkey, appSecret);
// var test1 = new ProductAPITest();
//test1.GetSkus(client,token, "10023500913672");
var test1 = new JDProductAPITest();
test1.GetSkus(client,token, "10023500913672");
Console.WriteLine();
test1.GetSkus(client, token, "10022515718131");
var testService = new JDServiceAPITest();
testService.GetServiceDetail(client, token);
//var testService = new JDServiceAPITest();
//testService.GetServiceDetail(client, token);
//var ddTest = new DingDingAPITest();
//ddTest.Send();

Loading…
Cancel
Save