├── global.json
├── .vscode
├── settings.json
├── tasks.json
└── launch.json
├── static
└── 1561374793(1).jpg
├── test
├── appsettings.json
└── test.csproj
├── src
├── Pdd.Sdk
│ ├── PddBaseResponse.cs
│ ├── Pdd.Sdk.csproj
│ ├── Apis
│ │ ├── PddDdkWeappQrcodeUrlGen.cs
│ │ ├── PddDdkThemeListGet.cs
│ │ ├── PddDdkGoodsPidGenerate.cs
│ │ ├── PddDdkPhraseGenerate.cs
│ │ ├── PddDdkGoodsBasicInfoGet.cs
│ │ ├── PddDdkGoodsPidQuery.cs
│ │ ├── PddDdkCouponInfoQuery.cs
│ │ ├── PddDdkGoodsUnitQuery.cs
│ │ ├── PddDdkGoodsZsUnitUrlGen.cs
│ │ ├── PddDdkMallUrlGen.cs
│ │ ├── PddDdkRpPromUrlGenerate.cs
│ │ ├── PddDdkResourceUrlGen.cs
│ │ ├── PddDdkOrderListRangeGet.cs
│ │ ├── PddDdkThemeGoodsSearch.cs
│ │ ├── PddDdkOrderListIncrementGet.cs
│ │ ├── PddDdkThemePromUrlGenerate.cs
│ │ ├── PddDdkGoodsPromotionUrlGenerate.cs
│ │ ├── PddDdkOrderDetailGet.cs
│ │ ├── PddDdkLotteryUrlGen.cs
│ │ ├── PddDdkTopGoodsListQuery.cs
│ │ └── PddDdkCmsPromUrlGenerate.cs
│ └── PddBaseRequest.cs
├── Jd.Sdk
│ ├── Jd.Sdk.csproj
│ ├── Apis
│ │ ├── JdUnionOpenCouponImportation.cs
│ │ ├── JdUnionOpenUserPidGet.cs
│ │ ├── JdUnionOpenCategoryGoodsGet.cs
│ │ ├── JdUnionOpenPositionCreate.cs
│ │ ├── JdUnionOpenPromotionCommonGet.cs
│ │ ├── JdUnionOpenPromotionBysubunionidGet.cs
│ │ ├── JdUnionOpenPromotionByunionidGet.cs
│ │ ├── JdUnionOpenCouponQuery.cs
│ │ ├── JdUnionOpenGoodsLinkQuery.cs
│ │ ├── JdUnionOpenPositionQuery.cs
│ │ ├── JdUnionOpenGoodsPromotiongoodsinfoQuery.cs
│ │ ├── JdUnionOpenGoodsStupriceQuery.cs
│ │ ├── JdUnionOpenGoodsSeckillQuery.cs
│ │ └── JdUnionOpenGoodsBigfieldQuery.cs
│ ├── JdBaseResponse.cs
│ └── JdBaseRequest.cs
├── Tool
│ ├── Tool.csproj
│ ├── Program.cs
│ └── JdRootobject.cs
├── Common
│ ├── Time.cs
│ ├── Common.csproj
│ ├── Sign.cs
│ └── Convert.cs
└── src.sln
├── README.md
├── JD_PDD.SDK.CSharpe.sln
└── .gitignore
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "2.2.401"
4 | }
5 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "dotnet-test-explorer.testProjectPath": "**/*.csproj"
3 | }
--------------------------------------------------------------------------------
/static/1561374793(1).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sc1994/JD_PDD.SDK.CSharpe/HEAD/static/1561374793(1).jpg
--------------------------------------------------------------------------------
/test/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "JdSdk": {
3 | "AppKey": "todo",
4 | "AppSecret": "todo"
5 | },
6 | "Pdd.Sdk": {
7 | "ClientSecret": "todo",
8 | "ClientId": "todo"
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Pdd.Sdk/PddBaseResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Pdd.Sdk
4 | {
5 | public abstract class PddBaseResponse
6 | {
7 | [JsonProperty("request_id")]
8 | public string RequestId { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Pdd.Sdk.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Jd.Sdk.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/src/Tool//Tool.csproj"
11 | ],
12 | "problemMatcher": "$msCompile"
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/src/Tool/Tool.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | Exe
15 | netcoreapp2.2
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Common/Time.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Common
4 | {
5 | public class Time
6 | {
7 | public static string GetTimeStampSecond(int length = 10)
8 | {
9 | var ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
10 | if (length == 10)
11 | {
12 | return Convert.ToInt64(ts.TotalSeconds).ToString();
13 | }
14 | return Convert.ToInt64(ts.TotalMilliseconds).ToString();
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Common/Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "version": "0.2.0",
4 | "configurations": [
5 | {
6 | "name": ".NET Core Launch (console)",
7 | "type": "coreclr",
8 | "request": "launch",
9 | "preLaunchTask": "build",
10 | "program": "${workspaceFolder}/src/Tool//bin/Debug/netcoreapp2.2/Tool.dll",
11 | "args": [],
12 | "cwd": "${workspaceFolder}/src/Tool/",
13 | "console": "externalTerminal",
14 | "stopAtEntry": false,
15 | "internalConsoleOptions": "openOnSessionStart"
16 | },
17 | {
18 | "name": ".NET Core Attach",
19 | "type": "coreclr",
20 | "request": "attach",
21 | "processId": "${command:pickProcess}"
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/test/test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | PreserveNewest
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/Common/Sign.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text;
3 | using System.Linq;
4 | using System.Security.Cryptography;
5 | using System;
6 |
7 | namespace Common
8 | {
9 | public class Sign
10 | {
11 | ///
12 | /// sign to md5
13 | ///
14 | ///
15 | ///
16 | ///
17 | public static string SignToMd5(Dictionary @params, string secret)
18 | {
19 | var query = new StringBuilder(secret);
20 | foreach (var item in @params.OrderBy(x => x.Key, StringComparer.Ordinal))
21 | {
22 | if (string.IsNullOrEmpty(item.Key)) continue;
23 | query.Append(item.Key).Append(item.Value);
24 | }
25 | query.Append(secret);
26 | var md5 = MD5.Create();
27 | var bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(query.ToString()));
28 | return string.Join("", bytes.Select(x => x.ToString("X2")));
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenCouponImportation.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 优惠券导入【申请】--请求参数
7 | /// 将商品SKUID和领券链接导入,之后其他媒体均可通过联盟开放平台搜索到该商品和优惠券。通常适用于招商媒体。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.coupon.importation
9 | /// https://union.jd.com/openplatform/api/696
10 | ///
11 | public class JdUnionOpenCouponImportationRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenCouponImportationRequest() { }
14 |
15 | public JdUnionOpenCouponImportationRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.coupon.importation";
18 |
19 | protected override string ParamName => "couponReq";
20 |
21 | public async Task InvokeAsync()
22 | => await PostAsync();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:商品ID
27 | /// 例如:23335727609
28 | ///
29 | public long? SkuId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:优惠券链接
33 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXX
34 | ///
35 | public string CouponLink { get; set; }
36 | }
37 |
38 |
39 |
40 | //--------------------------------------
41 | // 返回值没有data内容,直接使用基础响应基类
42 | //--------------------------------------
43 |
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/src/Common/Convert.cs:
--------------------------------------------------------------------------------
1 | namespace Common
2 | {
3 | public class ConvertExtend
4 | {
5 | ///
6 | /// 大写转下划线
7 | ///
8 | ///
9 | ///
10 | public static string UpperToUnderline(string source)
11 | {
12 | var result = string.Empty;
13 | foreach (var item in source)
14 | {
15 | if (item >= 65 && item <= 90)
16 | {
17 | var temp = string.Empty;
18 | if (!string.IsNullOrWhiteSpace(result))
19 | {
20 | temp = "_";
21 | }
22 | result += temp + item.ToString().ToLower();
23 | }
24 | else
25 | {
26 | result += item.ToString();
27 | }
28 | }
29 | return result;
30 | }
31 |
32 | ///
33 | /// 下划线转大写
34 | ///
35 | ///
36 | ///
37 | public static string UnderlineToUpper(string source)
38 | {
39 | var result = string.Empty;
40 | var toUpper = false;
41 | foreach (var item in source)
42 | {
43 | if (item == '_' && !string.IsNullOrWhiteSpace(result))
44 | {
45 | toUpper = true;
46 | }
47 | else
48 | {
49 | if (toUpper || string.IsNullOrWhiteSpace(result))
50 | {
51 | result += item.ToString().ToUpper();
52 | toUpper = false;
53 | }
54 | else
55 | {
56 | result += item.ToString();
57 | }
58 | }
59 | }
60 | return result;
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/src/Jd.Sdk/JdBaseResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Jd.Sdk
2 | {
3 | ///
4 | /// 响应基类
5 | ///
6 | public class JdBaseResponse
7 | {
8 | public string ApiCodeEnum { get; set; } = string.Empty;
9 |
10 | ///
11 | /// 200:success;
12 | /// 500:服务端异常;
13 | /// 400:参数错误;
14 | /// 401:验证失败;
15 | /// 403:无访问权限;
16 | /// 404数据不存在;
17 | /// 409:数据已存在;
18 | /// 410:联盟用户不存在,请检查unionId是否正确;
19 | /// 411:unionId不正确,请检查unionId是否正确;
20 | /// 2003101:参数异常,skuIds为空;
21 | /// 2003102:参数异常,sku个数为1-100个;
22 | /// 2003103:接口异常,没有相关权限;
23 | /// 2003104:请求商品信息{X}条,成功返回{Y}条, 失败{Z}条;
24 | ///
25 | public int Code { get; set; }
26 |
27 | ///
28 | /// 结果信息,明细请参照code描述
29 | ///
30 | public string Message { get; set; } = string.Empty;
31 |
32 | public string RequestId { get; set; } = string.Empty;
33 |
34 | ///
35 | /// 弱类型的(当不需要处理数据的时候)
36 | ///
37 | public object Data { get; set; }
38 | }
39 |
40 | ///
41 | /// 响应基类
42 | /// 需要指定data内容
43 | ///
44 | ///
45 | public class JdBaseResponse : JdBaseResponse
46 | {
47 | public new T Data { get; set; }
48 | }
49 |
50 | ///
51 | /// 分页基础返回类
52 | ///
53 | public class JdBasePageResponse : JdBaseResponse
54 | {
55 | public new T[] Data { get; set; }
56 |
57 | ///
58 | /// 是否还有更多,true:还有数据;false:已查询完毕,没有数据
59 | ///
60 | public bool HasMore { get; set; }
61 |
62 | ///
63 | /// 总数量
64 | ///
65 | public long TotalCount { get; set; }
66 | }
67 |
68 | public class JdResponseResultEntity
69 | {
70 | public string Result { get; set; }
71 | public string Code { get; set; }
72 | public string Msg { get; set; }
73 | }
74 | }
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenUserPidGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 获取PID--请求参数
7 | /// 工具商媒体帮助子站长创建PID,该参数可在媒体和子站长之间建立关联,并通过获取推广链接、订单查询来跟踪。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.user.pid.get
9 | /// https://union.jd.com/openplatform/api/646
10 | ///
11 | public class JdUnionOpenUserPidGetRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenUserPidGetRequest() { }
14 |
15 | public JdUnionOpenUserPidGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.user.pid.get";
18 |
19 | protected override string ParamName => "pidReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:联盟ID
27 | /// 例如:10000618
28 | ///
29 | public long? UnionId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:子站长ID
33 | /// 例如:61800001
34 | ///
35 | public long? ChildUnionId { get; set; }
36 | ///
37 | /// 必填
38 | /// 描述:推广类型,1APP推广 2聊天工具推广
39 | /// 例如:1
40 | ///
41 | public int? PromotionType { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:子站长的推广位名称,如不存在则创建,不填则由联盟根据母账号信息创建
45 | /// 例如:
46 | ///
47 | public string PositionName { get; set; }
48 | ///
49 | /// 必填
50 | /// 描述:媒体名称,即子站长的app应用名称,推广方式为app推广时必填,且app名称必须为已存在的app名称
51 | /// 例如:huhu
52 | ///
53 | public string MediaName { get; set; }
54 | }
55 |
56 |
57 |
58 | ///
59 | /// 获取PID--响应参数
60 | /// 工具商媒体帮助子站长创建PID,该参数可在媒体和子站长之间建立关联,并通过获取推广链接、订单查询来跟踪。需向cps-qxsq@jd.com申请权限。
61 | /// jd.union.open.user.pid.get
62 | ///
63 | public class JdUnionOpenUserPidGetResponse
64 | {
65 | }
66 |
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkWeappQrcodeUrlGen.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多客生成单品推广小程序二维码url--请求参数
8 | /// 多多客生成单品推广小程序二维码url
9 | /// pdd.ddk.weapp.qrcode.url.gen
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.weapp.qrcode.url.gen
11 | ///
12 | public class PddDdkWeappQrcodeUrlGenRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.weapp.qrcode.url.gen";
15 |
16 | public PddDdkWeappQrcodeUrlGenRequest() { }
17 |
18 | public PddDdkWeappQrcodeUrlGenRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 推广位ID
25 | ///
26 | public string PId { get; set; }
27 | ///
28 | /// 必填
29 | /// 商品ID,仅支持单个查询
30 | ///
31 | public long[] GoodsIdList { get; set; }
32 | ///
33 | /// 不必填
34 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
35 | ///
36 | public string CustomParameters { get; set; }
37 | ///
38 | /// 不必填
39 | /// 招商多多客ID
40 | ///
41 | public long? ZsDuoId { get; set; }
42 | }
43 |
44 |
45 | ///
46 | /// 多多客生成单品推广小程序二维码url--响应参数
47 | /// 多多客生成单品推广小程序二维码url
48 | ///
49 | public class PddDdkWeappQrcodeUrlGenResponse : PddBaseResponse
50 | {
51 | ///
52 | /// response
53 | ///
54 | [JsonProperty("weapp_qrcode_generate_response")]
55 | public PddDdkWeappQrcodeUrlGen_WeappQrcodeGenerateResponse WeappQrcodeGenerateResponse { get; set; }
56 | }
57 |
58 | ///
59 | /// response
60 | ///
61 | public class PddDdkWeappQrcodeUrlGen_WeappQrcodeGenerateResponse
62 | {
63 | ///
64 | /// 单品推广小程序二维码url
65 | ///
66 | [JsonProperty("url")]
67 | public string Url { get; set; }
68 | }
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenCategoryGoodsGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 商品类目查询--请求参数
7 | /// 根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。
8 | /// jd.union.open.category.goods.get
9 | /// https://union.jd.com/openplatform/api/693
10 | ///
11 | public class JdUnionOpenCategoryGoodsGetRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenCategoryGoodsGetRequest() { }
14 |
15 | public JdUnionOpenCategoryGoodsGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.category.goods.get";
18 |
19 | protected override string ParamName => "req";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:父类目id(一级父类目为0)
27 | /// 例如:1342
28 | ///
29 | public int? ParentId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:类目级别(类目级别 0,1,2 代表一、二、三级类目)
33 | /// 例如:2
34 | ///
35 | public int? Grade { get; set; }
36 | }
37 |
38 |
39 |
40 | ///
41 | /// 商品类目查询--响应参数
42 | /// 根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。
43 | /// jd.union.open.category.goods.get
44 | ///
45 | public class JdUnionOpenCategoryGoodsGetResponse
46 | {
47 | ///
48 | /// 描述:类目Id
49 | /// 例如:1350
50 | ///
51 | public int? Id { get; set; }
52 | ///
53 | /// 描述:类目名称
54 | /// 例如:针织衫
55 | ///
56 | public string Name { get; set; }
57 | ///
58 | /// 描述:类目级别(类目级别 0,1,2 代表一、二、三级类目)
59 | /// 例如:2
60 | ///
61 | public int? Grade { get; set; }
62 | ///
63 | /// 描述:父类目Id
64 | /// 例如:1342
65 | ///
66 | public int? ParentId { get; set; }
67 | }
68 |
69 | }
70 |
71 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkThemeListGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多进宝主题列表查询--请求参数
8 | /// 查询多多进宝主题列表
9 | /// pdd.ddk.theme.list.get
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.theme.list.get
11 | ///
12 | public class PddDdkThemeListGetRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.theme.list.get";
15 |
16 | public PddDdkThemeListGetRequest() { }
17 |
18 | public PddDdkThemeListGetRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 返回的一页数据数量
25 | ///
26 | public int? PageSize { get; set; }
27 | ///
28 | /// 不必填
29 | /// 返回的页码
30 | ///
31 | public int? Page { get; set; }
32 | }
33 |
34 |
35 | ///
36 | /// 多多进宝主题列表查询--响应参数
37 | /// 查询多多进宝主题列表
38 | ///
39 | public class PddDdkThemeListGetResponse : PddBaseResponse
40 | {
41 | ///
42 | /// 返回的元素数量
43 | ///
44 | [JsonProperty("total")]
45 | public int? Total { get; set; }
46 | ///
47 | /// 返回的主题列表
48 | ///
49 | [JsonProperty("theme_list")]
50 | public PddDdkThemeListGet_ThemeList[] ThemeList { get; set; }
51 | }
52 |
53 | ///
54 | /// 返回的主题列表
55 | ///
56 | public class PddDdkThemeListGet_ThemeList
57 | {
58 | ///
59 | /// 主题ID
60 | ///
61 | [JsonProperty("id")]
62 | public long? Id { get; set; }
63 | ///
64 | /// 主题图片
65 | ///
66 | [JsonProperty("image_url")]
67 | public string ImageUrl { get; set; }
68 | ///
69 | /// 主题名称
70 | ///
71 | [JsonProperty("name")]
72 | public string Name { get; set; }
73 | ///
74 | /// 主题包含的商品数量
75 | ///
76 | [JsonProperty("goods_num")]
77 | public long? GoodsNum { get; set; }
78 | }
79 | }
80 |
81 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsPidGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 创建多多进宝推广位--请求参数
8 | /// 创建多多进宝推广位
9 | /// pdd.ddk.goods.pid.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.pid.generate
11 | ///
12 | public class PddDdkGoodsPidGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.pid.generate";
15 |
16 | public PddDdkGoodsPidGenerateRequest() { }
17 |
18 | public PddDdkGoodsPidGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 要生成的推广位数量,默认为10,范围为:1~100
25 | ///
26 | public long? Number { get; set; }
27 | ///
28 | /// 不必填
29 | /// 推广位名称,例如["1","2"]
30 | ///
31 | public string[] PIdNameList { get; set; }
32 | }
33 |
34 |
35 | ///
36 | /// 创建多多进宝推广位--响应参数
37 | /// 创建多多进宝推广位
38 | ///
39 | public class PddDdkGoodsPidGenerateResponse : PddBaseResponse
40 | {
41 | ///
42 | /// response
43 | ///
44 | [JsonProperty("p_id_generate_response")]
45 | public PddDdkGoodsPidGenerate_PIdGenerateResponse PIdGenerateResponse { get; set; }
46 | }
47 |
48 | ///
49 | /// 多多进宝推广位对象列表
50 | ///
51 | public class PddDdkGoodsPidGenerate_PIdList
52 | {
53 | ///
54 | /// 推广位名称
55 | ///
56 | [JsonProperty("pid_name")]
57 | public string PidName { get; set; }
58 | ///
59 | /// 调用方推广位ID
60 | ///
61 | [JsonProperty("p_id")]
62 | public string PId { get; set; }
63 | ///
64 | /// 推广位创建时间
65 | ///
66 | [JsonProperty("create_time")]
67 | public long? CreateTime { get; set; }
68 | }
69 | ///
70 | /// response
71 | ///
72 | public class PddDdkGoodsPidGenerate_PIdGenerateResponse
73 | {
74 | ///
75 | /// 多多进宝推广位对象列表
76 | ///
77 | [JsonProperty("p_id_list")]
78 | public PddDdkGoodsPidGenerate_PIdList[] PIdList { get; set; }
79 | }
80 | }
81 |
82 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkPhraseGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 生成多多口令接口--请求参数
8 | /// 生成多多口令接口
9 | /// pdd.ddk.phrase.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.phrase.generate
11 | ///
12 | public class PddDdkPhraseGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.phrase.generate";
15 |
16 | public PddDdkPhraseGenerateRequest() { }
17 |
18 | public PddDdkPhraseGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 推广位ID
25 | ///
26 | public string PId { get; set; }
27 | ///
28 | /// 必填
29 | /// 商品ID,仅支持单个查询, json 字符串 例子:[1112]
30 | ///
31 | public long[] GoodsIdList { get; set; }
32 | ///
33 | /// 不必填
34 | /// 是否多人团
35 | ///
36 | public bool? MultiGroup { get; set; }
37 | ///
38 | /// 不必填
39 | /// 自定义参数
40 | ///
41 | public string CustomParameters { get; set; }
42 | ///
43 | /// 不必填
44 | /// 招商多多客ID
45 | ///
46 | public long? ZsDuoId { get; set; }
47 | ///
48 | /// 不必填
49 | /// 1-大图弹框 2-对话弹框
50 | ///
51 | public int? Style { get; set; }
52 | }
53 |
54 |
55 | ///
56 | /// 生成多多口令接口--响应参数
57 | /// 生成多多口令接口
58 | ///
59 | public class PddDdkPhraseGenerateResponse : PddBaseResponse
60 | {
61 | ///
62 | /// 口令列表
63 | ///
64 | [JsonProperty("promotion_phrase_list")]
65 | public PddDdkPhraseGenerate_PromotionPhraseList[] PromotionPhraseList { get; set; }
66 | ///
67 | /// 总数
68 | ///
69 | [JsonProperty("total")]
70 | public int? Total { get; set; }
71 | }
72 |
73 | ///
74 | /// 口令列表
75 | ///
76 | public class PddDdkPhraseGenerate_PromotionPhraseList
77 | {
78 | ///
79 | /// 商品id
80 | ///
81 | [JsonProperty("goods_id")]
82 | public long? GoodsId { get; set; }
83 | ///
84 | /// 口令
85 | ///
86 | [JsonProperty("phrase")]
87 | public string Phrase { get; set; }
88 | }
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsBasicInfoGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 获取商品基本信息接口--请求参数
8 | /// 获取商品基本信息
9 | /// pdd.ddk.goods.basic.info.get
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.basic.info.get
11 | ///
12 | public class PddDdkGoodsBasicInfoGetRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.basic.info.get";
15 |
16 | public PddDdkGoodsBasicInfoGetRequest() { }
17 |
18 | public PddDdkGoodsBasicInfoGetRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 商品id
25 | ///
26 | public long[] GoodsIdList { get; set; }
27 | }
28 |
29 |
30 | ///
31 | /// 获取商品基本信息接口--响应参数
32 | /// 获取商品基本信息
33 | ///
34 | public class PddDdkGoodsBasicInfoGetResponse : PddBaseResponse
35 | {
36 | ///
37 | /// response
38 | ///
39 | [JsonProperty("goods_basic_detail_response")]
40 | public PddDdkGoodsBasicInfoGet_GoodsBasicDetailResponse GoodsBasicDetailResponse { get; set; }
41 | }
42 |
43 | ///
44 | /// list
45 | ///
46 | public class PddDdkGoodsBasicInfoGet_GoodsList
47 | {
48 | ///
49 | /// 商品id
50 | ///
51 | [JsonProperty("goods_id")]
52 | public long? GoodsId { get; set; }
53 | ///
54 | /// 最小单买价格,单位分
55 | ///
56 | [JsonProperty("min_normal_price")]
57 | public long? MinNormalPrice { get; set; }
58 | ///
59 | /// 最小成团价格,单位分
60 | ///
61 | [JsonProperty("min_group_price")]
62 | public long? MinGroupPrice { get; set; }
63 | ///
64 | /// 商品缩略图
65 | ///
66 | [JsonProperty("goods_pic")]
67 | public string GoodsPic { get; set; }
68 | ///
69 | /// 商品标题
70 | ///
71 | [JsonProperty("goods_name")]
72 | public string GoodsName { get; set; }
73 | }
74 | ///
75 | /// response
76 | ///
77 | public class PddDdkGoodsBasicInfoGet_GoodsBasicDetailResponse
78 | {
79 | ///
80 | /// list
81 | ///
82 | [JsonProperty("goods_list")]
83 | public PddDdkGoodsBasicInfoGet_GoodsList[] GoodsList { get; set; }
84 | }
85 | }
86 |
87 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsPidQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 查询已经生成的推广位信息--请求参数
8 | /// 查询已经生成的推广位信息
9 | /// pdd.ddk.goods.pid.query
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.pid.query
11 | ///
12 | public class PddDdkGoodsPidQueryRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.pid.query";
15 |
16 | public PddDdkGoodsPidQueryRequest() { }
17 |
18 | public PddDdkGoodsPidQueryRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 返回的页数
25 | ///
26 | public int? Page { get; set; }
27 | ///
28 | /// 不必填
29 | /// 返回的每页推广位数量
30 | ///
31 | public int? PageSize { get; set; }
32 | ///
33 | /// 不必填
34 | /// 推广位id列表
35 | ///
36 | public string[] PidList { get; set; }
37 | }
38 |
39 |
40 | ///
41 | /// 查询已经生成的推广位信息--响应参数
42 | /// 查询已经生成的推广位信息
43 | ///
44 | public class PddDdkGoodsPidQueryResponse : PddBaseResponse
45 | {
46 | ///
47 | /// response
48 | ///
49 | [JsonProperty("p_id_query_response")]
50 | public PddDdkGoodsPidQuery_PIdQueryResponse PIdQueryResponse { get; set; }
51 | }
52 |
53 | ///
54 | /// 多多进宝推广位对象列表
55 | ///
56 | public class PddDdkGoodsPidQuery_PIdList
57 | {
58 | ///
59 | /// 推广位生成时间
60 | ///
61 | [JsonProperty("create_time")]
62 | public long? CreateTime { get; set; }
63 | ///
64 | /// 推广位名称
65 | ///
66 | [JsonProperty("pid_name")]
67 | public string PidName { get; set; }
68 | ///
69 | /// 推广位ID
70 | ///
71 | [JsonProperty("p_id")]
72 | public string PId { get; set; }
73 | }
74 | ///
75 | /// response
76 | ///
77 | public class PddDdkGoodsPidQuery_PIdQueryResponse
78 | {
79 | ///
80 | /// 多多进宝推广位对象列表
81 | ///
82 | [JsonProperty("p_id_list")]
83 | public PddDdkGoodsPidQuery_PIdList[] PIdList { get; set; }
84 | ///
85 | /// 返回推广位总数
86 | ///
87 | [JsonProperty("total_count")]
88 | public long? TotalCount { get; set; }
89 | }
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JD_PDD.SDK.CSharpe
2 |
3 | 京东和拼多多用`c#`干净的实现开放api,使用`netstandard2.0`。
4 |
5 | 解决`json`对应`class`的复杂嵌套关系。尽量让代码足够清晰。
6 |
7 | ---
8 |
9 | ## Feature
10 |
11 | 无需关心jd或者pdd的调用规则,只需关心 **业务** 请求响应参数 。
12 |
13 | 针对需要补充的系统参数,在继承`BaseRequest`之后,会有未实现的异常。
14 |
15 | 生成注释完善的请求响应实体,统一使用方法名的规范命名规则
16 |
17 | ```c#
18 | ///
19 | /// 商品类目查询--请求参数
20 | /// 根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。
21 | /// jd.union.open.category.goods.get
22 | ///
23 | public partial class JdUnionOpenCategoryGoodsGetRequest : BaseRequest
24 | {
25 | ///
26 | /// 描述:父类目id(一级父类目为0)
27 | /// 必填:true
28 | /// 例如:1342
29 | ///
30 | public int? ParentId { get; set; }
31 | .
32 | .
33 | .
34 | }
35 |
36 |
37 | ///
38 | /// 商品类目查询--响应参数
39 | /// 根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。
40 | /// jd.union.open.category.goods.get
41 | ///
42 | public partial class JdUnionOpenCategoryGoodsGetResponse
43 | {
44 | ///
45 | /// 描述:类目Id
46 | /// 必填:true
47 | /// 例如:1350
48 | ///
49 | public int? Id { get; set; }
50 | .
51 | .
52 | .
53 | }
54 | ```
55 |
56 | 较为完善的单元测试(部分接口需要权限申请,或者一些特殊情况的,添加不满足生产的断言)
57 | .jpg)
58 |
59 | 支持默认和可传入的appkey等主要参数
60 |
61 | ```c#
62 | public JdUnionOpenCategoryGoodsGetRequest() { }
63 | public JdUnionOpenCategoryGoodsGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
64 | ```
65 |
66 | 一句话调用
67 |
68 | ```c#
69 | await new JdUnionOpenCategoryGoodsGetRequest(...).InvokeAsync();
70 | ```
71 |
72 | ## 使用接口生成工具
73 |
74 | - 进入`src/Tool`目录,运行`dotnet run`
75 | - 选择jd或者pdd
76 |
77 | ## 正确的使用姿势
78 |
79 | 目前不提供dll直接调用,希望的使用方法是copy基类代码到自己的项目,针对需要使用的接口使用Tool去生成请求响应实体。就这样~
80 |
81 | ## 缺点
82 |
83 | - 采用代码生成无法识别接口的相同部分,也就意味这生成的代码几乎无代码复用。会产生一定程度的重复代码。
84 | - 会产生贼长的命名。
85 |
86 | ```c#
87 | public class JdUnionOpenOrderQueryResponse
88 | {
89 | public JdUnionOpenOrderQuery_SkuInfo SkuInfo { get; set; }
90 | }
91 |
92 | public class JdUnionOpenOrderQuery_SkuInfo
93 | {
94 | ...
95 | }
96 | ```
97 |
98 | ---
99 |
100 | ## 更新日志
101 |
102 | ```txt
103 | 2019年6月28日 加入 pdd 多多客接口
104 | |
105 | .
106 | |
107 | v
108 | 2019年6月25日 优化嵌套类的结构,加入config
109 | |
110 | .
111 | |
112 | v
113 | 2019年6月24日 Jd 17个接口通过单元测试
114 | |
115 | .
116 | |
117 | v
118 | 2019年6月21日 优化调用代码,添加单元测试
119 | |
120 | .
121 | |
122 | v
123 | 2019年6月18日 jd全部api接入,支持一键更新全部jd接口
124 | |
125 | .
126 | |
127 | v
128 | 2019年6月17日 增加jd demo
129 | |
130 | .
131 | |
132 | v
133 | 2019年6月13日 初始化项目
134 | ```
135 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkCouponInfoQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 查询优惠券信息--请求参数
8 | /// 查询优惠券信息
9 | /// pdd.ddk.coupon.info.query
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.coupon.info.query
11 | ///
12 | public class PddDdkCouponInfoQueryRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.coupon.info.query";
15 |
16 | public PddDdkCouponInfoQueryRequest() { }
17 |
18 | public PddDdkCouponInfoQueryRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 优惠券id
25 | ///
26 | public string[] CouponIds { get; set; }
27 | }
28 |
29 |
30 | ///
31 | /// 查询优惠券信息--响应参数
32 | /// 查询优惠券信息
33 | ///
34 | public class PddDdkCouponInfoQueryResponse : PddBaseResponse
35 | {
36 | ///
37 | /// ddk_coupon_info_query
38 | ///
39 | [JsonProperty("ddk_coupon_info_query_response")]
40 | public PddDdkCouponInfoQuery_DdkCouponInfoQueryResponse DdkCouponInfoQueryResponse { get; set; }
41 | }
42 |
43 | ///
44 | /// list
45 | ///
46 | public class PddDdkCouponInfoQuery_List
47 | {
48 | ///
49 | /// 优惠券结束时间
50 | ///
51 | [JsonProperty("coupon_end_time")]
52 | public long? CouponEndTime { get; set; }
53 | ///
54 | /// 优惠券id
55 | ///
56 | [JsonProperty("coupon_id")]
57 | public string CouponId { get; set; }
58 | ///
59 | /// 优惠券开始时间
60 | ///
61 | [JsonProperty("coupon_start_time")]
62 | public long? CouponStartTime { get; set; }
63 | ///
64 | /// 优惠券类型, 45:多多进宝商品优惠券 87:淘客定向商品券 204:招商商品优惠券 225:店铺折扣券
65 | ///
66 | [JsonProperty("coupon_type")]
67 | public int? CouponType { get; set; }
68 | ///
69 | /// 优惠券面额 单位:分
70 | ///
71 | [JsonProperty("discount")]
72 | public long? Discount { get; set; }
73 | ///
74 | /// 优惠券总量
75 | ///
76 | [JsonProperty("init_quantity")]
77 | public long? InitQuantity { get; set; }
78 | ///
79 | /// 优惠券剩余数量
80 | ///
81 | [JsonProperty("remain_quantity")]
82 | public long? RemainQuantity { get; set; }
83 | }
84 | ///
85 | /// ddk_coupon_info_query
86 | ///
87 | public class PddDdkCouponInfoQuery_DdkCouponInfoQueryResponse
88 | {
89 | ///
90 | /// list
91 | ///
92 | [JsonProperty("list")]
93 | public PddDdkCouponInfoQuery_List[] List { get; set; }
94 | }
95 | }
96 |
97 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsUnitQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 查询商品的推广计划--请求参数
8 | /// 查询商品的推广计划
9 | /// pdd.ddk.goods.unit.query
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.unit.query
11 | ///
12 | public class PddDdkGoodsUnitQueryRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.unit.query";
15 |
16 | public PddDdkGoodsUnitQueryRequest() { }
17 |
18 | public PddDdkGoodsUnitQueryRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 商品id
25 | ///
26 | public long? GoodsId { get; set; }
27 | ///
28 | /// 不必填
29 | /// 招商duoId
30 | ///
31 | public long? ZsDuoId { get; set; }
32 | }
33 |
34 |
35 | ///
36 | /// 查询商品的推广计划--响应参数
37 | /// 查询商品的推广计划
38 | ///
39 | public class PddDdkGoodsUnitQueryResponse : PddBaseResponse
40 | {
41 | ///
42 | /// ddk_goods_unit_query_response
43 | ///
44 | [JsonProperty("ddk_goods_unit_query_response")]
45 | public PddDdkGoodsUnitQuery_DdkGoodsUnitQueryResponse DdkGoodsUnitQueryResponse { get; set; }
46 | }
47 |
48 | ///
49 | /// ddk_goods_unit_query_response
50 | ///
51 | public class PddDdkGoodsUnitQuery_DdkGoodsUnitQueryResponse
52 | {
53 | ///
54 | /// 优惠券结束时间,单位:秒
55 | ///
56 | [JsonProperty("coupon_end_time")]
57 | public long? CouponEndTime { get; set; }
58 | ///
59 | /// 优惠券id
60 | ///
61 | [JsonProperty("coupon_id")]
62 | public string CouponId { get; set; }
63 | ///
64 | /// 优惠券开始时间,单位:秒
65 | ///
66 | [JsonProperty("coupon_start_time")]
67 | public long? CouponStartTime { get; set; }
68 | ///
69 | /// 优惠券面额,单位:厘
70 | ///
71 | [JsonProperty("discount")]
72 | public int? Discount { get; set; }
73 | ///
74 | /// 优惠券总数量
75 | ///
76 | [JsonProperty("init_quantity")]
77 | public long? InitQuantity { get; set; }
78 | ///
79 | /// 商品的佣金比例,单位:千分位,比如100,表示10%
80 | ///
81 | [JsonProperty("rate")]
82 | public int? Rate { get; set; }
83 | ///
84 | /// 优惠券剩余数量
85 | ///
86 | [JsonProperty("remain_quantity")]
87 | public long? RemainQuantity { get; set; }
88 | ///
89 | /// 商品的推广计划类型,1-通用推广,2-专属推广,3-招商推广,4-全店推广
90 | ///
91 | [JsonProperty("unit_type")]
92 | public int? UnitType { get; set; }
93 | }
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenPositionCreate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 创建推广位【申请】--请求参数
7 | /// 工具商媒体帮助多个子站长ID批量创建推广位,每个联盟ID最多创建1万个推广位。其中业务参数key需要由子站长进入联盟官网-推广管理-API权限管理中获取, 有效期60天。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.position.create
9 | /// https://union.jd.com/openplatform/api/655
10 | ///
11 | public class JdUnionOpenPositionCreateRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenPositionCreateRequest() { }
14 |
15 | public JdUnionOpenPositionCreateRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.position.create";
18 |
19 | protected override string ParamName => "positionReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:需要创建的目标联盟id
27 | /// 例如:10000618
28 | ///
29 | public long? UnionId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:目标联盟ID对应的授权key,在联盟推广管理页领取
33 | /// 例如:
34 | ///
35 | public string Key { get; set; }
36 | ///
37 | /// 必填
38 | /// 描述:1:cps推广位 2:cpc推广位
39 | /// 例如:1
40 | ///
41 | public int? UnionType { get; set; }
42 | ///
43 | /// 必填
44 | /// 描述:站点类型 1网站推广位2.APP推广位3.社交媒体推广位4.聊天工具推广位5.二维码推广
45 | /// 例如:4
46 | ///
47 | public int? Type { get; set; }
48 | ///
49 | /// 必填
50 | /// 描述:推广位名称集合,英文,分割;上限50
51 | /// 例如:
52 | ///
53 | public string[] SpaceNameList { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:站点ID,即网站ID/app ID/snsID ,当type传入4以外的值时,siteId为必填
57 | /// 例如:61800001
58 | ///
59 | public long? SiteId { get; set; }
60 | }
61 |
62 |
63 |
64 | ///
65 | /// 创建推广位【申请】--响应参数
66 | /// 工具商媒体帮助多个子站长ID批量创建推广位,每个联盟ID最多创建1万个推广位。其中业务参数key需要由子站长进入联盟官网-推广管理-API权限管理中获取, 有效期60天。需向cps-qxsq@jd.com申请权限。
67 | /// jd.union.open.position.create
68 | ///
69 | public class JdUnionOpenPositionCreateResponse
70 | {
71 | ///
72 | /// 描述:推广位结果集合
73 | /// 例如:"test4": 6186666082
74 | ///
75 | public System.Collections.Generic.Dictionary ResultList { get; set; }
76 | ///
77 | /// 描述:站点ID
78 | /// 例如:1
79 | ///
80 | public long? SiteId { get; set; }
81 | ///
82 | /// 描述:联盟类型
83 | /// 例如:4
84 | ///
85 | public long? Type { get; set; }
86 | ///
87 | /// 描述:联盟ID
88 | /// 例如:618618
89 | ///
90 | public long? UnionId { get; set; }
91 | }
92 |
93 | }
94 |
95 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenPromotionCommonGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 获取通用推广链接--请求参数
7 | /// 网站/APP来获取的推广链接,功能同宙斯接口的自定义链接转换、 APP领取代码接口通过商品链接、活动链接获取普通推广链接,支持传入subunionid参数,可用于区分媒体自身的用户ID。
8 | /// jd.union.open.promotion.common.get
9 | /// https://union.jd.com/openplatform/api/691
10 | ///
11 | public class JdUnionOpenPromotionCommonGetRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenPromotionCommonGetRequest() { }
14 |
15 | public JdUnionOpenPromotionCommonGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.promotion.common.get";
18 |
19 | protected override string ParamName => "promotionCodeReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:推广物料
27 | /// 例如:https://item.jd.com/23484023378.html
28 | ///
29 | public string MaterialId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:站点ID是指在联盟后台的推广管理中的网站Id、APPID(通用转链接口禁止使用社交媒体id入参)
33 | /// 例如:435676
34 | ///
35 | public string SiteId { get; set; }
36 | ///
37 | /// 不必填
38 | /// 描述:推广位id
39 | /// 例如:6
40 | ///
41 | public long? PositionId { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:子联盟ID(需要联系运营开通权限才能拿到数据)
45 | /// 例如:618_18_c35***e6a
46 | ///
47 | public string SubUnionId { get; set; }
48 | ///
49 | /// 不必填
50 | /// 描述:推客生成推广链接时传入的扩展字段(查看订单对应字段信息,需要联系运营开放白名单才能看到)
51 | /// 例如:100_618_618
52 | ///
53 | public string Ext1 { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:请勿再使用,后续会移除此参数,请求成功一律返回https协议链接
57 | /// 例如:已废弃
58 | ///
59 | public int? Protocol { get; set; }
60 | ///
61 | /// 不必填
62 | /// 描述:联盟子站长身份标识,格式:子站长ID_子站长网站ID_子站长推广位ID
63 | /// 例如:618_618_6018
64 | ///
65 | public string Pid { get; set; }
66 | ///
67 | /// 不必填
68 | /// 描述:优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
69 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXX
70 | ///
71 | public string CouponUrl { get; set; }
72 | }
73 |
74 |
75 |
76 | ///
77 | /// 获取通用推广链接--响应参数
78 | /// 网站/APP来获取的推广链接,功能同宙斯接口的自定义链接转换、 APP领取代码接口通过商品链接、活动链接获取普通推广链接,支持传入subunionid参数,可用于区分媒体自身的用户ID。
79 | /// jd.union.open.promotion.common.get
80 | ///
81 | public class JdUnionOpenPromotionCommonGetResponse
82 | {
83 | ///
84 | /// 描述:生成的目标推广链接,长期有效
85 | /// 例如:http://union-click.jd.com/jdc?XXXXXXXXXX
86 | ///
87 | public string ClickURL { get; set; }
88 | }
89 |
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenPromotionBysubunionidGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 通过subUnionId获取推广链接【申请】--请求参数
7 | /// 通过商品链接、领券链接、活动链接获取普通推广链接或优惠券二合一推广链接,支持传入subunionid参数,可用于区分媒体自身的用户ID。需向cps-qxsq@jd.com申请权限。功能同宙斯接口的优惠券,商品二合一转接API-通过subUnionId获取推广链接、联盟微信手q通过subUnionId获取推广链接。
8 | /// jd.union.open.promotion.bysubunionid.get
9 | /// https://union.jd.com/openplatform/api/634
10 | ///
11 | public class JdUnionOpenPromotionBysubunionidGetRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenPromotionBysubunionidGetRequest() { }
14 |
15 | public JdUnionOpenPromotionBysubunionidGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.promotion.bysubunionid.get";
18 |
19 | protected override string ParamName => "promotionCodeReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:推广物料链接,建议链接使用微Q前缀,能较好适配微信手Q页面
27 | /// 例如:https://wqitem.jd.com/item/view?sku=23484023378
28 | ///
29 | public string MaterialId { get; set; }
30 | ///
31 | /// 不必填
32 | /// 描述:子联盟ID(需要联系运营开通权限才能拿到数据)
33 | /// 例如:618_18_c35***e6a
34 | ///
35 | public string SubUnionId { get; set; }
36 | ///
37 | /// 不必填
38 | /// 描述:推广位ID
39 | /// 例如:6
40 | ///
41 | public long? PositionId { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:子帐号身份标识,格式为子站长ID_子站长网站ID_子站长推广位ID
45 | /// 例如:618_618_6018
46 | ///
47 | public string Pid { get; set; }
48 | ///
49 | /// 不必填
50 | /// 描述:优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
51 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXX
52 | ///
53 | public string CouponUrl { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:转链类型,1:长链, 2 :短链 ,3: 长链+短链,默认短链
57 | /// 例如:1
58 | ///
59 | public int? ChainType { get; set; }
60 | }
61 |
62 |
63 |
64 | ///
65 | /// 通过subUnionId获取推广链接【申请】--响应参数
66 | /// 通过商品链接、领券链接、活动链接获取普通推广链接或优惠券二合一推广链接,支持传入subunionid参数,可用于区分媒体自身的用户ID。需向cps-qxsq@jd.com申请权限。功能同宙斯接口的优惠券,商品二合一转接API-通过subUnionId获取推广链接、联盟微信手q通过subUnionId获取推广链接。
67 | /// jd.union.open.promotion.bysubunionid.get
68 | ///
69 | public class JdUnionOpenPromotionBysubunionidGetResponse
70 | {
71 | ///
72 | /// 描述:生成的推广目标链接,以短链接形式,有效期60天
73 | /// 例如:https://u.jd.com/XXXXX
74 | ///
75 | public string ShortURL { get; set; }
76 | ///
77 | /// 描述:生成推广目标的长链,长期有效
78 | /// 例如:https://union-click.jd.com/jdc?e=XXXXXX&p=XXXXXXXXXXX
79 | ///
80 | public string ClickURL { get; set; }
81 | }
82 |
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenPromotionByunionidGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 通过unionId获取推广链接【申请】--请求参数
7 | /// 工具商媒体帮助子站长获取普通推广链接和优惠券二合一推广链接,可传入PID参数以区分子站长的推广位,该参数可在订单查询接口返回。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.promotion.byunionid.get
9 | /// https://union.jd.com/openplatform/api/631
10 | ///
11 | public class JdUnionOpenPromotionByunionidGetRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenPromotionByunionidGetRequest() { }
14 |
15 | public JdUnionOpenPromotionByunionidGetRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.promotion.byunionid.get";
18 |
19 | protected override string ParamName => "promotionCodeReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:推广物料链接,建议链接使用微Q前缀,能较好适配微信手Q页面
27 | /// 例如:https://wqitem.jd.com/item/view?sku=23484023378
28 | ///
29 | public string MaterialId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:目标推客的联盟ID
33 | /// 例如:10000618
34 | ///
35 | public long? UnionId { get; set; }
36 | ///
37 | /// 不必填
38 | /// 描述:新增推广位id (不填的话,为其默认生成一个唯一此接口推广位-名称:微信手Q短链接)
39 | /// 例如:6
40 | ///
41 | public long? PositionId { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:子帐号身份标识,格式为子站长ID_子站长网站ID_子站长推广位ID
45 | /// 例如:618_618_6018
46 | ///
47 | public string Pid { get; set; }
48 | ///
49 | /// 不必填
50 | /// 描述:优惠券领取链接,在使用优惠券、商品二合一功能时入参,且materialId须为商品详情页链接
51 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXX
52 | ///
53 | public string CouponUrl { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:子联盟ID(需要联系运营开通权限才能拿到数据)
57 | /// 例如:618_18_c35***e6a
58 | ///
59 | public string SubUnionId { get; set; }
60 | ///
61 | /// 不必填
62 | /// 描述:转链类型,1:长链, 2 :短链 ,3: 长链+短链,默认短链
63 | /// 例如:1
64 | ///
65 | public int? ChainType { get; set; }
66 | }
67 |
68 |
69 |
70 | ///
71 | /// 通过unionId获取推广链接【申请】--响应参数
72 | /// 工具商媒体帮助子站长获取普通推广链接和优惠券二合一推广链接,可传入PID参数以区分子站长的推广位,该参数可在订单查询接口返回。需向cps-qxsq@jd.com申请权限。
73 | /// jd.union.open.promotion.byunionid.get
74 | ///
75 | public class JdUnionOpenPromotionByunionidGetResponse
76 | {
77 | ///
78 | /// 描述:生成的推广目标链接,以短链接形式,有效期60天
79 | /// 例如:https://u.jd.com/XXXXX
80 | ///
81 | public string ShortURL { get; set; }
82 | ///
83 | /// 描述:生成推广目标的长链,长期有效
84 | /// 例如:https://union-click.jd.com/jdc?e=XXXXXX&p=XXXXXXXXXXX
85 | ///
86 | public string ClickURL { get; set; }
87 | }
88 |
89 | }
90 |
91 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsZsUnitUrlGen.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多进宝转链接口--请求参数
8 | /// 本功能适用于采集群等场景。将其他推广者的推广链接转换成自己的;通过此api,可以将他人的招商推广链接,转换成自己的招商推广链接。
9 | /// pdd.ddk.goods.zs.unit.url.gen
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.zs.unit.url.gen
11 | ///
12 | public class PddDdkGoodsZsUnitUrlGenRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.zs.unit.url.gen";
15 |
16 | public PddDdkGoodsZsUnitUrlGenRequest() { }
17 |
18 | public PddDdkGoodsZsUnitUrlGenRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 需转链的链接
25 | ///
26 | public string SourceUrl { get; set; }
27 | ///
28 | /// 必填
29 | /// 渠道id
30 | ///
31 | public string Pid { get; set; }
32 | }
33 |
34 |
35 | ///
36 | /// 多多进宝转链接口--响应参数
37 | /// 本功能适用于采集群等场景。将其他推广者的推广链接转换成自己的;通过此api,可以将他人的招商推广链接,转换成自己的招商推广链接。
38 | ///
39 | public class PddDdkGoodsZsUnitUrlGenResponse : PddBaseResponse
40 | {
41 | ///
42 | /// goods_zs_unit_generate_response
43 | ///
44 | [JsonProperty("goods_zs_unit_generate_response")]
45 | public PddDdkGoodsZsUnitUrlGen_GoodsZsUnitGenerateResponse GoodsZsUnitGenerateResponse { get; set; }
46 | }
47 |
48 | ///
49 | /// goods_zs_unit_generate_response
50 | ///
51 | public class PddDdkGoodsZsUnitUrlGen_GoodsZsUnitGenerateResponse
52 | {
53 | ///
54 | /// 单人团推广长链接
55 | ///
56 | [JsonProperty("url")]
57 | public string Url { get; set; }
58 | ///
59 | /// 单人团推广短链接
60 | ///
61 | [JsonProperty("short_url")]
62 | public string ShortUrl { get; set; }
63 | ///
64 | /// 推广长链接(唤起拼多多app)
65 | ///
66 | [JsonProperty("mobile_url")]
67 | public string MobileUrl { get; set; }
68 | ///
69 | /// 推广短链接(可唤起拼多多app)
70 | ///
71 | [JsonProperty("mobile_short_url")]
72 | public string MobileShortUrl { get; set; }
73 | ///
74 | /// 双人团推广长链接
75 | ///
76 | [JsonProperty("multi_group_url")]
77 | public string MultiGroupUrl { get; set; }
78 | ///
79 | /// 双人团推广短链接
80 | ///
81 | [JsonProperty("multi_group_short_url")]
82 | public string MultiGroupShortUrl { get; set; }
83 | ///
84 | /// 推广长链接(可唤起拼多多app)
85 | ///
86 | [JsonProperty("multi_group_mobile_url")]
87 | public string MultiGroupMobileUrl { get; set; }
88 | ///
89 | /// 推广短链接(唤起拼多多app)
90 | ///
91 | [JsonProperty("multi_group_mobile_short_url")]
92 | public string MultiGroupMobileShortUrl { get; set; }
93 | }
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenCouponQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 优惠券领取情况查询接口【申请】--请求参数
7 | /// 通过领券链接查询优惠券的平台、面额、期限、可用状态、剩余数量等详细信息,通常用于和商品信息一起展示优惠券券信息。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.coupon.query
9 | /// https://union.jd.com/openplatform/api/627
10 | ///
11 | public class JdUnionOpenCouponQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenCouponQueryRequest() { }
14 |
15 | public JdUnionOpenCouponQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.coupon.query";
18 |
19 | ///
20 | /// 必填
21 | /// 描述:优惠券链接集合;上限10(GET请求);上限50(POST请求或SDK调用)
22 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXX
23 | ///
24 | public string[] CouponUrls { get; set; }
25 |
26 | protected override string ParamName => "couponUrls";
27 |
28 | public async Task> InvokeAsync()
29 | => await PostAsync>();
30 |
31 | }
32 |
33 |
34 |
35 | ///
36 | /// 优惠券领取情况查询接口【申请】--响应参数
37 | /// 通过领券链接查询优惠券的平台、面额、期限、可用状态、剩余数量等详细信息,通常用于和商品信息一起展示优惠券券信息。需向cps-qxsq@jd.com申请权限。
38 | /// jd.union.open.coupon.query
39 | ///
40 | public class JdUnionOpenCouponQueryResponse
41 | {
42 | ///
43 | /// 描述:券领取结束时间(时间戳,毫秒)
44 | /// 例如:1532966460000
45 | ///
46 | public long? TakeEndTime { get; set; }
47 | ///
48 | /// 描述:券领取开始时间(时间戳,毫秒)
49 | /// 例如:1531065600000
50 | ///
51 | public long? TakeBeginTime { get; set; }
52 | ///
53 | /// 描述:券剩余张数
54 | /// 例如:9990
55 | ///
56 | public long? RemainNum { get; set; }
57 | ///
58 | /// 描述:券有效状态
59 | /// 例如:是
60 | ///
61 | public string Yn { get; set; }
62 | ///
63 | /// 描述:券总张数
64 | /// 例如:10000
65 | ///
66 | public long? Num { get; set; }
67 | ///
68 | /// 描述:券消费限额
69 | /// 例如:15
70 | ///
71 | public double? Quota { get; set; }
72 | ///
73 | /// 描述:券链接
74 | /// 例如:http://coupon.jd.com/ilink/get/get_coupon.action?XXXXXXXXXXX
75 | ///
76 | public string Link { get; set; }
77 | ///
78 | /// 描述:券面额
79 | /// 例如:10
80 | ///
81 | public double? Discount { get; set; }
82 | ///
83 | /// 描述:券有效使用开始时间(时间戳,毫秒)
84 | /// 例如:1531065600000
85 | ///
86 | public long? BeginTime { get; set; }
87 | ///
88 | /// 描述:券有效使用结束时间(时间戳,毫秒)
89 | /// 例如:1533052799000
90 | ///
91 | public long? EndTime { get; set; }
92 | ///
93 | /// 描述:券使用平台
94 | /// 例如:全平台
95 | ///
96 | public string Platform { get; set; }
97 | }
98 |
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenGoodsLinkQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 链接商品查询接口【申请】--请求参数
7 | /// 链接商品查询接口
8 | /// jd.union.open.goods.link.query
9 | /// https://union.jd.com/openplatform/api/762
10 | ///
11 | public class JdUnionOpenGoodsLinkQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenGoodsLinkQueryRequest() { }
14 |
15 | public JdUnionOpenGoodsLinkQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.goods.link.query";
18 |
19 | protected override string ParamName => "goodsReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:链接
27 | /// 例如:https://item.jd.com/product/12473772.html
28 | ///
29 | public string Url { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:子联盟ID(需要联系运营开通权限才能拿到数据)
33 | /// 例如:618_18_c35***e6a
34 | ///
35 | public string SubUnionId { get; set; }
36 | }
37 |
38 |
39 |
40 | ///
41 | /// 链接商品查询接口【申请】--响应参数
42 | /// 链接商品查询接口
43 | /// jd.union.open.goods.link.query
44 | ///
45 | public class JdUnionOpenGoodsLinkQueryResponse
46 | {
47 | ///
48 | /// 描述:skuId
49 | /// 例如:12473772
50 | ///
51 | public long? SkuId { get; set; }
52 | ///
53 | /// 描述:productId
54 | /// 例如:11484833
55 | ///
56 | public long? ProductId { get; set; }
57 | ///
58 | /// 描述:图片集,逗号','分割,首张为主图
59 | /// 例如:http://img14.360buyimg.com/ads/jfs/t25954/302/2427470833/110079/25edd6bf/5be5569aN4cab581d.jpg,http://img14.360buyimg.com/ads/jfs/t29152/135/448393735/356276/f377ac44/5bf3de8cNaec7256a.jpg
60 | ///
61 | public string Images { get; set; }
62 | ///
63 | /// 描述:商品名称
64 | /// 例如:蔡康永的情商课:为你自己活一次(继《说话之道》热销400万册后,蔡康永再次奉上“内心强大之道
65 | ///
66 | public string SkuName { get; set; }
67 | ///
68 | /// 描述:京东价,单位:元
69 | /// 例如:37.4
70 | ///
71 | public double? Price { get; set; }
72 | ///
73 | /// 描述:佣金比例,单位:%
74 | /// 例如:10.0
75 | ///
76 | public double? CosRatio { get; set; }
77 | ///
78 | /// 描述:短链接
79 | /// 例如:https://u.jd.com/JMIOpg
80 | ///
81 | public string ShortUrl { get; set; }
82 | ///
83 | /// 描述:店铺id
84 | /// 例如:1000005647
85 | ///
86 | public string ShopId { get; set; }
87 | ///
88 | /// 描述:店铺名称
89 | /// 例如:博集天卷
90 | ///
91 | public string ShopName { get; set; }
92 | ///
93 | /// 描述:30天引单量
94 | /// 例如:3000
95 | ///
96 | public long? Sales { get; set; }
97 | ///
98 | /// 描述:是否自营,g:自营,p:pop
99 | /// 例如:g
100 | ///
101 | public string IsSelf { get; set; }
102 | }
103 |
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenPositionQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 查询推广位【申请】--请求参数
7 | /// 工具商媒体帮助子站长查询推广位。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.position.query
9 | /// https://union.jd.com/openplatform/api/656
10 | ///
11 | public class JdUnionOpenPositionQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenPositionQueryRequest() { }
14 |
15 | public JdUnionOpenPositionQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.position.query";
18 |
19 | protected override string ParamName => "positionReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:需要查询的目标联盟id
27 | /// 例如:10000618
28 | ///
29 | public long? UnionId { get; set; }
30 | ///
31 | /// 必填
32 | /// 描述:目标联盟ID对应的授权key,在联盟推广管理页领取
33 | /// 例如:
34 | ///
35 | public string Key { get; set; }
36 | ///
37 | /// 必填
38 | /// 描述:联盟推广位类型,1:cps推广位 2:cpc推广位
39 | /// 例如:1
40 | ///
41 | public int? UnionType { get; set; }
42 | ///
43 | /// 必填
44 | /// 描述:页码,上限10000
45 | /// 例如:1
46 | ///
47 | public int? PageIndex { get; set; }
48 | ///
49 | /// 必填
50 | /// 描述:每页条数,上限100
51 | /// 例如:20
52 | ///
53 | public int? PageSize { get; set; }
54 | }
55 |
56 |
57 |
58 | ///
59 | /// 查询推广位【申请】--响应参数
60 | /// 工具商媒体帮助子站长查询推广位。需向cps-qxsq@jd.com申请权限。
61 | /// jd.union.open.position.query
62 | ///
63 | public class JdUnionOpenPositionQueryResponse
64 | {
65 | ///
66 | /// 描述:页码
67 | /// 例如:1
68 | ///
69 | public int? PageNo { get; set; }
70 | ///
71 | /// 描述:每页数量
72 | /// 例如:10
73 | ///
74 | public int? PageSize { get; set; }
75 | ///
76 | /// 描述:返回结果
77 | /// 例如:
78 | ///
79 | public JdUnionOpenPositionQuery_Positionresp[] Result { get; set; }
80 | ///
81 | /// 描述:总数
82 | /// 例如:3
83 | ///
84 | public long? Total { get; set; }
85 | }
86 |
87 | ///
88 | /// 返回结果
89 | ///
90 | public class JdUnionOpenPositionQuery_Positionresp
91 | {
92 | ///
93 | /// 描述:推广位ID
94 | /// 例如:6188886186
95 | ///
96 | public long? Id { get; set; }
97 | ///
98 | /// 描述:站点ID,如网站ID/appID/snsID
99 | /// 例如:0
100 | ///
101 | public long? SiteId { get; set; }
102 | ///
103 | /// 描述:推广位名称
104 | /// 例如:test3
105 | ///
106 | public string SpaceName { get; set; }
107 | ///
108 | /// 描述:站点类型(1网站推广位2.APP推广位3.社交媒体推广位4.聊天工具推广位)
109 | /// 例如:4
110 | ///
111 | public long? Type { get; set; }
112 | }
113 | }
114 |
115 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkMallUrlGen.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多客生成店铺推广链接API--请求参数
8 | /// 多多客工具生成店铺推广链接API
9 | /// pdd.ddk.mall.url.gen
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.mall.url.gen
11 | ///
12 | public class PddDdkMallUrlGenRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.mall.url.gen";
15 |
16 | public PddDdkMallUrlGenRequest() { }
17 |
18 | public PddDdkMallUrlGenRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 店铺id
25 | ///
26 | public long? MallId { get; set; }
27 | ///
28 | /// 必填
29 | /// 推广位
30 | ///
31 | public string Pid { get; set; }
32 | ///
33 | /// 不必填
34 | /// 是否生成唤起微信客户端链接,true-是,false-否,默认false
35 | ///
36 | public bool? GenerateWeappWebview { get; set; }
37 | ///
38 | /// 不必填
39 | /// 是否生成短链接,true-是,false-否
40 | ///
41 | public bool? GenerateShortUrl { get; set; }
42 | ///
43 | /// 不必填
44 | /// true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手
45 | ///
46 | public bool? MultiGroup { get; set; }
47 | ///
48 | /// 不必填
49 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节
50 | ///
51 | public string CustomParameters { get; set; }
52 | }
53 |
54 |
55 | ///
56 | /// 多多客生成店铺推广链接API--响应参数
57 | /// 多多客工具生成店铺推广链接API
58 | ///
59 | public class PddDdkMallUrlGenResponse : PddBaseResponse
60 | {
61 | ///
62 | /// mall_coupon_generate_url_response
63 | ///
64 | [JsonProperty("mall_coupon_generate_url_response")]
65 | public PddDdkMallUrlGen_MallCouponGenerateUrlResponse MallCouponGenerateUrlResponse { get; set; }
66 | }
67 |
68 | ///
69 | /// 推广链接
70 | ///
71 | public class PddDdkMallUrlGen_List
72 | {
73 | ///
74 | /// 推广长链接
75 | ///
76 | [JsonProperty("url")]
77 | public string Url { get; set; }
78 | ///
79 | /// 推广短链接
80 | ///
81 | [JsonProperty("short_url")]
82 | public string ShortUrl { get; set; }
83 | ///
84 | /// 唤醒拼多多app的推广长链接
85 | ///
86 | [JsonProperty("mobile_url")]
87 | public string MobileUrl { get; set; }
88 | ///
89 | /// 唤醒拼多多app的推广短链接
90 | ///
91 | [JsonProperty("mobile_short_url")]
92 | public string MobileShortUrl { get; set; }
93 | ///
94 | /// 唤起微信app推广链接
95 | ///
96 | [JsonProperty("we_app_web_view_url")]
97 | public string WeAppWebViewUrl { get; set; }
98 | ///
99 | /// 唤起微信app推广短链接
100 | ///
101 | [JsonProperty("we_app_web_view_short_url")]
102 | public string WeAppWebViewShortUrl { get; set; }
103 | }
104 | ///
105 | /// mall_coupon_generate_url_response
106 | ///
107 | public class PddDdkMallUrlGen_MallCouponGenerateUrlResponse
108 | {
109 | ///
110 | /// 推广链接
111 | ///
112 | [JsonProperty("list")]
113 | public PddDdkMallUrlGen_List[] List { get; set; }
114 | }
115 | }
116 |
117 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkRpPromUrlGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 生成红包推广链接--请求参数
8 | /// 生成红包推广链接接口
9 | /// pdd.ddk.rp.prom.url.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.rp.prom.url.generate
11 | ///
12 | public class PddDdkRpPromUrlGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.rp.prom.url.generate";
15 |
16 | public PddDdkRpPromUrlGenerateRequest() { }
17 |
18 | public PddDdkRpPromUrlGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 是否生成短链接。true-是,false-否,默认false
25 | ///
26 | public bool? GenerateShortUrl { get; set; }
27 | ///
28 | /// 必填
29 | /// 推广位列表,例如:["60005_612"]
30 | ///
31 | public string[] PIdList { get; set; }
32 | ///
33 | /// 不必填
34 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
35 | ///
36 | public string CustomParameters { get; set; }
37 | ///
38 | /// 必填
39 | /// 是否唤起微信客户端, 默认false 否,true 是
40 | ///
41 | public bool? GenerateWeappWebview { get; set; }
42 | ///
43 | /// 不必填
44 | /// 唤起微信app推广短链接
45 | ///
46 | public bool? WeAppWebViewShortUrl { get; set; }
47 | ///
48 | /// 不必填
49 | /// 唤起微信app推广链接
50 | ///
51 | public bool? WeAppWebWiewUrl { get; set; }
52 | ///
53 | /// 不必填
54 | /// 是否生成小程序推广
55 | ///
56 | public bool? GenerateWeApp { get; set; }
57 | }
58 |
59 |
60 | ///
61 | /// 生成红包推广链接--响应参数
62 | /// 生成红包推广链接接口
63 | ///
64 | public class PddDdkRpPromUrlGenerateResponse : PddBaseResponse
65 | {
66 | ///
67 | /// 红包推广链接返回对象
68 | ///
69 | [JsonProperty("rp_promotion_url_generate_response")]
70 | public PddDdkRpPromUrlGenerate_RpPromotionUrlGenerateResponse RpPromotionUrlGenerateResponse { get; set; }
71 | }
72 |
73 | ///
74 | /// url_list
75 | ///
76 | public class PddDdkRpPromUrlGenerate_UrlList
77 | {
78 | ///
79 | /// 红包推广链接
80 | ///
81 | [JsonProperty("url")]
82 | public string Url { get; set; }
83 | ///
84 | /// 红包推广短链接
85 | ///
86 | [JsonProperty("short_url")]
87 | public string ShortUrl { get; set; }
88 | ///
89 | /// 红包推广移动链接
90 | ///
91 | [JsonProperty("mobile_url")]
92 | public string MobileUrl { get; set; }
93 | ///
94 | /// 红包推广移动短链接
95 | ///
96 | [JsonProperty("mobile_short_url")]
97 | public string MobileShortUrl { get; set; }
98 | ///
99 | /// 红包推广多人团链接
100 | ///
101 | [JsonProperty("multi_group_url")]
102 | public string MultiGroupUrl { get; set; }
103 | ///
104 | /// 红包推广多人团短链接
105 | ///
106 | [JsonProperty("multi_group_short_url")]
107 | public string MultiGroupShortUrl { get; set; }
108 | ///
109 | /// 红包推广多人团移动链接
110 | ///
111 | [JsonProperty("multi_group_mobile_url")]
112 | public string MultiGroupMobileUrl { get; set; }
113 | ///
114 | /// 红包推广多人团移动短链接
115 | ///
116 | [JsonProperty("multi_group_mobile_short_url")]
117 | public string MultiGroupMobileShortUrl { get; set; }
118 | }
119 | ///
120 | /// 红包推广链接返回对象
121 | ///
122 | public class PddDdkRpPromUrlGenerate_RpPromotionUrlGenerateResponse
123 | {
124 | ///
125 | /// url_list
126 | ///
127 | [JsonProperty("url_list")]
128 | public PddDdkRpPromUrlGenerate_UrlList[] UrlList { get; set; }
129 | }
130 | }
131 |
132 |
--------------------------------------------------------------------------------
/src/src.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29009.5
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tool", "Tool\Tool.csproj", "{F8800636-B7D2-4B41-83AE-B14810DEC621}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jd.Sdk", "Jd.Sdk\Jd.Sdk.csproj", "{504DED67-37B5-4A67-83C5-1BB30863F8A5}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test", "..\test\Test.csproj", "{939E8B05-6B61-405F-966A-B2E6DDB52FBC}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Debug|x64 = Debug|x64
18 | Debug|x86 = Debug|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|x64 = Release|x64
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|x64.ActiveCfg = Debug|Any CPU
27 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|x64.Build.0 = Debug|Any CPU
28 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|x86.ActiveCfg = Debug|Any CPU
29 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Debug|x86.Build.0 = Debug|Any CPU
30 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|x64.ActiveCfg = Release|Any CPU
33 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|x64.Build.0 = Release|Any CPU
34 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|x86.ActiveCfg = Release|Any CPU
35 | {F8800636-B7D2-4B41-83AE-B14810DEC621}.Release|x86.Build.0 = Release|Any CPU
36 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
38 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|x64.ActiveCfg = Debug|Any CPU
39 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|x64.Build.0 = Debug|Any CPU
40 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|x86.ActiveCfg = Debug|Any CPU
41 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Debug|x86.Build.0 = Debug|Any CPU
42 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|x64.ActiveCfg = Release|Any CPU
45 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|x64.Build.0 = Release|Any CPU
46 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|x86.ActiveCfg = Release|Any CPU
47 | {504DED67-37B5-4A67-83C5-1BB30863F8A5}.Release|x86.Build.0 = Release|Any CPU
48 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|x64.ActiveCfg = Debug|Any CPU
51 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|x64.Build.0 = Debug|Any CPU
52 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|x86.ActiveCfg = Debug|Any CPU
53 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Debug|x86.Build.0 = Debug|Any CPU
54 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|Any CPU.Build.0 = Release|Any CPU
56 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|x64.ActiveCfg = Release|Any CPU
57 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|x64.Build.0 = Release|Any CPU
58 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|x86.ActiveCfg = Release|Any CPU
59 | {6B4D8F0E-65AF-42E9-B3B7-C8F568B821B8}.Release|x86.Build.0 = Release|Any CPU
60 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
62 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|x64.ActiveCfg = Debug|Any CPU
63 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|x64.Build.0 = Debug|Any CPU
64 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|x86.ActiveCfg = Debug|Any CPU
65 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Debug|x86.Build.0 = Debug|Any CPU
66 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
67 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|Any CPU.Build.0 = Release|Any CPU
68 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|x64.ActiveCfg = Release|Any CPU
69 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|x64.Build.0 = Release|Any CPU
70 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|x86.ActiveCfg = Release|Any CPU
71 | {939E8B05-6B61-405F-966A-B2E6DDB52FBC}.Release|x86.Build.0 = Release|Any CPU
72 | EndGlobalSection
73 | GlobalSection(SolutionProperties) = preSolution
74 | HideSolutionNode = FALSE
75 | EndGlobalSection
76 | GlobalSection(ExtensibilityGlobals) = postSolution
77 | SolutionGuid = {53D9B84C-F1BA-434D-8E6D-1B3AF1235127}
78 | EndGlobalSection
79 | EndGlobal
80 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkResourceUrlGen.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 生成多多进宝频道推广--请求参数
8 | /// 生成拼多多主站频道推广
9 | /// pdd.ddk.resource.url.gen
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.resource.url.gen
11 | ///
12 | public class PddDdkResourceUrlGenRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.resource.url.gen";
15 |
16 | public PddDdkResourceUrlGenRequest() { }
17 |
18 | public PddDdkResourceUrlGenRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节
25 | ///
26 | public string CustomParameters { get; set; }
27 | ///
28 | /// 必填
29 | /// 推广位
30 | ///
31 | public string Pid { get; set; }
32 | ///
33 | /// 不必填
34 | /// 频道来源:4-限时秒杀,39997-充值中心, 39998-转链type,39999-电器城
35 | ///
36 | public int? ResourceType { get; set; }
37 | ///
38 | /// 不必填
39 | /// 原链接
40 | ///
41 | public string Url { get; set; }
42 | }
43 |
44 |
45 | ///
46 | /// 生成多多进宝频道推广--响应参数
47 | /// 生成拼多多主站频道推广
48 | ///
49 | public class PddDdkResourceUrlGenResponse : PddBaseResponse
50 | {
51 | ///
52 | /// resource_url_response
53 | ///
54 | [JsonProperty("resource_url_response")]
55 | public PddDdkResourceUrlGen_ResourceUrlResponse ResourceUrlResponse { get; set; }
56 | }
57 |
58 | ///
59 | /// 多人团链接
60 | ///
61 | public class PddDdkResourceUrlGen_MultiUrlList
62 | {
63 | ///
64 | /// 频道推广唤醒拼多多APP短链接
65 | ///
66 | [JsonProperty("mobile_short_url")]
67 | public string MobileShortUrl { get; set; }
68 | ///
69 | /// 频道推广唤醒拼多多APP长链接
70 | ///
71 | [JsonProperty("mobile_url")]
72 | public string MobileUrl { get; set; }
73 | ///
74 | /// 频道推广短链接
75 | ///
76 | [JsonProperty("short_url")]
77 | public string ShortUrl { get; set; }
78 | ///
79 | /// 频道推广长链接
80 | ///
81 | [JsonProperty("url")]
82 | public string Url { get; set; }
83 | ///
84 | /// 小程序信息
85 | ///
86 | [JsonProperty("we_app_page_path")]
87 | public string WeAppPagePath { get; set; }
88 | ///
89 | /// 频道推广唤醒微信短链接
90 | ///
91 | [JsonProperty("we_app_web_view_short_url")]
92 | public string WeAppWebViewShortUrl { get; set; }
93 | ///
94 | /// 频道推广唤醒微信长链接
95 | ///
96 | [JsonProperty("we_app_web_view_url")]
97 | public string WeAppWebViewUrl { get; set; }
98 | }
99 | ///
100 | /// 单人团链接
101 | ///
102 | public class PddDdkResourceUrlGen_SingleUrlList
103 | {
104 | ///
105 | /// 频道推广唤醒拼多多APP短链接
106 | ///
107 | [JsonProperty("mobile_short_url")]
108 | public string MobileShortUrl { get; set; }
109 | ///
110 | /// 频道推广唤醒拼多多APP长链接
111 | ///
112 | [JsonProperty("mobile_url")]
113 | public string MobileUrl { get; set; }
114 | ///
115 | /// 频道推广短链接
116 | ///
117 | [JsonProperty("short_url")]
118 | public string ShortUrl { get; set; }
119 | ///
120 | /// 频道推广长链接
121 | ///
122 | [JsonProperty("url")]
123 | public string Url { get; set; }
124 | ///
125 | /// 小程序信息
126 | ///
127 | [JsonProperty("we_app_page_path")]
128 | public string WeAppPagePath { get; set; }
129 | ///
130 | /// 频道推广唤醒微信短链接
131 | ///
132 | [JsonProperty("we_app_web_view_short_url")]
133 | public string WeAppWebViewShortUrl { get; set; }
134 | ///
135 | /// 频道推广唤醒微信长链接
136 | ///
137 | [JsonProperty("we_app_web_view_url")]
138 | public string WeAppWebViewUrl { get; set; }
139 | }
140 | ///
141 | /// resource_url_response
142 | ///
143 | public class PddDdkResourceUrlGen_ResourceUrlResponse
144 | {
145 | ///
146 | /// 多人团链接
147 | ///
148 | [JsonProperty("multi_url_list")]
149 | public PddDdkResourceUrlGen_MultiUrlList MultiUrlList { get; set; }
150 | ///
151 | /// 单人团链接
152 | ///
153 | [JsonProperty("single_url_list")]
154 | public PddDdkResourceUrlGen_SingleUrlList SingleUrlList { get; set; }
155 | }
156 | }
157 |
158 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/PddBaseRequest.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using Common;
5 | using Flurl.Http;
6 | using Microsoft.Extensions.Configuration;
7 | using System;
8 | using System.Text;
9 | using System.Web;
10 | using Newtonsoft.Json;
11 | using System.Diagnostics;
12 |
13 | namespace Pdd.Sdk
14 | {
15 | public abstract class PddBaseRequest
16 | {
17 | ///
18 | /// 必填
19 | /// UNIX时间戳,单位秒,需要与拼多多服务器时间差值在10分钟内
20 | ///
21 | protected readonly string _timestamp;
22 |
23 | ///
24 | /// 必填
25 | /// client_secret
26 | ///
27 | private readonly string _clientSecret;
28 |
29 | ///
30 | /// 必填
31 | /// POP分配给应用的client_id
32 | ///
33 | private readonly string _clientId;
34 |
35 | protected PddBaseRequest()
36 | {
37 | var config = new ConfigurationBuilder()
38 | .AddJsonFile("appsettings.json")
39 | .Build();
40 | _timestamp = Time.GetTimeStampSecond();
41 | _clientId = config.GetSection("Pdd.Sdk")["ClientId"];
42 | _clientSecret = config.GetSection("Pdd.Sdk")["ClientSecret"];
43 | }
44 |
45 | protected PddBaseRequest(string clientId, string clientSecret)
46 | {
47 | _timestamp = Time.GetTimeStampSecond();
48 | _clientId = clientId;
49 | _clientSecret = clientSecret;
50 | }
51 |
52 | private const string _baseUrl = "http://gw-api.pinduoduo.com/api/router";
53 |
54 | ///
55 | /// 必填
56 | /// API接口名称
57 | ///
58 | protected abstract string Type { get; }
59 |
60 | ///
61 | /// 不必填
62 | /// 通过code获取的access_token(无需授权的接口,该字段不参与sign签名运算)
63 | ///
64 | protected string AccessToken { get; set; }
65 |
66 | public object DebugInfo { get; private set; }
67 |
68 | protected async Task PostAsync()
69 | where TResponse : PddBaseResponse
70 | {
71 | var dicParams = new Dictionary
72 | {
73 | { "timestamp", _timestamp },
74 | { "client_id", _clientId },
75 | { "type", Type },
76 | { "data_type", "JSON" },
77 | { "version", "V1" }
78 | };
79 |
80 | var dicDerive = GetType()
81 | .GetProperties()
82 | .Where(x =>
83 | {
84 | if (x.Name == nameof(DebugInfo)) return false;
85 | var val = x.GetValue(this);
86 | if (val is string str)
87 | {
88 | return !string.IsNullOrWhiteSpace(str);
89 | }
90 | return val != null;
91 | })
92 | .ToDictionary(
93 | x => ConvertExtend.UpperToUnderline(x.Name), x => x.GetValue(this).ToString());
94 |
95 | foreach (var item in dicDerive)
96 | {
97 | dicParams.Add(item.Key, item.Value);
98 | }
99 | var sign = Sign.SignToMd5(dicParams.ToDictionary(x => x.Key, x => x.Value), _clientSecret);
100 | var urlParams = $"?sign={sign}";
101 | foreach (var item in dicParams)
102 | {
103 | urlParams += $"&{item.Key}={HttpUtility.UrlEncode(item.Value, Encoding.UTF8)}";
104 | }
105 |
106 | var url = _baseUrl + urlParams;
107 | Debug.WriteLine(url);
108 | var async = await url.PostStringAsync(string.Empty);
109 | var @string = await async.Content.ReadAsStringAsync();
110 | Debug.WriteLine(@string);
111 | try
112 | {
113 | if (@string.Contains("\"error_response\":{\"error_msg\":\"")) // todo 有注入的风险
114 | {
115 | var resError = JsonConvert.DeserializeObject>(@string);
116 | DebugInfo = new
117 | {
118 | url,
119 | resError
120 | };
121 | return default;
122 | }
123 | var res = JsonConvert.DeserializeObject>(@string);
124 | DebugInfo = new
125 | {
126 | url,
127 | res
128 | };
129 | return res.First().Value;
130 | }
131 | catch (Exception ex)
132 | {
133 | DebugInfo = new
134 | {
135 | url,
136 | @string,
137 | ex
138 | };
139 | return default;
140 | }
141 | }
142 | }
143 |
144 | public abstract class PddPageBaseRequest : PddBaseRequest
145 | {
146 | ///
147 | /// 必填
148 | /// 页大小
149 | ///
150 | ///
151 | public int PageSize { get; set; }
152 | ///
153 | /// 必填
154 | /// 页
155 | ///
156 | ///
157 | public int Page { get; set; }
158 | }
159 | }
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenGoodsPromotiongoodsinfoQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 获取推广商品信息接口--请求参数
7 | /// 通过SKUID查询推广商品的名称、主图、类目、价格、物流、是否自营、30天引单数量等详细信息,支持批量获取。通常用于在媒体侧展示商品详情。
8 | /// jd.union.open.goods.promotiongoodsinfo.query
9 | /// https://union.jd.com/openplatform/api/563
10 | ///
11 | public class JdUnionOpenGoodsPromotiongoodsinfoQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenGoodsPromotiongoodsinfoQueryRequest() { }
14 |
15 | public JdUnionOpenGoodsPromotiongoodsinfoQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.goods.promotiongoodsinfo.query";
18 |
19 | ///
20 | /// 必填
21 | /// 描述:京东skuID串,逗号分割,最多100个(非常重要 请大家关注:如果输入的sk串中某个skuID的商品不在推广中[就是没有佣金],返回结果中不会包含这个商品的信息
22 | /// 例如:5225346,7275691
23 | ///
24 | public string SkuIds { get; set; }
25 |
26 | protected override string ParamName => "skuIds";
27 |
28 | public async Task> InvokeAsync()
29 | => await PostAsync>();
30 |
31 | }
32 |
33 |
34 |
35 | ///
36 | /// 获取推广商品信息接口--响应参数
37 | /// 通过SKUID查询推广商品的名称、主图、类目、价格、物流、是否自营、30天引单数量等详细信息,支持批量获取。通常用于在媒体侧展示商品详情。
38 | /// jd.union.open.goods.promotiongoodsinfo.query
39 | ///
40 | public class JdUnionOpenGoodsPromotiongoodsinfoQueryResponse
41 | {
42 | ///
43 | /// 描述:商品ID
44 | /// 例如:61861866
45 | ///
46 | public long? SkuId { get; set; }
47 | ///
48 | /// 描述:商品单价即京东价
49 | /// 例如:89
50 | ///
51 | public double? UnitPrice { get; set; }
52 | ///
53 | /// 描述:商品落地页
54 | /// 例如:http://item.jd.com/10000000.html
55 | ///
56 | public string MaterialUrl { get; set; }
57 | ///
58 | /// 描述:推广结束日期(时间戳,毫秒)
59 | /// 例如:32472115200000
60 | ///
61 | public long? EndDate { get; set; }
62 | ///
63 | /// 描述:是否支持运费险(1:是,0:否)
64 | /// 例如:0
65 | ///
66 | public int? IsFreeFreightRisk { get; set; }
67 | ///
68 | /// 描述:是否包邮(1:是,0:否,2:自营商品遵从主站包邮规则)
69 | /// 例如:1
70 | ///
71 | public int? IsFreeShipping { get; set; }
72 | ///
73 | /// 描述:无线佣金比例
74 | /// 例如:25
75 | ///
76 | public double? CommisionRatioWl { get; set; }
77 | ///
78 | /// 描述:PC佣金比例
79 | /// 例如:25
80 | ///
81 | public double? CommisionRatioPc { get; set; }
82 | ///
83 | /// 描述:图片地址
84 | /// 例如:http://img14.360buyimg.com/n1/jfs/t18901/86/XXXXXXXX/498446/725fedfc/5af7c7e1N8b133379.jpg
85 | ///
86 | public string ImgUrl { get; set; }
87 | ///
88 | /// 描述:商家ID
89 | /// 例如:16815866
90 | ///
91 | public long? Vid { get; set; }
92 | ///
93 | /// 描述:一级类目名称
94 | /// 例如:母婴
95 | ///
96 | public string CidName { get; set; }
97 | ///
98 | /// 描述:商品无线京东价(单价为-1表示未查询到该商品单价)
99 | /// 例如:89
100 | ///
101 | public double? WlUnitPrice { get; set; }
102 | ///
103 | /// 描述:二级类目名称
104 | /// 例如:童装
105 | ///
106 | public string Cid2Name { get; set; }
107 | ///
108 | /// 描述:是否秒杀(1:是,0:否)
109 | /// 例如:0
110 | ///
111 | public int? IsSeckill { get; set; }
112 | ///
113 | /// 描述:二级类目ID
114 | /// 例如:11842
115 | ///
116 | public long? Cid2 { get; set; }
117 | ///
118 | /// 描述:三级类目名称
119 | /// 例如:裙子
120 | ///
121 | public string Cid3Name { get; set; }
122 | ///
123 | /// 描述:30天引单数量
124 | /// 例如:703
125 | ///
126 | public long? InOrderCount { get; set; }
127 | ///
128 | /// 描述:三级类目ID
129 | /// 例如:11225
130 | ///
131 | public long? Cid3 { get; set; }
132 | ///
133 | /// 描述:店铺ID
134 | /// 例如:168168
135 | ///
136 | public long? ShopId { get; set; }
137 | ///
138 | /// 描述:是否自营(1:是,0:否)
139 | /// 例如:1
140 | ///
141 | public int? IsJdSale { get; set; }
142 | ///
143 | /// 描述:商品名称
144 | /// 例如:童装女童连衣裙儿童裙子大童女装2018夏季新品公主裙 横条纹款 130码(正码)
145 | ///
146 | public string GoodsName { get; set; }
147 | ///
148 | /// 描述:推广开始日期(时间戳,毫秒)
149 | /// 例如:1529251200000
150 | ///
151 | public long? StartDate { get; set; }
152 | ///
153 | /// 描述:一级类目ID
154 | /// 例如:1319
155 | ///
156 | public long? Cid { get; set; }
157 | }
158 |
159 | }
160 |
161 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkOrderListRangeGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 用时间段查询推广订单接口--请求参数
8 | /// 用时间段查询推广订单接口
9 | /// pdd.ddk.order.list.range.get
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.order.list.range.get
11 | ///
12 | public class PddDdkOrderListRangeGetRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.order.list.range.get";
15 |
16 | public PddDdkOrderListRangeGetRequest() { }
17 |
18 | public PddDdkOrderListRangeGetRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 支付起始时间,如:2019-05-05 00:00:00
25 | /// 例如:2019-05-07 00:00:00
26 | ///
27 | public string StartTime { get; set; }
28 | ///
29 | /// 不必填
30 | /// 上一次的迭代器id(第一次不填)
31 | ///
32 | public string LastOrderId { get; set; }
33 | ///
34 | /// 不必填
35 | /// 每次请求多少条,建议300
36 | ///
37 | public int? PageSize { get; set; }
38 | ///
39 | /// 必填
40 | /// 支付结束时间,如:2019-05-05 00:00:00
41 | /// 例如:2019-05-07 00:00:00
42 | ///
43 | public string EndTime { get; set; }
44 | }
45 |
46 |
47 | ///
48 | /// 用时间段查询推广订单接口--响应参数
49 | /// 用时间段查询推广订单接口
50 | ///
51 | public class PddDdkOrderListRangeGetResponse : PddBaseResponse
52 | {
53 | ///
54 | /// order_list_get_response
55 | ///
56 | [JsonProperty("order_list_get_response")]
57 | public PddDdkOrderListRangeGet_OrderListGetResponse OrderListGetResponse { get; set; }
58 | }
59 |
60 | ///
61 | /// 多多进宝推广位对象列表
62 | ///
63 | public class PddDdkOrderListRangeGet_OrderList
64 | {
65 | ///
66 | /// 商品ID
67 | ///
68 | [JsonProperty("goods_id")]
69 | public long? GoodsId { get; set; }
70 | ///
71 | /// 商品标题
72 | ///
73 | [JsonProperty("goods_name")]
74 | public string GoodsName { get; set; }
75 | ///
76 | /// 订单中sku的单件价格,单位为分
77 | ///
78 | [JsonProperty("goods_price")]
79 | public long? GoodsPrice { get; set; }
80 | ///
81 | /// 购买商品的数量
82 | ///
83 | [JsonProperty("goods_quantity")]
84 | public long? GoodsQuantity { get; set; }
85 | ///
86 | /// 商品缩略图
87 | ///
88 | [JsonProperty("goods_thumbnail_url")]
89 | public string GoodsThumbnailUrl { get; set; }
90 | ///
91 | /// 实际支付金额,单位为分
92 | ///
93 | [JsonProperty("order_amount")]
94 | public long? OrderAmount { get; set; }
95 | ///
96 | /// 订单生成时间,UNIX时间戳
97 | ///
98 | [JsonProperty("order_create_time")]
99 | public long? OrderCreateTime { get; set; }
100 | ///
101 | /// 成团时间
102 | ///
103 | [JsonProperty("order_group_success_time")]
104 | public long? OrderGroupSuccessTime { get; set; }
105 | ///
106 | /// 最后更新时间
107 | ///
108 | [JsonProperty("order_modify_at")]
109 | public long? OrderModifyAt { get; set; }
110 | ///
111 | /// 支付时间
112 | ///
113 | [JsonProperty("order_pay_time")]
114 | public long? OrderPayTime { get; set; }
115 | ///
116 | /// 推广订单编号
117 | ///
118 | [JsonProperty("order_sn")]
119 | public string OrderSn { get; set; }
120 | ///
121 | /// 订单状态: -1 未支付; 0-已支付;1-已成团;2-确认收货;3-审核成功;4-审核失败(不可提现);5-已经结算;8-非多多进宝商品(无佣金订单)
122 | ///
123 | [JsonProperty("order_status")]
124 | public int? OrderStatus { get; set; }
125 | ///
126 | /// 订单状态描述
127 | ///
128 | [JsonProperty("order_status_desc")]
129 | public string OrderStatusDesc { get; set; }
130 | ///
131 | /// 审核时间
132 | ///
133 | [JsonProperty("order_verify_time")]
134 | public long? OrderVerifyTime { get; set; }
135 | ///
136 | /// 推广位ID
137 | ///
138 | [JsonProperty("p_id")]
139 | public string PId { get; set; }
140 | ///
141 | /// 佣金金额,单位为分
142 | ///
143 | [JsonProperty("promotion_amount")]
144 | public long? PromotionAmount { get; set; }
145 | ///
146 | /// 佣金比例,千分比
147 | ///
148 | [JsonProperty("promotion_rate")]
149 | public long? PromotionRate { get; set; }
150 | }
151 | ///
152 | /// order_list_get_response
153 | ///
154 | public class PddDdkOrderListRangeGet_OrderListGetResponse
155 | {
156 | ///
157 | /// 多多进宝推广位对象列表
158 | ///
159 | [JsonProperty("order_list")]
160 | public PddDdkOrderListRangeGet_OrderList[] OrderList { get; set; }
161 | ///
162 | /// last_order_id
163 | ///
164 | [JsonProperty("last_order_id")]
165 | public string LastOrderId { get; set; }
166 | }
167 | }
168 |
169 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkThemeGoodsSearch.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多进宝主题商品查询--请求参数
8 | /// 多多进宝主题商品查询
9 | /// pdd.ddk.theme.goods.search
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.theme.goods.search
11 | ///
12 | public class PddDdkThemeGoodsSearchRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.theme.goods.search";
15 |
16 | public PddDdkThemeGoodsSearchRequest() { }
17 |
18 | public PddDdkThemeGoodsSearchRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 主题ID
25 | ///
26 | public long? ThemeId { get; set; }
27 | }
28 |
29 |
30 | ///
31 | /// 多多进宝主题商品查询--响应参数
32 | /// 多多进宝主题商品查询
33 | ///
34 | public class PddDdkThemeGoodsSearchResponse : PddBaseResponse
35 | {
36 | ///
37 | /// 返回商品总数
38 | ///
39 | [JsonProperty("total")]
40 | public long? Total { get; set; }
41 | ///
42 | /// 商品列表对象
43 | ///
44 | [JsonProperty("goods_list")]
45 | public PddDdkThemeGoodsSearch_GoodsList[] GoodsList { get; set; }
46 | }
47 |
48 | ///
49 | /// 商品列表对象
50 | ///
51 | public class PddDdkThemeGoodsSearch_GoodsList
52 | {
53 | ///
54 | /// 商品编码
55 | ///
56 | [JsonProperty("goods_id")]
57 | public long? GoodsId { get; set; }
58 | ///
59 | /// 商品名称
60 | ///
61 | [JsonProperty("goods_name")]
62 | public string GoodsName { get; set; }
63 | ///
64 | /// 商品描述
65 | ///
66 | [JsonProperty("goods_desc")]
67 | public string GoodsDesc { get; set; }
68 | ///
69 | /// 商品缩略图
70 | ///
71 | [JsonProperty("goods_thumbnail_url")]
72 | public string GoodsThumbnailUrl { get; set; }
73 | ///
74 | /// 商品主图
75 | ///
76 | [JsonProperty("goods_image_url")]
77 | public string GoodsImageUrl { get; set; }
78 | ///
79 | /// 商品详情图列表
80 | ///
81 | [JsonProperty("goods_gallery_urls")]
82 | public string[] GoodsGalleryUrls { get; set; }
83 | ///
84 | /// 已售卖件数
85 | ///
86 | [JsonProperty("sold_quantity")]
87 | public long? SoldQuantity { get; set; }
88 | ///
89 | /// 最小拼团价格,单位为分
90 | ///
91 | [JsonProperty("min_group_price")]
92 | public long? MinGroupPrice { get; set; }
93 | ///
94 | /// 最小单买价格,单位为分
95 | ///
96 | [JsonProperty("min_normal_price")]
97 | public long? MinNormalPrice { get; set; }
98 | ///
99 | /// 店铺名称
100 | ///
101 | [JsonProperty("mall_name")]
102 | public string MallName { get; set; }
103 | ///
104 | /// 商品标签类目ID,使用pdd.goods.opt.get获取
105 | ///
106 | [JsonProperty("opt_id")]
107 | public long? OptId { get; set; }
108 | ///
109 | /// 商品标签名
110 | ///
111 | [JsonProperty("opt_name")]
112 | public string OptName { get; set; }
113 | ///
114 | /// 商品一~四级类目ID列表
115 | ///
116 | [JsonProperty("cat_ids")]
117 | public int[] CatIds { get; set; }
118 | ///
119 | /// 商品是否带券,true-带券,false-不带券
120 | ///
121 | [JsonProperty("has_coupon")]
122 | public bool? HasCoupon { get; set; }
123 | ///
124 | /// 优惠券门槛价格,单位为分
125 | ///
126 | [JsonProperty("coupon_min_order_amount")]
127 | public long? CouponMinOrderAmount { get; set; }
128 | ///
129 | /// 优惠券面额,单位为分
130 | ///
131 | [JsonProperty("coupon_discount")]
132 | public long? CouponDiscount { get; set; }
133 | ///
134 | /// 优惠券总数量
135 | ///
136 | [JsonProperty("coupon_total_quantity")]
137 | public long? CouponTotalQuantity { get; set; }
138 | ///
139 | /// 优惠券剩余数量
140 | ///
141 | [JsonProperty("coupon_remain_quantity")]
142 | public long? CouponRemainQuantity { get; set; }
143 | ///
144 | /// 优惠券生效时间,UNIX时间戳
145 | ///
146 | [JsonProperty("coupon_start_time")]
147 | public long? CouponStartTime { get; set; }
148 | ///
149 | /// 优惠券失效时间,UNIX时间戳
150 | ///
151 | [JsonProperty("coupon_end_time")]
152 | public long? CouponEndTime { get; set; }
153 | ///
154 | /// 佣金比例,千分比
155 | ///
156 | [JsonProperty("promotion_rate")]
157 | public long? PromotionRate { get; set; }
158 | ///
159 | /// 商品评价分
160 | ///
161 | [JsonProperty("goods_eval_score")]
162 | public double? GoodsEvalScore { get; set; }
163 | ///
164 | /// 商品评价数量
165 | ///
166 | [JsonProperty("goods_eval_count")]
167 | public long? GoodsEvalCount { get; set; }
168 | ///
169 | /// 模糊销量
170 | ///
171 | [JsonProperty("sales_tip")]
172 | public string SalesTip { get; set; }
173 | }
174 | }
175 |
176 |
--------------------------------------------------------------------------------
/JD_PDD.SDK.CSharpe.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29009.5
5 | MinimumVisualStudioVersion = 15.0.26124.0
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "src\Common\Common.csproj", "{5C88611B-3198-4DFF-A0BB-469F44F27340}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Jd.Sdk", "src\Jd.Sdk\Jd.Sdk.csproj", "{3C95A54A-0174-4CDD-8408-E4B7FB836702}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tool", "src\Tool\Tool.csproj", "{C09400C9-5F99-4480-A420-4D61DB8FAC62}"
11 | EndProject
12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test\test.csproj", "{AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}"
13 | EndProject
14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pdd.Sdk", "src\Pdd.Sdk\Pdd.Sdk.csproj", "{6B591CD3-FF60-48F1-B9FF-937F47CEFE01}"
15 | EndProject
16 | Global
17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
18 | Debug|Any CPU = Debug|Any CPU
19 | Debug|x64 = Debug|x64
20 | Debug|x86 = Debug|x86
21 | Release|Any CPU = Release|Any CPU
22 | Release|x64 = Release|x64
23 | Release|x86 = Release|x86
24 | EndGlobalSection
25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
26 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|x64.ActiveCfg = Debug|Any CPU
29 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|x64.Build.0 = Debug|Any CPU
30 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|x86.ActiveCfg = Debug|Any CPU
31 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Debug|x86.Build.0 = Debug|Any CPU
32 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|Any CPU.ActiveCfg = Release|Any CPU
33 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|Any CPU.Build.0 = Release|Any CPU
34 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|x64.ActiveCfg = Release|Any CPU
35 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|x64.Build.0 = Release|Any CPU
36 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|x86.ActiveCfg = Release|Any CPU
37 | {5C88611B-3198-4DFF-A0BB-469F44F27340}.Release|x86.Build.0 = Release|Any CPU
38 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|x64.ActiveCfg = Debug|Any CPU
41 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|x64.Build.0 = Debug|Any CPU
42 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|x86.ActiveCfg = Debug|Any CPU
43 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Debug|x86.Build.0 = Debug|Any CPU
44 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|Any CPU.ActiveCfg = Release|Any CPU
45 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|Any CPU.Build.0 = Release|Any CPU
46 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|x64.ActiveCfg = Release|Any CPU
47 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|x64.Build.0 = Release|Any CPU
48 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|x86.ActiveCfg = Release|Any CPU
49 | {3C95A54A-0174-4CDD-8408-E4B7FB836702}.Release|x86.Build.0 = Release|Any CPU
50 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|Any CPU.Build.0 = Debug|Any CPU
52 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|x64.ActiveCfg = Debug|Any CPU
53 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|x64.Build.0 = Debug|Any CPU
54 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|x86.ActiveCfg = Debug|Any CPU
55 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Debug|x86.Build.0 = Debug|Any CPU
56 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|Any CPU.ActiveCfg = Release|Any CPU
57 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|Any CPU.Build.0 = Release|Any CPU
58 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|x64.ActiveCfg = Release|Any CPU
59 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|x64.Build.0 = Release|Any CPU
60 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|x86.ActiveCfg = Release|Any CPU
61 | {C09400C9-5F99-4480-A420-4D61DB8FAC62}.Release|x86.Build.0 = Release|Any CPU
62 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
63 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|Any CPU.Build.0 = Debug|Any CPU
64 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|x64.ActiveCfg = Debug|Any CPU
65 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|x64.Build.0 = Debug|Any CPU
66 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|x86.ActiveCfg = Debug|Any CPU
67 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Debug|x86.Build.0 = Debug|Any CPU
68 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|Any CPU.ActiveCfg = Release|Any CPU
69 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|Any CPU.Build.0 = Release|Any CPU
70 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|x64.ActiveCfg = Release|Any CPU
71 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|x64.Build.0 = Release|Any CPU
72 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|x86.ActiveCfg = Release|Any CPU
73 | {AEA1B59E-F344-4C3D-9F3E-74E6C97B4E18}.Release|x86.Build.0 = Release|Any CPU
74 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|Any CPU.Build.0 = Debug|Any CPU
76 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|x64.ActiveCfg = Debug|Any CPU
77 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|x64.Build.0 = Debug|Any CPU
78 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|x86.ActiveCfg = Debug|Any CPU
79 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Debug|x86.Build.0 = Debug|Any CPU
80 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|Any CPU.ActiveCfg = Release|Any CPU
81 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|Any CPU.Build.0 = Release|Any CPU
82 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|x64.ActiveCfg = Release|Any CPU
83 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|x64.Build.0 = Release|Any CPU
84 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|x86.ActiveCfg = Release|Any CPU
85 | {6B591CD3-FF60-48F1-B9FF-937F47CEFE01}.Release|x86.Build.0 = Release|Any CPU
86 | EndGlobalSection
87 | GlobalSection(SolutionProperties) = preSolution
88 | HideSolutionNode = FALSE
89 | EndGlobalSection
90 | GlobalSection(ExtensibilityGlobals) = postSolution
91 | SolutionGuid = {EFC00213-ED1A-4D63-A6A2-7796EB036651}
92 | EndGlobalSection
93 | EndGlobal
94 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkOrderListIncrementGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 最后更新时间段增量同步推广订单信息--请求参数
8 | /// 按照时间段获取授权多多客下面所有多多客的推广订单信息
9 | /// pdd.ddk.order.list.increment.get
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.order.list.increment.get
11 | ///
12 | public class PddDdkOrderListIncrementGetRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.order.list.increment.get";
15 |
16 | public PddDdkOrderListIncrementGetRequest() { }
17 |
18 | public PddDdkOrderListIncrementGetRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 最近90天内多多进宝商品订单更新时间--查询时间开始。note:此时间为时间戳,指格林威治时间 1970 年01 月 01 日 00 时 00 分 00 秒(北京时间 1970 年 01 月 01 日 08 时 00 分 00 秒)起至现在的总秒数
25 | ///
26 | public long? StartUpdateTime { get; set; }
27 | ///
28 | /// 必填
29 | /// 查询结束时间,和开始时间相差不能超过24小时。note:此时间为时间戳,指格林威治时间 1970 年01 月 01 日 00 时 00 分 00 秒(北京时间 1970 年 01 月 01 日 08 时 00 分 00 秒)起至现在的总秒数
30 | ///
31 | public long? EndUpdateTime { get; set; }
32 | ///
33 | /// 不必填
34 | /// 返回的每页结果订单数,默认为100,范围为10到100,建议使用40~50,可以提高成功率,减少超时数量。
35 | ///
36 | public int? PageSize { get; set; }
37 | ///
38 | /// 不必填
39 | /// 第几页,从1到10000,默认1,注:使用最后更新时间范围增量同步时,必须采用倒序的分页方式(从最后一页往回取)才能避免漏单问题。
40 | ///
41 | public int? Page { get; set; }
42 | ///
43 | /// 不必填
44 | /// 是否返回总数,默认为true,如果指定false, 则返回的结果中不包含总记录数,通过此种方式获取增量数据,效率在原有的基础上有80%的提升。
45 | ///
46 | public bool? ReturnCount { get; set; }
47 | }
48 |
49 |
50 | ///
51 | /// 最后更新时间段增量同步推广订单信息--响应参数
52 | /// 按照时间段获取授权多多客下面所有多多客的推广订单信息
53 | ///
54 | public class PddDdkOrderListIncrementGetResponse : PddBaseResponse
55 | {
56 | ///
57 | /// order_list_get_response
58 | ///
59 | [JsonProperty("order_list_get_response")]
60 | public PddDdkOrderListIncrementGet_OrderListGetResponse OrderListGetResponse { get; set; }
61 | }
62 |
63 | ///
64 | /// 多多进宝推广位对象列表
65 | ///
66 | public class PddDdkOrderListIncrementGet_OrderList
67 | {
68 | ///
69 | /// 推广订单编号
70 | ///
71 | [JsonProperty("order_sn")]
72 | public string OrderSn { get; set; }
73 | ///
74 | /// 商品ID
75 | ///
76 | [JsonProperty("goods_id")]
77 | public long? GoodsId { get; set; }
78 | ///
79 | /// 商品标题
80 | ///
81 | [JsonProperty("goods_name")]
82 | public string GoodsName { get; set; }
83 | ///
84 | /// 商品缩略图
85 | ///
86 | [JsonProperty("goods_thumbnail_url")]
87 | public string GoodsThumbnailUrl { get; set; }
88 | ///
89 | /// 购买商品的数量
90 | ///
91 | [JsonProperty("goods_quantity")]
92 | public long? GoodsQuantity { get; set; }
93 | ///
94 | /// 订单中sku的单件价格,单位为分
95 | ///
96 | [JsonProperty("goods_price")]
97 | public long? GoodsPrice { get; set; }
98 | ///
99 | /// 实际支付金额,单位为分
100 | ///
101 | [JsonProperty("order_amount")]
102 | public long? OrderAmount { get; set; }
103 | ///
104 | /// 推广位ID
105 | ///
106 | [JsonProperty("p_id")]
107 | public string PId { get; set; }
108 | ///
109 | /// 佣金比例,千分比
110 | ///
111 | [JsonProperty("promotion_rate")]
112 | public long? PromotionRate { get; set; }
113 | ///
114 | /// 佣金金额,单位为分
115 | ///
116 | [JsonProperty("promotion_amount")]
117 | public long? PromotionAmount { get; set; }
118 | ///
119 | /// 订单状态: -1 未支付; 0-已支付;1-已成团;2-确认收货;3-审核成功;4-审核失败(不可提现);5-已经结算;8-非多多进宝商品(无佣金订单)
120 | ///
121 | [JsonProperty("order_status")]
122 | public int? OrderStatus { get; set; }
123 | ///
124 | /// 订单状态描述
125 | ///
126 | [JsonProperty("order_status_desc")]
127 | public string OrderStatusDesc { get; set; }
128 | ///
129 | /// 订单生成时间,UNIX时间戳
130 | ///
131 | [JsonProperty("order_create_time")]
132 | public long? OrderCreateTime { get; set; }
133 | ///
134 | /// 支付时间
135 | ///
136 | [JsonProperty("order_pay_time")]
137 | public long? OrderPayTime { get; set; }
138 | ///
139 | /// 成团时间
140 | ///
141 | [JsonProperty("order_group_success_time")]
142 | public long? OrderGroupSuccessTime { get; set; }
143 | ///
144 | /// 审核时间
145 | ///
146 | [JsonProperty("order_verify_time")]
147 | public long? OrderVerifyTime { get; set; }
148 | ///
149 | /// 最后更新时间
150 | ///
151 | [JsonProperty("order_modify_at")]
152 | public long? OrderModifyAt { get; set; }
153 | ///
154 | /// 自定义参数
155 | ///
156 | [JsonProperty("custom_parameters")]
157 | public string CustomParameters { get; set; }
158 | }
159 | ///
160 | /// order_list_get_response
161 | ///
162 | public class PddDdkOrderListIncrementGet_OrderListGetResponse
163 | {
164 | ///
165 | /// 多多进宝推广位对象列表
166 | ///
167 | [JsonProperty("order_list")]
168 | public PddDdkOrderListIncrementGet_OrderList[] OrderList { get; set; }
169 | ///
170 | /// 请求到的结果数
171 | ///
172 | [JsonProperty("total_count")]
173 | public long? TotalCount { get; set; }
174 | }
175 | }
176 |
177 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkThemePromUrlGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多进宝主题推广链接生成--请求参数
8 | /// 多多进宝主题活动推广链接生成
9 | /// pdd.ddk.theme.prom.url.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.theme.prom.url.generate
11 | ///
12 | public class PddDdkThemePromUrlGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.theme.prom.url.generate";
15 |
16 | public PddDdkThemePromUrlGenerateRequest() { }
17 |
18 | public PddDdkThemePromUrlGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 推广位ID
25 | ///
26 | public string Pid { get; set; }
27 | ///
28 | /// 必填
29 | /// 主题ID列表,例如[1,235]
30 | ///
31 | public long[] ThemeIdList { get; set; }
32 | ///
33 | /// 不必填
34 | /// 是否生成短链接,true-是,false-否
35 | ///
36 | public bool? GenerateShortUrl { get; set; }
37 | ///
38 | /// 不必填
39 | /// 是否生成手机跳转链接。true-是,false-否,默认false
40 | ///
41 | public bool? GenerateMobile { get; set; }
42 | ///
43 | /// 不必填
44 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
45 | ///
46 | public string CustomParameters { get; set; }
47 | ///
48 | /// 不必填
49 | /// 是否唤起微信客户端, 默认false 否,true 是
50 | ///
51 | public bool? GenerateWeappWebview { get; set; }
52 | ///
53 | /// 不必填
54 | /// 唤起微信app推广短链接
55 | ///
56 | public bool? WeAppWebViewShortUrl { get; set; }
57 | ///
58 | /// 不必填
59 | /// 唤起微信app推广链接
60 | ///
61 | public bool? WeAppWebWiewUrl { get; set; }
62 | ///
63 | /// 不必填
64 | /// 是否生成小程序链接
65 | ///
66 | public bool? GenerateWeApp { get; set; }
67 | }
68 |
69 |
70 | ///
71 | /// 多多进宝主题推广链接生成--响应参数
72 | /// 多多进宝主题活动推广链接生成
73 | ///
74 | public class PddDdkThemePromUrlGenerateResponse : PddBaseResponse
75 | {
76 | ///
77 | /// 主题活动推广返回对象
78 | ///
79 | [JsonProperty("theme_promotion_url_generate_response")]
80 | public PddDdkThemePromUrlGenerate_ThemePromotionUrlGenerateResponse ThemePromotionUrlGenerateResponse { get; set; }
81 | }
82 |
83 | ///
84 | /// 小程序信息
85 | ///
86 | public class PddDdkThemePromUrlGenerate_WeAppInfo
87 | {
88 | ///
89 | /// 小程序图片
90 | ///
91 | [JsonProperty("we_app_icon_url")]
92 | public string WeAppIconUrl { get; set; }
93 | ///
94 | /// Banner图
95 | ///
96 | [JsonProperty("banner_url")]
97 | public string BannerUrl { get; set; }
98 | ///
99 | /// 描述
100 | ///
101 | [JsonProperty("desc")]
102 | public string Desc { get; set; }
103 | ///
104 | /// 来源名
105 | ///
106 | [JsonProperty("source_display_name")]
107 | public string SourceDisplayName { get; set; }
108 | ///
109 | /// 小程序path值
110 | ///
111 | [JsonProperty("page_path")]
112 | public string PagePath { get; set; }
113 | ///
114 | /// 用户名
115 | ///
116 | [JsonProperty("user_name")]
117 | public int? UserName { get; set; }
118 | ///
119 | /// 小程序标题
120 | ///
121 | [JsonProperty("title")]
122 | public int? Title { get; set; }
123 | ///
124 | /// 拼多多小程序id
125 | ///
126 | [JsonProperty("app_id")]
127 | public int? AppId { get; set; }
128 | }
129 | ///
130 | /// 主题活动推广url列表
131 | ///
132 | public class PddDdkThemePromUrlGenerate_UrlList
133 | {
134 | ///
135 | /// 主题活动推广链接
136 | ///
137 | [JsonProperty("url")]
138 | public string Url { get; set; }
139 | ///
140 | /// 主题活动推广短链
141 | ///
142 | [JsonProperty("short_url")]
143 | public string ShortUrl { get; set; }
144 | ///
145 | /// 主题活动推广移动链接
146 | ///
147 | [JsonProperty("mobile_url")]
148 | public string MobileUrl { get; set; }
149 | ///
150 | /// 主题活动推广移动短链接
151 | ///
152 | [JsonProperty("mobile_short_url")]
153 | public string MobileShortUrl { get; set; }
154 | ///
155 | /// 主题活动推广开团链接
156 | ///
157 | [JsonProperty("multi_group_url")]
158 | public string MultiGroupUrl { get; set; }
159 | ///
160 | /// 主题活动推广开团短链接
161 | ///
162 | [JsonProperty("multi_group_short_url")]
163 | public string MultiGroupShortUrl { get; set; }
164 | ///
165 | /// 主题活动推广开团移动端链接
166 | ///
167 | [JsonProperty("multi_group_mobile_url")]
168 | public string MultiGroupMobileUrl { get; set; }
169 | ///
170 | /// 主题活动推广开团移动端短链接
171 | ///
172 | [JsonProperty("multi_group_mobile_short_url")]
173 | public string MultiGroupMobileShortUrl { get; set; }
174 | ///
175 | /// 小程序信息
176 | ///
177 | [JsonProperty("we_app_info")]
178 | public PddDdkThemePromUrlGenerate_WeAppInfo WeAppInfo { get; set; }
179 | }
180 | ///
181 | /// 主题活动推广返回对象
182 | ///
183 | public class PddDdkThemePromUrlGenerate_ThemePromotionUrlGenerateResponse
184 | {
185 | ///
186 | /// 主题活动推广url列表
187 | ///
188 | [JsonProperty("url_list")]
189 | public PddDdkThemePromUrlGenerate_UrlList[] UrlList { get; set; }
190 | }
191 | }
192 |
193 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkGoodsPromotionUrlGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多进宝推广链接生成--请求参数
8 | /// 生成普通商品推广链接
9 | /// pdd.ddk.goods.promotion.url.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.goods.promotion.url.generate
11 | ///
12 | public class PddDdkGoodsPromotionUrlGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.goods.promotion.url.generate";
15 |
16 | public PddDdkGoodsPromotionUrlGenerateRequest() { }
17 |
18 | public PddDdkGoodsPromotionUrlGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 推广位ID
25 | ///
26 | public string PId { get; set; }
27 | ///
28 | /// 必填
29 | /// 商品ID,仅支持单个查询
30 | ///
31 | public long[] GoodsIdList { get; set; }
32 | ///
33 | /// 不必填
34 | /// 是否生成短链接,true-是,false-否
35 | ///
36 | public bool? GenerateShortUrl { get; set; }
37 | ///
38 | /// 不必填
39 | /// true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手
40 | ///
41 | public bool? MultiGroup { get; set; }
42 | ///
43 | /// 不必填
44 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
45 | ///
46 | public string CustomParameters { get; set; }
47 | ///
48 | /// 不必填
49 | /// 是否生成唤起微信客户端链接,true-是,false-否,默认false
50 | ///
51 | public bool? GenerateWeappWebview { get; set; }
52 | ///
53 | /// 不必填
54 | /// 招商多多客ID
55 | ///
56 | public long? ZsDuoId { get; set; }
57 | ///
58 | /// 不必填
59 | /// 是否生成小程序推广
60 | ///
61 | public bool? GenerateWeApp { get; set; }
62 | ///
63 | /// 不必填
64 | /// 是否生成微博推广链接
65 | /// 默认值:false
66 | /// 例如:false
67 | ///
68 | public bool? GenerateWeiboappWebview { get; set; }
69 | }
70 |
71 |
72 | ///
73 | /// 多多进宝推广链接生成--响应参数
74 | /// 生成普通商品推广链接
75 | ///
76 | public class PddDdkGoodsPromotionUrlGenerateResponse : PddBaseResponse
77 | {
78 | ///
79 | /// response
80 | ///
81 | [JsonProperty("goods_promotion_url_generate_response")]
82 | public PddDdkGoodsPromotionUrlGenerate_GoodsPromotionUrlGenerateResponse GoodsPromotionUrlGenerateResponse { get; set; }
83 | }
84 |
85 | ///
86 | /// 小程序信息
87 | ///
88 | public class PddDdkGoodsPromotionUrlGenerate_WeAppInfo
89 | {
90 | ///
91 | /// 小程序图片
92 | ///
93 | [JsonProperty("we_app_icon_url")]
94 | public string WeAppIconUrl { get; set; }
95 | ///
96 | /// Banner图
97 | ///
98 | [JsonProperty("banner_url")]
99 | public string BannerUrl { get; set; }
100 | ///
101 | /// 描述
102 | ///
103 | [JsonProperty("desc")]
104 | public string Desc { get; set; }
105 | ///
106 | /// 来源名
107 | ///
108 | [JsonProperty("source_display_name")]
109 | public string SourceDisplayName { get; set; }
110 | ///
111 | /// 小程序path值
112 | ///
113 | [JsonProperty("page_path")]
114 | public string PagePath { get; set; }
115 | ///
116 | /// 用户名
117 | ///
118 | [JsonProperty("user_name")]
119 | public string UserName { get; set; }
120 | ///
121 | /// 小程序标题
122 | ///
123 | [JsonProperty("title")]
124 | public string Title { get; set; }
125 | ///
126 | /// 拼多多小程序id
127 | ///
128 | [JsonProperty("app_id")]
129 | public string AppId { get; set; }
130 | }
131 | ///
132 | /// 多多进宝推广链接对象列表
133 | ///
134 | public class PddDdkGoodsPromotionUrlGenerate_GoodsPromotionUrlList
135 | {
136 | ///
137 | /// 唤起微信app推广短链接
138 | ///
139 | [JsonProperty("we_app_web_view_short_url")]
140 | public string WeAppWebViewShortUrl { get; set; }
141 | ///
142 | /// 唤起微信app推广链接
143 | ///
144 | [JsonProperty("we_app_web_view_url")]
145 | public string WeAppWebViewUrl { get; set; }
146 | ///
147 | /// 唤醒拼多多app的推广短链接
148 | ///
149 | [JsonProperty("mobile_short_url")]
150 | public string MobileShortUrl { get; set; }
151 | ///
152 | /// 唤醒拼多多app的推广长链接
153 | ///
154 | [JsonProperty("mobile_url")]
155 | public string MobileUrl { get; set; }
156 | ///
157 | /// 推广短链接
158 | ///
159 | [JsonProperty("short_url")]
160 | public string ShortUrl { get; set; }
161 | ///
162 | /// 推广长链接
163 | ///
164 | [JsonProperty("url")]
165 | public string Url { get; set; }
166 | ///
167 | /// 小程序信息
168 | ///
169 | [JsonProperty("we_app_info")]
170 | public PddDdkGoodsPromotionUrlGenerate_WeAppInfo WeAppInfo { get; set; }
171 | ///
172 | /// 微博推广短链接
173 | ///
174 | [JsonProperty("weibo_app_web_view_short_url")]
175 | public string WeiboAppWebViewShortUrl { get; set; }
176 | ///
177 | /// 微博推广链接
178 | ///
179 | [JsonProperty("weibo_app_web_view_url")]
180 | public string WeiboAppWebViewUrl { get; set; }
181 | }
182 | ///
183 | /// response
184 | ///
185 | public class PddDdkGoodsPromotionUrlGenerate_GoodsPromotionUrlGenerateResponse
186 | {
187 | ///
188 | /// 多多进宝推广链接对象列表
189 | ///
190 | [JsonProperty("goods_promotion_url_list")]
191 | public PddDdkGoodsPromotionUrlGenerate_GoodsPromotionUrlList[] GoodsPromotionUrlList { get; set; }
192 | }
193 | }
194 |
195 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenGoodsStupriceQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 学生价商品查询接口【申请】--请求参数
7 | /// 根据SKUID、类目等信息查询学生价商品信息,通常用于校园推广。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.goods.stuprice.query
9 | /// https://union.jd.com/openplatform/api/666
10 | ///
11 | public class JdUnionOpenGoodsStupriceQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenGoodsStupriceQueryRequest() { }
14 |
15 | public JdUnionOpenGoodsStupriceQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.goods.stuprice.query";
18 |
19 | protected override string ParamName => "goodsReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 不必填
26 | /// 描述:sku id集合,长度30。如果传值,忽略其他查询条件
27 | /// 例如:4236736,12332117
28 | ///
29 | public long[] SkuIds { get; set; }
30 | ///
31 | /// 不必填
32 | /// 描述:页码,默认1
33 | /// 例如:1
34 | ///
35 | public int? PageIndex { get; set; }
36 | ///
37 | /// 不必填
38 | /// 描述:每页数量最大30,默认30
39 | /// 例如:30
40 | ///
41 | public int? PageSize { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:学生专享价区间开始(单位:元)
45 | /// 例如:100
46 | ///
47 | public double? StuPriceFrom { get; set; }
48 | ///
49 | /// 不必填
50 | /// 描述:学生专享价区间结束(单位:元)
51 | /// 例如:1000
52 | ///
53 | public double? StuPriceTo { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:一级类目
57 | /// 例如:670
58 | ///
59 | public long? Cid1 { get; set; }
60 | ///
61 | /// 不必填
62 | /// 描述:二级类目
63 | /// 例如:699
64 | ///
65 | public long? Cid2 { get; set; }
66 | ///
67 | /// 不必填
68 | /// 描述:三级类目
69 | /// 例如:702
70 | ///
71 | public long? Cid3 { get; set; }
72 | ///
73 | /// 不必填
74 | /// 描述:g=自营,p=pop
75 | /// 例如:g
76 | ///
77 | public string Owner { get; set; }
78 | ///
79 | /// 不必填
80 | /// 描述:佣金比例区间开始
81 | /// 例如:2.5
82 | ///
83 | public double? CommissionShareFrom { get; set; }
84 | ///
85 | /// 不必填
86 | /// 描述:佣金比例区间结束
87 | /// 例如:15
88 | ///
89 | public double? CommissionShareTo { get; set; }
90 | ///
91 | /// 不必填
92 | /// 描述: 排序字段,默认搜索综合排序。允许的排序字段:stuPrice、commissionShare、inOrderCount30Days、inOrderComm30Days
93 | /// 例如:stuPrice
94 | ///
95 | public string SortName { get; set; }
96 | ///
97 | /// 不必填
98 | /// 描述:desc=降序,asc=升序,可为空(默认降序)
99 | /// 例如:desc
100 | ///
101 | public string Sort { get; set; }
102 | }
103 |
104 |
105 |
106 | ///
107 | /// 学生价商品查询接口【申请】--响应参数
108 | /// 根据SKUID、类目等信息查询学生价商品信息,通常用于校园推广。需向cps-qxsq@jd.com申请权限。
109 | /// jd.union.open.goods.stuprice.query
110 | ///
111 | public class JdUnionOpenGoodsStupriceQueryResponse
112 | {
113 | ///
114 | /// 描述:商品名称
115 | /// 例如:蛋卷头卷发棒
116 | ///
117 | public string SkuName { get; set; }
118 | ///
119 | /// 描述:商品id
120 | /// 例如:4722722
121 | ///
122 | public long? SkuId { get; set; }
123 | ///
124 | /// 描述:图片url
125 | /// 例如:jfs/t20533/3/360228532/173527/3108cb63/5b0bb83fNc54e6800.jpg
126 | ///
127 | public string ImageUrl { get; set; }
128 | ///
129 | /// 描述:是否学生价商品。 1:是学生价商品。 0:不是学生价商品。
130 | /// 例如:1
131 | ///
132 | public int? IsStuPrice { get; set; }
133 | ///
134 | /// 描述:京东价
135 | /// 例如:69.9
136 | ///
137 | public double? JdPrice { get; set; }
138 | ///
139 | /// 描述:学生专享价
140 | /// 例如:56.0
141 | ///
142 | public double? StudentPrice { get; set; }
143 | ///
144 | /// 描述:专享价促销开始时间(时间戳:毫秒)
145 | /// 例如:1535644800000
146 | ///
147 | public long? StuPriceStartTime { get; set; }
148 | ///
149 | /// 描述:专享价促销结束时间(时间戳:毫秒)
150 | /// 例如:1532361600000
151 | ///
152 | public long? StuPriceEndTime { get; set; }
153 | ///
154 | /// 描述:一级类目id
155 | /// 例如:737
156 | ///
157 | public long? Cid1Id { get; set; }
158 | ///
159 | /// 描述:二级类目id
160 | /// 例如:1276
161 | ///
162 | public long? Cid2Id { get; set; }
163 | ///
164 | /// 描述:三级类目id
165 | /// 例如:12400
166 | ///
167 | public long? Cid3Id { get; set; }
168 | ///
169 | /// 描述:一级类目名称
170 | /// 例如:家用电器
171 | ///
172 | public string Cid1Name { get; set; }
173 | ///
174 | /// 描述:二级类目名称
175 | /// 例如:个护健康
176 | ///
177 | public string Cid2Name { get; set; }
178 | ///
179 | /// 描述:三级类目名称
180 | /// 例如:卷/直发器
181 | ///
182 | public string Cid3Name { get; set; }
183 | ///
184 | /// 描述:通用佣金比例,百分比
185 | /// 例如:7.0
186 | ///
187 | public double? CommissionShare { get; set; }
188 | ///
189 | /// 描述:通用佣金
190 | /// 例如:3.92
191 | ///
192 | public double? Commission { get; set; }
193 | ///
194 | /// 描述:是否自营。g=自营,p=pop
195 | /// 例如:g
196 | ///
197 | public string Owner { get; set; }
198 | ///
199 | /// 描述:30天引入订单量(spu)
200 | /// 例如:2552
201 | ///
202 | public long? InOrderCount30Days { get; set; }
203 | ///
204 | /// 描述:30天支出佣金(spu)
205 | /// 例如:3910.81
206 | ///
207 | public double? InOrderComm30Days { get; set; }
208 | }
209 |
210 | }
211 |
212 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkOrderDetailGet.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 查询订单详情--请求参数
8 | /// 查询订单详情
9 | /// pdd.ddk.order.detail.get
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.order.detail.get
11 | ///
12 | public class PddDdkOrderDetailGetRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.order.detail.get";
15 |
16 | public PddDdkOrderDetailGetRequest() { }
17 |
18 | public PddDdkOrderDetailGetRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 订单号
25 | ///
26 | public string OrderSn { get; set; }
27 | }
28 |
29 |
30 | ///
31 | /// 查询订单详情--响应参数
32 | /// 查询订单详情
33 | ///
34 | public class PddDdkOrderDetailGetResponse : PddBaseResponse
35 | {
36 | ///
37 | /// order_detail_response
38 | ///
39 | [JsonProperty("order_detail_response")]
40 | public PddDdkOrderDetailGet_OrderDetailResponse OrderDetailResponse { get; set; }
41 | }
42 |
43 | ///
44 | /// order_detail_response
45 | ///
46 | public class PddDdkOrderDetailGet_OrderDetailResponse
47 | {
48 | ///
49 | /// 订单编号
50 | ///
51 | [JsonProperty("order_sn")]
52 | public string OrderSn { get; set; }
53 | ///
54 | /// 商品id
55 | ///
56 | [JsonProperty("goods_id")]
57 | public long? GoodsId { get; set; }
58 | ///
59 | /// 商品名称
60 | ///
61 | [JsonProperty("goods_name")]
62 | public string GoodsName { get; set; }
63 | ///
64 | /// 商品缩略图
65 | ///
66 | [JsonProperty("goods_thumbnail_url")]
67 | public string GoodsThumbnailUrl { get; set; }
68 | ///
69 | /// 商品数量
70 | ///
71 | [JsonProperty("goods_quantity")]
72 | public long? GoodsQuantity { get; set; }
73 | ///
74 | /// 商品价格(分)
75 | ///
76 | [JsonProperty("goods_price")]
77 | public long? GoodsPrice { get; set; }
78 | ///
79 | /// 订单价格(分)
80 | ///
81 | [JsonProperty("order_amount")]
82 | public long? OrderAmount { get; set; }
83 | ///
84 | /// 佣金比例 千分比
85 | ///
86 | [JsonProperty("promotion_rate")]
87 | public long? PromotionRate { get; set; }
88 | ///
89 | /// 佣金(分)
90 | ///
91 | [JsonProperty("promotion_amount")]
92 | public long? PromotionAmount { get; set; }
93 | ///
94 | /// 结算批次号
95 | ///
96 | [JsonProperty("batch_no")]
97 | public string BatchNo { get; set; }
98 | ///
99 | /// 订单状态
100 | ///
101 | [JsonProperty("order_status")]
102 | public int? OrderStatus { get; set; }
103 | ///
104 | /// 订单状态描述( -1 未支付; 0-已支付;1-已成团;2-确认收货;3-审核成功;4-审核失败(不可提现);5-已经结算;8-非多多进宝商品(无佣金订单);10-已处罚)
105 | ///
106 | [JsonProperty("order_status_desc")]
107 | public string OrderStatusDesc { get; set; }
108 | ///
109 | /// 订单创建时间(UNIX时间戳)
110 | ///
111 | [JsonProperty("order_create_time")]
112 | public long? OrderCreateTime { get; set; }
113 | ///
114 | /// 订单支付时间(UNIX时间戳)
115 | ///
116 | [JsonProperty("order_pay_time")]
117 | public long? OrderPayTime { get; set; }
118 | ///
119 | /// 订单成团时间(UNIX时间戳)
120 | ///
121 | [JsonProperty("order_group_success_time")]
122 | public long? OrderGroupSuccessTime { get; set; }
123 | ///
124 | /// 订单确认收货时间(UNIX时间戳)
125 | ///
126 | [JsonProperty("order_receive_time")]
127 | public long? OrderReceiveTime { get; set; }
128 | ///
129 | /// 订单审核时间(UNIX时间戳)
130 | ///
131 | [JsonProperty("order_verify_time")]
132 | public long? OrderVerifyTime { get; set; }
133 | ///
134 | /// 订单结算时间(UNIX时间戳)
135 | ///
136 | [JsonProperty("order_settle_time")]
137 | public long? OrderSettleTime { get; set; }
138 | ///
139 | /// 订单最后更新时间(UNIX时间戳)
140 | ///
141 | [JsonProperty("order_modify_at")]
142 | public long? OrderModifyAt { get; set; }
143 | ///
144 | /// 订单来源 :0 :关联,5 :直接下单页RPC请求
145 | ///
146 | [JsonProperty("match_channel")]
147 | public int? MatchChannel { get; set; }
148 | ///
149 | /// 订单类型:0:领券页面, 1: 红包页, 2:领券页, 3: 题页
150 | ///
151 | [JsonProperty("type")]
152 | public int? Type { get; set; }
153 | ///
154 | /// 成团编号
155 | ///
156 | [JsonProperty("group_id")]
157 | public long? GroupId { get; set; }
158 | ///
159 | /// 多多客工具id
160 | ///
161 | [JsonProperty("auth_duo_id")]
162 | public long? AuthDuoId { get; set; }
163 | ///
164 | /// 招商多多客id
165 | ///
166 | [JsonProperty("zs_duo_id")]
167 | public long? ZsDuoId { get; set; }
168 | ///
169 | /// 自定义参数
170 | ///
171 | [JsonProperty("custom_parameters")]
172 | public string CustomParameters { get; set; }
173 | ///
174 | /// CPS_Sign
175 | ///
176 | [JsonProperty("cps_sign")]
177 | public string CpsSign { get; set; }
178 | ///
179 | /// 链接最后一次生产时间
180 | ///
181 | [JsonProperty("url_last_generate_time")]
182 | public long? UrlLastGenerateTime { get; set; }
183 | ///
184 | /// 打点时间
185 | ///
186 | [JsonProperty("point_time")]
187 | public long? PointTime { get; set; }
188 | ///
189 | /// 售后状态:0:无,1:售后中,2:售后完成
190 | ///
191 | [JsonProperty("return_status")]
192 | public int? ReturnStatus { get; set; }
193 | ///
194 | /// 推广位id
195 | ///
196 | [JsonProperty("pid")]
197 | public string Pid { get; set; }
198 | }
199 | }
200 |
201 |
--------------------------------------------------------------------------------
/src/Jd.Sdk/JdBaseRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Web;
8 | using Common;
9 | using Flurl.Http;
10 | using Microsoft.Extensions.Configuration;
11 | using Newtonsoft.Json;
12 |
13 | namespace Jd.Sdk
14 | {
15 | public abstract class JdBaseRequest
16 | {
17 | ///
18 | /// 必填 分配给应用的AppKey
19 | ///
20 | private readonly string _appKey;
21 |
22 | ///
23 | /// 密钥
24 | ///
25 | private readonly string _appSecret;
26 |
27 | protected JdBaseRequest()
28 | {
29 | var config = new ConfigurationBuilder()
30 | .AddJsonFile("appsettings.json")
31 | .Build();
32 |
33 | _appKey = config.GetSection("JdSdk")?["AppKey"];
34 | _appSecret = config.GetSection("JdSdk")?["AppSecret"];
35 | _timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
36 | }
37 |
38 | ///
39 | /// 非必填 通过code获取的access_token(无需授权的接口,Oauth2颁发的动态令牌,暂不支持使用)
40 | ///
41 | private readonly string _accessToken;
42 |
43 | protected JdBaseRequest(string appKey, string appSecret, string accessToken = null)
44 | {
45 | _appKey = appKey;
46 | _appSecret = appSecret;
47 | _accessToken = accessToken;
48 | _timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
49 | }
50 |
51 | ///
52 | /// 必填 API接口名称
53 | ///
54 | protected abstract string Method { get; }
55 |
56 | ///
57 | /// 业务数据名称
58 | ///
59 | protected abstract string ParamName { get; }
60 |
61 | ///
62 | /// url前缀
63 | ///
64 | private readonly string _baseUrl = "https://router.jd.com/api";
65 |
66 | ///
67 | /// 必填 时间戳,格式为yyyy-MM-dd HH:mm:ss,时区为GMT+8,例如:2018-08-01 13:00:00。API服务端允许客户端请求最大时间误差为10分钟
68 | ///
69 | private readonly string _timestamp;
70 |
71 | ///
72 | /// 必填 响应格式。暂时只支持json
73 | ///
74 | private readonly string _format = "json";
75 |
76 | ///
77 | /// 必填 API协议版本,可选值:1.0 version
78 | ///
79 | private readonly string _version = "1.0";
80 |
81 | ///
82 | /// 必填 签名的摘要算法, md5
83 | ///
84 | private readonly string _signMethod = "md5";
85 |
86 | ///
87 | /// 调试信息
88 | ///
89 | [JsonIgnore]
90 | public object DebugInfo { get; private set; }
91 |
92 | ///
93 | /// json内容的业务数据
94 | ///
95 | private string _paramJson;
96 |
97 | ///
98 | /// 首字符小写
99 | ///
100 | ///
101 | private string FirstLower(string source)
102 | => source[0].ToString().ToLower() + source.Substring(1);
103 |
104 | protected async Task PostAsync()
105 | where TResponse : JdBaseResponse
106 | {
107 | var signParams = new Dictionary
108 | {
109 | {"method", Method},
110 | {"app_key", _appKey},
111 | {"timestamp", _timestamp},
112 | {"format", _format},
113 | {"v", _version},
114 | {"sign_method", _signMethod}
115 | };
116 | if (!string.IsNullOrWhiteSpace(_accessToken)) // 如果需要
117 | {
118 | signParams.Add("access_token", _accessToken);
119 | }
120 |
121 | var properties = GetType().GetProperties()
122 | .Where(x => x.Name != nameof(DebugInfo))
123 | .ToDictionary(x => FirstLower(x.Name), x => x.GetValue(this));
124 | var whereProperties = properties.Where(x => x.Value != default)
125 | .ToDictionary(x => x.Key, x => x.Value);
126 | if (properties.Count > 1)
127 | {
128 | _paramJson = JsonConvert.SerializeObject(new Dictionary
129 | {
130 | {ParamName, whereProperties}
131 | }); // 自计算需要传入的参数,减少model的代码体积
132 | }
133 | else if (properties.Count == 1)
134 | {
135 | _paramJson = JsonConvert.SerializeObject(new Dictionary
136 | {
137 | {ParamName, whereProperties.FirstOrDefault().Value}
138 | });
139 | }
140 | else
141 | {
142 | _paramJson = $"{{\"{ParamName}\":{{}}";
143 | }
144 |
145 | var urlParams = string.Empty;
146 | foreach (var item in signParams)
147 | {
148 | urlParams += $"&{item.Key}={HttpUtility.UrlEncode(item.Value.ToString(), Encoding.UTF8)}";
149 | }
150 |
151 | signParams.Add("param_json", _paramJson); // param json 参与加密但是不参与url
152 | var sign = Sign.SignToMd5(signParams, _appSecret);
153 | urlParams += "&sign=" + sign;
154 |
155 | var url = _baseUrl + "?" + urlParams.TrimStart('&');
156 | Debug.WriteLine(url);
157 | Debug.WriteLine($"param_json={HttpUtility.UrlEncode(_paramJson, Encoding.UTF8)}");
158 | var async = await url
159 | .WithHeader("Content-Type", "application/x-www-form-urlencoded")
160 | .PostStringAsync($"param_json={HttpUtility.UrlEncode(_paramJson, Encoding.UTF8)}");
161 |
162 | var @string = await async.Content.ReadAsStringAsync();
163 | Debug.WriteLine(@string);
164 | try
165 | {
166 | var flag = JsonConvert.DeserializeObject>(@string).First();
167 | var value = flag.Value;
168 | if (value.Code != "0") throw new Exception(@string);
169 | DebugInfo = new
170 | {
171 | Url = url,
172 | Request = _paramJson,
173 | Response = @string
174 | };
175 | return JsonConvert.DeserializeObject(value.Result);
176 | }
177 | catch (Exception ex)
178 | {
179 | DebugInfo = new
180 | {
181 | Url = url,
182 | Request = _paramJson,
183 | ex
184 | };
185 | //throw new Exception($"{@string}\r\n-----------------------------\r\n{ex}");
186 | return default;
187 | }
188 | }
189 | }
190 | }
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenGoodsSeckillQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 秒杀商品查询接口【申请】--请求参数
7 | /// 根据SKUID、类目等信息查询秒杀商品信息,秒杀商品的价格通常为近期低价,有利于促成购买。需向cps-qxsq@jd.com申请权限。
8 | /// jd.union.open.goods.seckill.query
9 | /// https://union.jd.com/openplatform/api/667
10 | ///
11 | public class JdUnionOpenGoodsSeckillQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenGoodsSeckillQueryRequest() { }
14 |
15 | public JdUnionOpenGoodsSeckillQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.goods.seckill.query";
18 |
19 | protected override string ParamName => "goodsReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 不必填
26 | /// 描述:sku id集合,长度最大30
27 | /// 例如:2622752,2112918
28 | ///
29 | public long[] SkuIds { get; set; }
30 | ///
31 | /// 不必填
32 | /// 描述:页码,默认1
33 | /// 例如:1
34 | ///
35 | public int? PageIndex { get; set; }
36 | ///
37 | /// 不必填
38 | /// 描述:每页数量最大30,默认30
39 | /// 例如:30
40 | ///
41 | public int? PageSize { get; set; }
42 | ///
43 | /// 不必填
44 | /// 描述:是否返回未开始秒杀商品。1=返回,0=不返回
45 | /// 例如:1
46 | ///
47 | public int? IsBeginSecKill { get; set; }
48 | ///
49 | /// 不必填
50 | /// 描述:秒杀价区间开始(单位:元)
51 | /// 例如:100
52 | ///
53 | public double? SecKillPriceFrom { get; set; }
54 | ///
55 | /// 不必填
56 | /// 描述:秒杀价区间结束
57 | /// 例如:1000
58 | ///
59 | public double? SecKillPriceTo { get; set; }
60 | ///
61 | /// 不必填
62 | /// 描述:一级类目
63 | /// 例如:9192
64 | ///
65 | public long? Cid1 { get; set; }
66 | ///
67 | /// 不必填
68 | /// 描述:二级类目
69 | /// 例如:9194
70 | ///
71 | public long? Cid2 { get; set; }
72 | ///
73 | /// 不必填
74 | /// 描述:三级类目
75 | /// 例如:9226
76 | ///
77 | public long? Cid3 { get; set; }
78 | ///
79 | /// 不必填
80 | /// 描述:g=自营,p=pop
81 | /// 例如:g
82 | ///
83 | public string Owner { get; set; }
84 | ///
85 | /// 不必填
86 | /// 描述:佣金比例区间开始
87 | /// 例如:2.5
88 | ///
89 | public double? CommissionShareFrom { get; set; }
90 | ///
91 | /// 不必填
92 | /// 描述:佣金比例区间结束
93 | /// 例如:15
94 | ///
95 | public double? CommissionShareTo { get; set; }
96 | ///
97 | /// 不必填
98 | /// 描述:排序字段,可为空。 (默认搜索综合排序。允许的排序字段:seckillPrice、commissionShare、inOrderCount30Days、inOrderComm30Days)
99 | /// 例如:seckillPrice
100 | ///
101 | public string SortName { get; set; }
102 | ///
103 | /// 不必填
104 | /// 描述:desc=降序,asc=升序,可为空(默认降序)
105 | /// 例如:desc
106 | ///
107 | public string Sort { get; set; }
108 | }
109 |
110 |
111 |
112 | ///
113 | /// 秒杀商品查询接口【申请】--响应参数
114 | /// 根据SKUID、类目等信息查询秒杀商品信息,秒杀商品的价格通常为近期低价,有利于促成购买。需向cps-qxsq@jd.com申请权限。
115 | /// jd.union.open.goods.seckill.query
116 | ///
117 | public class JdUnionOpenGoodsSeckillQueryResponse
118 | {
119 | ///
120 | /// 描述:商品名称
121 | /// 例如:EFE防辐射眼镜
122 | ///
123 | public string SkuName { get; set; }
124 | ///
125 | /// 描述:商品id
126 | /// 例如:11373310172
127 | ///
128 | public long? SkuId { get; set; }
129 | ///
130 | /// 描述:图片url
131 | /// 例如:jfs/t22312/48/1318588624/95503/53cbeb88/5b24d5b4N212e96a1.jpg
132 | ///
133 | public string ImageUrl { get; set; }
134 | ///
135 | /// 描述:是秒杀。1:是商品 0:非秒杀商品
136 | /// 例如:1
137 | ///
138 | public int? IsSecKill { get; set; }
139 | ///
140 | /// 描述:原价
141 | /// 例如:179
142 | ///
143 | public double? OriPrice { get; set; }
144 | ///
145 | /// 描述:秒杀价
146 | /// 例如:79
147 | ///
148 | public double? SecKillPrice { get; set; }
149 | ///
150 | /// 描述:秒杀开始展示时间(时间戳:毫秒)
151 | /// 例如:1533211200000
152 | ///
153 | public long? SecKillStartTime { get; set; }
154 | ///
155 | /// 描述:秒杀结束时间(时间戳:毫秒)
156 | /// 例如:1533297599000
157 | ///
158 | public long? SecKillEndTime { get; set; }
159 | ///
160 | /// 描述:一级类目id
161 | /// 例如:1315
162 | ///
163 | public long? Cid1Id { get; set; }
164 | ///
165 | /// 描述:二级类目id
166 | /// 例如:1346
167 | ///
168 | public long? Cid2Id { get; set; }
169 | ///
170 | /// 描述:三级类目id
171 | /// 例如:12019
172 | ///
173 | public long? Cid3Id { get; set; }
174 | ///
175 | /// 描述:一级类目名称
176 | /// 例如:服饰内衣
177 | ///
178 | public string Cid1Name { get; set; }
179 | ///
180 | /// 描述:二级类目名称
181 | /// 例如:服饰配件
182 | ///
183 | public string Cid2Name { get; set; }
184 | ///
185 | /// 描述:三级类目名称
186 | /// 例如:防辐射眼镜
187 | ///
188 | public string Cid3Name { get; set; }
189 | ///
190 | /// 描述:通用佣金比例,百分比
191 | /// 例如:23.0
192 | ///
193 | public double? CommissionShare { get; set; }
194 | ///
195 | /// 描述:通用佣金
196 | /// 例如:18.17
197 | ///
198 | public double? Commission { get; set; }
199 | ///
200 | /// 描述:是否自营。g=自营,p=pop
201 | /// 例如:p
202 | ///
203 | public string Owner { get; set; }
204 | ///
205 | /// 描述:30天引入订单量(spu)
206 | /// 例如:1688
207 | ///
208 | public long? InOrderCount30Days { get; set; }
209 | ///
210 | /// 描述:30天支出佣金(spu)
211 | /// 例如:15856.54
212 | ///
213 | public double? InOrderComm30Days { get; set; }
214 | ///
215 | /// 描述:京东价
216 | /// 例如:138.0
217 | ///
218 | public double? JdPrice { get; set; }
219 | }
220 |
221 | }
222 |
223 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015/2017 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # Visual Studio 2017 auto generated files
33 | Generated\ Files/
34 |
35 | # MSTest test Results
36 | [Tt]est[Rr]esult*/
37 | [Bb]uild[Ll]og.*
38 |
39 | # NUNIT
40 | *.VisualState.xml
41 | TestResult.xml
42 |
43 | # Build Results of an ATL Project
44 | [Dd]ebugPS/
45 | [Rr]eleasePS/
46 | dlldata.c
47 |
48 | # Benchmark Results
49 | BenchmarkDotNet.Artifacts/
50 |
51 | # .NET Core
52 | project.lock.json
53 | project.fragment.lock.json
54 | artifacts/
55 | **/Properties/launchSettings.json
56 |
57 | # StyleCop
58 | StyleCopReport.xml
59 |
60 | # Files built by Visual Studio
61 | *_i.c
62 | *_p.c
63 | *_i.h
64 | *.ilk
65 | *.meta
66 | *.obj
67 | *.iobj
68 | *.pch
69 | *.pdb
70 | *.ipdb
71 | *.pgc
72 | *.pgd
73 | *.rsp
74 | *.sbr
75 | *.tlb
76 | *.tli
77 | *.tlh
78 | *.tmp
79 | *.tmp_proj
80 | *.log
81 | *.vspscc
82 | *.vssscc
83 | .builds
84 | *.pidb
85 | *.svclog
86 | *.scc
87 |
88 | # Chutzpah Test files
89 | _Chutzpah*
90 |
91 | # Visual C++ cache files
92 | ipch/
93 | *.aps
94 | *.ncb
95 | *.opendb
96 | *.opensdf
97 | *.sdf
98 | *.cachefile
99 | *.VC.db
100 | *.VC.VC.opendb
101 |
102 | # Visual Studio profiler
103 | *.psess
104 | *.vsp
105 | *.vspx
106 | *.sap
107 |
108 | # Visual Studio Trace Files
109 | *.e2e
110 |
111 | # TFS 2012 Local Workspace
112 | $tf/
113 |
114 | # Guidance Automation Toolkit
115 | *.gpState
116 |
117 | # ReSharper is a .NET coding add-in
118 | _ReSharper*/
119 | *.[Rr]e[Ss]harper
120 | *.DotSettings.user
121 |
122 | # JustCode is a .NET coding add-in
123 | .JustCode
124 |
125 | # TeamCity is a build add-in
126 | _TeamCity*
127 |
128 | # DotCover is a Code Coverage Tool
129 | *.dotCover
130 |
131 | # AxoCover is a Code Coverage Tool
132 | .axoCover/*
133 | !.axoCover/settings.json
134 |
135 | # Visual Studio code coverage results
136 | *.coverage
137 | *.coveragexml
138 |
139 | # NCrunch
140 | _NCrunch_*
141 | .*crunch*.local.xml
142 | nCrunchTemp_*
143 |
144 | # MightyMoose
145 | *.mm.*
146 | AutoTest.Net/
147 |
148 | # Web workbench (sass)
149 | .sass-cache/
150 |
151 | # Installshield output folder
152 | [Ee]xpress/
153 |
154 | # DocProject is a documentation generator add-in
155 | DocProject/buildhelp/
156 | DocProject/Help/*.HxT
157 | DocProject/Help/*.HxC
158 | DocProject/Help/*.hhc
159 | DocProject/Help/*.hhk
160 | DocProject/Help/*.hhp
161 | DocProject/Help/Html2
162 | DocProject/Help/html
163 |
164 | # Click-Once directory
165 | publish/
166 |
167 | # Publish Web Output
168 | *.[Pp]ublish.xml
169 | *.azurePubxml
170 | # Note: Comment the next line if you want to checkin your web deploy settings,
171 | # but database connection strings (with potential passwords) will be unencrypted
172 | *.pubxml
173 | *.publishproj
174 |
175 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
176 | # checkin your Azure Web App publish settings, but sensitive information contained
177 | # in these scripts will be unencrypted
178 | PublishScripts/
179 |
180 | # NuGet Packages
181 | *.nupkg
182 | # The packages folder can be ignored because of Package Restore
183 | **/[Pp]ackages/*
184 | # except build/, which is used as an MSBuild target.
185 | !**/[Pp]ackages/build/
186 | # Uncomment if necessary however generally it will be regenerated when needed
187 | #!**/[Pp]ackages/repositories.config
188 | # NuGet v3's project.json files produces more ignorable files
189 | *.nuget.props
190 | *.nuget.targets
191 |
192 | # Microsoft Azure Build Output
193 | csx/
194 | *.build.csdef
195 |
196 | # Microsoft Azure Emulator
197 | ecf/
198 | rcf/
199 |
200 | # Windows Store app package directories and files
201 | AppPackages/
202 | BundleArtifacts/
203 | Package.StoreAssociation.xml
204 | _pkginfo.txt
205 | *.appx
206 |
207 | # Visual Studio cache files
208 | # files ending in .cache can be ignored
209 | *.[Cc]ache
210 | # but keep track of directories ending in .cache
211 | !*.[Cc]ache/
212 |
213 | # Others
214 | ClientBin/
215 | ~$*
216 | *~
217 | *.dbmdl
218 | *.dbproj.schemaview
219 | *.jfm
220 | *.pfx
221 | *.publishsettings
222 | orleans.codegen.cs
223 |
224 | # Including strong name files can present a security risk
225 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
226 | #*.snk
227 |
228 | # Since there are multiple workflows, uncomment next line to ignore bower_components
229 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
230 | #bower_components/
231 |
232 | # RIA/Silverlight projects
233 | Generated_Code/
234 |
235 | # Backup & report files from converting an old project file
236 | # to a newer Visual Studio version. Backup files are not needed,
237 | # because we have git ;-)
238 | _UpgradeReport_Files/
239 | Backup*/
240 | UpgradeLog*.XML
241 | UpgradeLog*.htm
242 | ServiceFabricBackup/
243 | *.rptproj.bak
244 |
245 | # SQL Server files
246 | *.mdf
247 | *.ldf
248 | *.ndf
249 |
250 | # Business Intelligence projects
251 | *.rdl.data
252 | *.bim.layout
253 | *.bim_*.settings
254 | *.rptproj.rsuser
255 |
256 | # Microsoft Fakes
257 | FakesAssemblies/
258 |
259 | # GhostDoc plugin setting file
260 | *.GhostDoc.xml
261 |
262 | # Node.js Tools for Visual Studio
263 | .ntvs_analysis.dat
264 | node_modules/
265 |
266 | # Visual Studio 6 build log
267 | *.plg
268 |
269 | # Visual Studio 6 workspace options file
270 | *.opt
271 |
272 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
273 | *.vbw
274 |
275 | # Visual Studio LightSwitch build output
276 | **/*.HTMLClient/GeneratedArtifacts
277 | **/*.DesktopClient/GeneratedArtifacts
278 | **/*.DesktopClient/ModelManifest.xml
279 | **/*.Server/GeneratedArtifacts
280 | **/*.Server/ModelManifest.xml
281 | _Pvt_Extensions
282 |
283 | # Paket dependency manager
284 | .paket/paket.exe
285 | paket-files/
286 |
287 | # FAKE - F# Make
288 | .fake/
289 |
290 | # JetBrains Rider
291 | .idea/
292 | *.sln.iml
293 |
294 | # CodeRush
295 | .cr/
296 |
297 | # Python Tools for Visual Studio (PTVS)
298 | __pycache__/
299 | *.pyc
300 |
301 | # Cake - Uncomment if you are using it
302 | # tools/**
303 | # !tools/packages.config
304 |
305 | # Tabs Studio
306 | *.tss
307 |
308 | # Telerik's JustMock configuration file
309 | *.jmconfig
310 |
311 | # BizTalk build output
312 | *.btp.cs
313 | *.btm.cs
314 | *.odx.cs
315 | *.xsd.cs
316 |
317 | # OpenCover UI analysis results
318 | OpenCover/
319 |
320 | # Azure Stream Analytics local run output
321 | ASALocalRun/
322 |
323 | # MSBuild Binary and Structured Log
324 | *.binlog
325 |
326 | # NVidia Nsight GPU debugger configuration file
327 | *.nvuser
328 |
329 | # MFractors (Xamarin productivity tool) working folder
330 | .mfractor/
331 |
332 | dist/
333 | src/Tool/codes/
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkLotteryUrlGen.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多客生成转盘抽免单url--请求参数
8 | /// 多多客工具生成转盘抽免单url
9 | /// pdd.ddk.lottery.url.gen
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.lottery.url.gen
11 | ///
12 | public class PddDdkLotteryUrlGenRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.lottery.url.gen";
15 |
16 | public PddDdkLotteryUrlGenRequest() { }
17 |
18 | public PddDdkLotteryUrlGenRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 必填
24 | /// 推广位
25 | ///
26 | public string[] PidList { get; set; }
27 | ///
28 | /// 不必填
29 | /// 是否生成唤起微信客户端链接,true-是,false-否,默认false
30 | ///
31 | public bool? GenerateWeappWebview { get; set; }
32 | ///
33 | /// 不必填
34 | /// 是否生成短链接,true-是,false-否
35 | ///
36 | public string GenerateShortUrl { get; set; }
37 | ///
38 | /// 不必填
39 | /// true--生成多人团推广链接 false--生成单人团推广链接(默认false)1、单人团推广链接:用户访问单人团推广链接,可直接购买商品无需拼团。2、多人团推广链接:用户访问双人团推广链接开团,若用户分享给他人参团,则开团者和参团者的佣金均结算给推手
40 | ///
41 | public bool? MultiGroup { get; set; }
42 | ///
43 | /// 不必填
44 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
45 | ///
46 | public string CustomParameters { get; set; }
47 | ///
48 | /// 不必填
49 | /// 是否生成大转盘和主题的小程序推广链接
50 | ///
51 | public bool? GenerateWeApp { get; set; }
52 | }
53 |
54 |
55 | ///
56 | /// 多多客生成转盘抽免单url--响应参数
57 | /// 多多客工具生成转盘抽免单url
58 | ///
59 | public class PddDdkLotteryUrlGenResponse : PddBaseResponse
60 | {
61 | ///
62 | /// 返回总数
63 | ///
64 | [JsonProperty("total")]
65 | public int? Total { get; set; }
66 | ///
67 | /// 推广链接
68 | ///
69 | [JsonProperty("url_list")]
70 | public PddDdkLotteryUrlGen_UrlList[] UrlList { get; set; }
71 | }
72 |
73 | ///
74 | /// 转盘抽免单单人团链接
75 | ///
76 | public class PddDdkLotteryUrlGen_SingleUrlList
77 | {
78 | ///
79 | /// 转盘抽免单长链接
80 | ///
81 | [JsonProperty("url")]
82 | public string Url { get; set; }
83 | ///
84 | /// 转盘抽免单短链接
85 | ///
86 | [JsonProperty("short_url")]
87 | public string ShortUrl { get; set; }
88 | ///
89 | /// 转盘抽免单唤醒APP长链接
90 | ///
91 | [JsonProperty("mobile_url")]
92 | public string MobileUrl { get; set; }
93 | ///
94 | /// 转盘抽免单唤醒APP短链接
95 | ///
96 | [JsonProperty("mobile_short_url")]
97 | public string MobileShortUrl { get; set; }
98 | ///
99 | /// 转盘抽免单唤醒微信长链接
100 | ///
101 | [JsonProperty("we_app_web_view_url")]
102 | public string WeAppWebViewUrl { get; set; }
103 | ///
104 | /// 转盘抽免单唤醒微信短链接
105 | ///
106 | [JsonProperty("we_app_web_view_short_url")]
107 | public string WeAppWebViewShortUrl { get; set; }
108 | ///
109 | /// 转盘抽免单小程序短链接
110 | ///
111 | [JsonProperty("we_app_page_path")]
112 | public string WeAppPagePath { get; set; }
113 | }
114 | ///
115 | /// 转盘抽免单多人团链接
116 | ///
117 | public class PddDdkLotteryUrlGen_MultiUrlList
118 | {
119 | ///
120 | /// 转盘抽免单长链接
121 | ///
122 | [JsonProperty("url")]
123 | public string Url { get; set; }
124 | ///
125 | /// 转盘抽免单短链接
126 | ///
127 | [JsonProperty("short_url")]
128 | public string ShortUrl { get; set; }
129 | ///
130 | /// 转盘抽免单唤醒拼多多APP长链接
131 | ///
132 | [JsonProperty("mobile_url")]
133 | public string MobileUrl { get; set; }
134 | ///
135 | /// 转盘抽免单唤醒拼多多APP短链接
136 | ///
137 | [JsonProperty("mobile_short_url")]
138 | public string MobileShortUrl { get; set; }
139 | ///
140 | /// 转盘抽免单唤醒微信长链接
141 | ///
142 | [JsonProperty("we_app_web_view_url")]
143 | public string WeAppWebViewUrl { get; set; }
144 | ///
145 | /// 转盘抽免单唤醒微信短链接
146 | ///
147 | [JsonProperty("we_app_web_view_short_url")]
148 | public string WeAppWebViewShortUrl { get; set; }
149 | ///
150 | /// 转盘抽免单小程序链接
151 | ///
152 | [JsonProperty("we_app_page_path")]
153 | public string WeAppPagePath { get; set; }
154 | }
155 | ///
156 | /// 小程序信息
157 | ///
158 | public class PddDdkLotteryUrlGen_WeAppInfo
159 | {
160 | ///
161 | /// 小程序ID
162 | ///
163 | [JsonProperty("app_id")]
164 | public string AppId { get; set; }
165 | ///
166 | /// 小程序图片
167 | ///
168 | [JsonProperty("we_app_icon_url")]
169 | public string WeAppIconUrl { get; set; }
170 | ///
171 | /// Banner图
172 | ///
173 | [JsonProperty("banner_url")]
174 | public string BannerUrl { get; set; }
175 | ///
176 | /// 描述
177 | ///
178 | [JsonProperty("desc")]
179 | public string Desc { get; set; }
180 | ///
181 | /// 来源名
182 | ///
183 | [JsonProperty("source_display_name")]
184 | public string SourceDisplayName { get; set; }
185 | ///
186 | /// 小程序path值
187 | ///
188 | [JsonProperty("page_path")]
189 | public string PagePath { get; set; }
190 | ///
191 | /// 用户名
192 | ///
193 | [JsonProperty("user_name")]
194 | public string UserName { get; set; }
195 | ///
196 | /// 小程序标题
197 | ///
198 | [JsonProperty("title")]
199 | public string Title { get; set; }
200 | }
201 | ///
202 | /// 推广链接
203 | ///
204 | public class PddDdkLotteryUrlGen_UrlList
205 | {
206 | ///
207 | /// 转盘抽免单单人团链接
208 | ///
209 | [JsonProperty("single_url_list")]
210 | public PddDdkLotteryUrlGen_SingleUrlList SingleUrlList { get; set; }
211 | ///
212 | /// 转盘抽免单多人团链接
213 | ///
214 | [JsonProperty("multi_url_list")]
215 | public PddDdkLotteryUrlGen_MultiUrlList MultiUrlList { get; set; }
216 | ///
217 | /// 自定义参数
218 | ///
219 | [JsonProperty("sign")]
220 | public string Sign { get; set; }
221 | ///
222 | /// 小程序信息
223 | ///
224 | [JsonProperty("we_app_info")]
225 | public PddDdkLotteryUrlGen_WeAppInfo WeAppInfo { get; set; }
226 | }
227 | }
228 |
229 |
--------------------------------------------------------------------------------
/src/Tool/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System;
6 | using Flurl.Http;
7 | using Newtonsoft.Json;
8 |
9 | namespace Tool
10 | {
11 | partial class Program
12 | {
13 | static async Task Main()
14 | {
15 | Console.WriteLine("1-京东");
16 | Console.WriteLine("2-拼多多");
17 | var type = Console.ReadKey();
18 | Console.WriteLine();
19 | Console.WriteLine("获取全部接口");
20 |
21 | if (type.KeyChar == '1')
22 | {
23 | var allApiJson = await "https://union.jd.com/api/apiDoc/categoryList"
24 | .PostStringAsync("{}").Result
25 | .Content.ReadAsStringAsync();
26 |
27 | var allApi = JsonConvert.DeserializeObject(allApiJson);
28 | Directory.CreateDirectory("../Jd.Sdk/Apis");
29 | foreach (var item in allApi.Data[0].Apis)
30 | {
31 | var code = await GetJdCode(item.ApiId);
32 | var className = code.FirstOrDefault(x => x.Trim().StartsWith("public class ") && x.EndsWith("Request : JdBaseRequest"));
33 | if (className != default)
34 | {
35 | var flatCode = FlatCode(code);
36 | var apiName = className.Trim().Split(' ')[2].Replace("Request", "");
37 | File.WriteAllLines($"../Jd.Sdk/Apis/{apiName}.cs", flatCode);
38 | Console.WriteLine();
39 | Console.WriteLine("[Fact]");
40 | Console.WriteLine($"public async void Test_{apiName}()");
41 | Console.WriteLine("{");
42 | Console.WriteLine($"var req = new {apiName}Request(_appKey, _appSecret)");
43 | Console.WriteLine("{");
44 | Console.WriteLine("// todo 参数");
45 | Console.WriteLine("};");
46 | Console.WriteLine("var res = await req.InvokeAsync();");
47 | Console.WriteLine("_output.WriteLine(JsonConvert.SerializeObject(req.DebugInfo, Formatting.Indented));");
48 | Console.WriteLine("Assert.True(res.Code == 200);");
49 | Console.WriteLine("}");
50 | }
51 | // Console.WriteLine("SUCCESS:" + item.ApiName);
52 | }
53 | }
54 | else if (type.KeyChar == '2')
55 | {
56 | var allApiJson = await "https://open-api.pinduoduo.com/pop/doc/info/list/byCat"
57 | .PostJsonAsync(new { id = 12 }).Result
58 | .Content.ReadAsStringAsync();
59 |
60 | var allApi = JsonConvert.DeserializeObject(allApiJson);
61 | Directory.CreateDirectory("../Pdd.Sdk/Apis");
62 | foreach (var item in allApi.Result.DocList)
63 | {
64 | var code = await GetPddCode(item.Id);
65 | var apiName = string.Join("", item.Id.Split('.').Select(UpperFirst));
66 | var flatCode = FlatCode(code);
67 | Console.WriteLine("[Fact]");
68 | Console.WriteLine($"public async Task Test_{apiName}()");
69 | Console.WriteLine("{");
70 | Console.WriteLine($"var req = new {apiName}Request(_clientId, _clientSecret)");
71 | Console.WriteLine("{");
72 | Console.WriteLine("// todo");
73 | Console.WriteLine("};");
74 | Console.WriteLine("var res = await req.InvokeAsync();");
75 | Console.WriteLine("_output.WriteLine(JsonConvert.SerializeObject(req.DebugInfo, Formatting.Indented));");
76 | Console.WriteLine("Assert.True(res != default);");
77 | Console.WriteLine("}");
78 | File.WriteAllLines($"../Pdd.Sdk/Apis/{apiName}.cs", flatCode);
79 | }
80 |
81 | // var code = await GetPddCode("pdd.ddk.cms.prom.url.generate");
82 | }
83 | Console.WriteLine("回车结束...");
84 | Console.ReadLine();
85 | }
86 |
87 |
88 | ///
89 | /// 扁平 代码 调整嵌套类
90 | ///
91 | ///
92 | ///
93 | static string[] FlatCode(string[] source)
94 | {
95 | var copy = new List(source.AsEnumerable());
96 | var nestClass = source.Where(x => GetStartContinuous(x, ' ').Length >= 8 && x.Trim().StartsWith("public class")).ToArray();
97 | var toEnds = new List();
98 | foreach (var item in nestClass.OrderByDescending(x => GetStartContinuous(x, ' ').Length))
99 | {
100 | var start = copy
101 | .ToList()
102 | .IndexOf(item)
103 | - 3;
104 | var end = copy
105 | .Skip(start).ToList()
106 | .IndexOf(GetStartContinuous(item, ' ') + "}")
107 | + 1;
108 | toEnds.Add(copy.Skip(start).Take(end).ToArray());
109 | copy.RemoveRange(start, end);
110 | }
111 | copy.RemoveAt(copy.Count - 2);
112 | foreach (var item in toEnds)
113 | {
114 | var allLength = item.Select(x => GetStartContinuous(x, ' ').Length)
115 | .Where(x => x > 4)
116 | .ToArray();
117 | var max = allLength.Max();
118 | var min = allLength.Min();
119 | var temp = item.Select((x, i) =>
120 | {
121 | var l = GetStartContinuous(x, ' ').Length;
122 | if (l == min)
123 | return " " + x.Trim();
124 | else if (l == max)
125 | return " " + x.Trim();
126 | return default;
127 | }).Where(x => x != default);
128 | copy.AddRange(temp);
129 | }
130 | copy.Add("}");
131 | copy.Add("");
132 | return copy.ToArray();
133 | }
134 |
135 | ///
136 | /// 获取连续头部指定内容
137 | ///
138 | ///
139 | ///
140 | ///
141 | static string GetStartContinuous(string source, char @char)
142 | {
143 | var result = string.Empty;
144 | foreach (var c in source)
145 | {
146 | if (c != @char) break;
147 | result += c;
148 | }
149 | return result;
150 | }
151 |
152 | ///
153 | /// 首字符大写
154 | ///
155 | ///
156 | ///
157 | static string UpperFirst(string that)
158 | {
159 | return that[0].ToString().ToUpper() + that.Substring(1);
160 | }
161 |
162 | ///
163 | /// 切换类型
164 | ///
165 | ///
166 | ///
167 | static string SwitchType(string type)
168 | {
169 | switch (type.ToLower())
170 | {
171 | case "bool":
172 | case "boolean": return "bool?";
173 | case "int":
174 | case "integer": return "int?";
175 | case "integer[]": return "int[]";
176 | case "long": return "long?";
177 | case "double": return "double?";
178 | case "map": return "System.Collections.Generic.Dictionary";
179 | default: return type.ToLower();
180 | }
181 | }
182 | }
183 | }
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkTopGoodsListQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 多多客获取爆款排行商品接口--请求参数
8 | /// 获取热销商品列表
9 | /// pdd.ddk.top.goods.list.query
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.top.goods.list.query
11 | ///
12 | public class PddDdkTopGoodsListQueryRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.top.goods.list.query";
15 |
16 | public PddDdkTopGoodsListQueryRequest() { }
17 |
18 | public PddDdkTopGoodsListQueryRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 推广位id
25 | ///
26 | public string PId { get; set; }
27 | ///
28 | /// 不必填
29 | /// 从多少位置开始请求;默认值 : 0
30 | ///
31 | public int? Offset { get; set; }
32 | ///
33 | /// 不必填
34 | /// 1-实时热销榜;2-实时收益榜
35 | ///
36 | public int? SortType { get; set; }
37 | ///
38 | /// 不必填
39 | /// 请求数量;默认值 : 400
40 | ///
41 | public int? Limit { get; set; }
42 | }
43 |
44 |
45 | ///
46 | /// 多多客获取爆款排行商品接口--响应参数
47 | /// 获取热销商品列表
48 | ///
49 | public class PddDdkTopGoodsListQueryResponse : PddBaseResponse
50 | {
51 | ///
52 | /// 商品列表
53 | ///
54 | [JsonProperty("list")]
55 | public PddDdkTopGoodsListQuery_List[] List { get; set; }
56 | ///
57 | /// 返回商品总数
58 | ///
59 | [JsonProperty("total")]
60 | public long? Total { get; set; }
61 | }
62 |
63 | ///
64 | /// 商品列表
65 | ///
66 | public class PddDdkTopGoodsListQuery_List
67 | {
68 | ///
69 | /// 商品id
70 | ///
71 | [JsonProperty("goods_id")]
72 | public long? GoodsId { get; set; }
73 | ///
74 | /// 商品名称
75 | ///
76 | [JsonProperty("goods_name")]
77 | public string GoodsName { get; set; }
78 | ///
79 | /// 商品描述
80 | ///
81 | [JsonProperty("goods_desc")]
82 | public string GoodsDesc { get; set; }
83 | ///
84 | /// 商品缩略图
85 | ///
86 | [JsonProperty("goods_thumbnail_url")]
87 | public string GoodsThumbnailUrl { get; set; }
88 | ///
89 | /// 商品主图
90 | ///
91 | [JsonProperty("goods_image_url")]
92 | public string GoodsImageUrl { get; set; }
93 | ///
94 | /// 商品轮播图
95 | ///
96 | [JsonProperty("goods_gallery_urls")]
97 | public string[] GoodsGalleryUrls { get; set; }
98 | ///
99 | /// 已售卖件数
100 | ///
101 | [JsonProperty("sold_quantity")]
102 | public long? SoldQuantity { get; set; }
103 | ///
104 | /// 最小拼团价(单位为分)
105 | ///
106 | [JsonProperty("min_group_price")]
107 | public long? MinGroupPrice { get; set; }
108 | ///
109 | /// 最小单买价格(单位为分)
110 | ///
111 | [JsonProperty("min_normal_price")]
112 | public long? MinNormalPrice { get; set; }
113 | ///
114 | /// 店铺名字
115 | ///
116 | [JsonProperty("mall_name")]
117 | public string MallName { get; set; }
118 | ///
119 | /// 店铺类型,1-个人,2-企业,3-旗舰店,4-专卖店,5-专营店,6-普通店
120 | ///
121 | [JsonProperty("merchant_type")]
122 | public int? MerchantType { get; set; }
123 | ///
124 | /// 商品类目ID,使用pdd.goods.cats.get接口获取
125 | ///
126 | [JsonProperty("category_id")]
127 | public long? CategoryId { get; set; }
128 | ///
129 | /// 商品类目名
130 | ///
131 | [JsonProperty("category_name")]
132 | public string CategoryName { get; set; }
133 | ///
134 | /// 商品标签ID,使用pdd.goods.opts.get接口获取
135 | ///
136 | [JsonProperty("opt_id")]
137 | public long? OptId { get; set; }
138 | ///
139 | /// 商品标签名
140 | ///
141 | [JsonProperty("opt_name")]
142 | public string OptName { get; set; }
143 | ///
144 | /// 商品标签id
145 | ///
146 | [JsonProperty("opt_ids")]
147 | public long[] OptIds { get; set; }
148 | ///
149 | /// 商品类目id
150 | ///
151 | [JsonProperty("cat_ids")]
152 | public long[] CatIds { get; set; }
153 | ///
154 | /// 该商品所在店铺是否参与全店推广,0:否,1:是
155 | ///
156 | [JsonProperty("mall_cps")]
157 | public int? MallCps { get; set; }
158 | ///
159 | /// 商品是否有优惠券 true-有,false-没有
160 | ///
161 | [JsonProperty("has_coupon")]
162 | public bool? HasCoupon { get; set; }
163 | ///
164 | /// 优惠券门槛价格,单位为分
165 | ///
166 | [JsonProperty("coupon_min_order_amount")]
167 | public long? CouponMinOrderAmount { get; set; }
168 | ///
169 | /// 优惠券面额,单位为分
170 | ///
171 | [JsonProperty("coupon_discount")]
172 | public long? CouponDiscount { get; set; }
173 | ///
174 | /// 优惠券总数量
175 | ///
176 | [JsonProperty("coupon_total_quantity")]
177 | public long? CouponTotalQuantity { get; set; }
178 | ///
179 | /// 优惠券剩余数量
180 | ///
181 | [JsonProperty("coupon_remain_quantity")]
182 | public long? CouponRemainQuantity { get; set; }
183 | ///
184 | /// 优惠券生效时间,UNIX时间戳
185 | ///
186 | [JsonProperty("coupon_start_time")]
187 | public long? CouponStartTime { get; set; }
188 | ///
189 | /// 优惠券失效时间,UNIX时间戳
190 | ///
191 | [JsonProperty("coupon_end_time")]
192 | public long? CouponEndTime { get; set; }
193 | ///
194 | /// 佣金比例,千分比
195 | ///
196 | [JsonProperty("promotion_rate")]
197 | public long? PromotionRate { get; set; }
198 | ///
199 | /// 商品评价分
200 | ///
201 | [JsonProperty("goods_eval_score")]
202 | public double? GoodsEvalScore { get; set; }
203 | ///
204 | /// 商品评价数量
205 | ///
206 | [JsonProperty("goods_eval_count")]
207 | public long? GoodsEvalCount { get; set; }
208 | ///
209 | /// 描述评分
210 | ///
211 | [JsonProperty("avg_desc")]
212 | public long? AvgDesc { get; set; }
213 | ///
214 | /// 物流评分
215 | ///
216 | [JsonProperty("avg_lgst")]
217 | public long? AvgLgst { get; set; }
218 | ///
219 | /// 服务评分
220 | ///
221 | [JsonProperty("avg_serv")]
222 | public long? AvgServ { get; set; }
223 | ///
224 | /// 描述分击败同类店铺百分比
225 | ///
226 | [JsonProperty("desc_pct")]
227 | public double? DescPct { get; set; }
228 | ///
229 | /// 物流分击败同类店铺百分比
230 | ///
231 | [JsonProperty("lgst_pct")]
232 | public double? LgstPct { get; set; }
233 | ///
234 | /// 服务分击败同类店铺百分比
235 | ///
236 | [JsonProperty("serv_pct")]
237 | public double? ServPct { get; set; }
238 | ///
239 | /// 模糊销量
240 | ///
241 | [JsonProperty("sales_tip")]
242 | public string SalesTip { get; set; }
243 | }
244 | }
245 |
246 |
--------------------------------------------------------------------------------
/src/Tool/JdRootobject.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Text;
3 | using System.Threading.Tasks;
4 | using Flurl.Http;
5 | using Newtonsoft.Json;
6 |
7 | namespace Tool
8 | {
9 | partial class Program
10 | {
11 | static async Task GetJdCode(int id)
12 | {
13 | var sender = await $"https://union.jd.com/api/apiDoc/apiDocInfo?apiId={id}".PostJsonAsync(new object());
14 | var @string = await sender.Content.ReadAsStringAsync();
15 | var root = JsonConvert.DeserializeObject(@string);
16 |
17 | var className = string.Join("", root.Data.ApiName.Split('.').Select(UpperFirst));
18 | var code = new StringBuilder();
19 | code.AppendLine("using System.Threading.Tasks;");
20 | code.AppendLine();
21 | code.AppendLine("namespace Jd.Sdk.Apis");
22 | code.AppendLine("{");
23 | code.AppendLine(" /// ");
24 | code.AppendLine($" /// {root.Data.Caption}--请求参数");
25 | code.AppendLine($" /// {root.Data.Description.Trim()}");
26 | code.AppendLine($" /// {root.Data.ApiName.Trim()}");
27 | code.AppendLine($" /// https://union.jd.com/openplatform/api/{id}");
28 | code.AppendLine(" /// ");
29 | code.AppendLine($" public class {className}Request : JdBaseRequest");
30 | code.AppendLine(" {");
31 | code.AppendLine($" public {className}Request() {{ }}");
32 | code.AppendLine();
33 | code.AppendLine($" public {className}Request(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) {{ }}");
34 | code.AppendLine();
35 | code.AppendLine($" protected override string Method => \"{root.Data.ApiName}\";");
36 | code.AppendLine();
37 | var firstReq = root.Data.PLists.FirstOrDefault(x => x.DataType.EndsWith("Req"));
38 | if (firstReq == null)
39 | {
40 | firstReq = root.Data.PLists.First(x => x.DataName != "ROOT");
41 |
42 | code.AppendLine(" /// ");
43 | code.AppendLine($" /// {(firstReq.IsRequired.Trim() == "true" ? "必填" : "不必填")}");
44 | code.AppendLine($" /// 描述:{firstReq.Description.Trim()}");
45 | code.AppendLine($" /// 例如:{firstReq.SampleValue.Trim()}");
46 | code.AppendLine(" /// ");
47 | code.AppendLine($" public {SwitchType(firstReq.DataType)} {UpperFirst(firstReq.DataName)} {{ get; set; }}");
48 | code.AppendLine();
49 | }
50 |
51 | code.AppendLine($" protected override string ParamName => \"{firstReq.DataName}\";");
52 | code.AppendLine();
53 |
54 | var isPage = root.Data.SLists.Any(x => x.DataName == "hasMore")
55 | ? "JdBasePageResponse"
56 | : "JdBaseResponse";
57 | var firstData = root.Data.SLists.FirstOrDefault(x => x.DataName == "data");
58 | var isArray = string.Empty;
59 | if (firstData != default)
60 | {
61 | isArray = firstData.DataType.EndsWith("[]")
62 | ? $"<{className}Response[]>"
63 | : $"<{className}Response>";
64 | }
65 | else
66 | {
67 |
68 | }
69 | code.AppendLine($" public async Task<{isPage}{isArray}> InvokeAsync()");
70 | code.AppendLine($" => await PostAsync<{isPage}{isArray}>();");
71 | code.AppendLine();
72 |
73 | foreach (var item in root.Data.PLists.Where(x => x.DataName != "ROOT" && x.DataName != firstReq.DataName))
74 | {
75 | GetJdParamStereoscopic(item, root.Data.PLists, className, " ", true, ref code);
76 | }
77 |
78 | code.AppendLine(" }");
79 | code.AppendLine();
80 | code.AppendLine();
81 | code.AppendLine();
82 |
83 | if (firstData != default)
84 | {
85 |
86 | code.AppendLine(" /// ");
87 | code.AppendLine($" /// {root.Data.Caption}--响应参数");
88 | code.AppendLine($" /// {root.Data.Description.Trim()}");
89 | code.AppendLine($" /// {root.Data.ApiName.Trim()}");
90 | code.AppendLine(" /// ");
91 | code.AppendLine($" public class {className}Response");
92 | code.AppendLine(" {");
93 | foreach (var item in root.Data.SLists.Where(x => x.ParentId == firstData.NodeId))
94 | {
95 | GetJdParamStereoscopic(item, root.Data.SLists, className, " ", false, ref code);
96 | }
97 | code.AppendLine(" }");
98 | }
99 | else
100 | {
101 | code.AppendLine(" //--------------------------------------");
102 | code.AppendLine(" // 返回值没有data内容,直接使用基础响应基类");
103 | code.AppendLine(" //--------------------------------------");
104 | }
105 | code.AppendLine("}");
106 | return code.ToString().Split("\r\n");
107 | }
108 |
109 | static void GetJdParamStereoscopic(
110 | JdPlist item,
111 | JdPlist[] all,
112 | string className,
113 | string spacing,
114 | bool isRequest,
115 | ref StringBuilder code)
116 | {
117 | code.AppendLine($"{spacing}/// ");
118 | if (isRequest)
119 | {
120 | code.AppendLine($"{spacing}/// {(item.IsRequired.Trim() == "true" ? "必填" : "不必填")}");
121 | }
122 | code.AppendLine($"{spacing}/// 描述:{item.Description}");
123 | code.AppendLine($"{spacing}/// 例如:{item.SampleValue}");
124 | code.AppendLine($"{spacing}/// ");
125 |
126 | var currentNodes = all.Where(x => x.ParentId == item.NodeId).ToArray();
127 |
128 | if (currentNodes.Any())
129 | {
130 | var tempName = item.DataType.Replace("[]", "").ToLower();
131 | var tempSymbol = item.DataType.EndsWith("[]") ? "[]" : "";
132 | code.AppendLine($"{spacing}public {className}_{UpperFirst(tempName)}{tempSymbol} {UpperFirst(item.DataName)} {{ get; set; }}");
133 | code.AppendLine($"{spacing}/// ");
134 | code.AppendLine($"{spacing}/// {item.Description}");
135 | code.AppendLine($"{spacing}/// ");
136 | code.AppendLine($"{spacing}public class {className}_{UpperFirst(tempName)}");
137 | code.AppendLine($"{spacing}{{");
138 | foreach (var that in currentNodes)
139 | {
140 | GetJdParamStereoscopic(that, all, className, spacing + " ", isRequest, ref code);
141 | }
142 | code.AppendLine($"{spacing}}}");
143 | }
144 | else
145 | {
146 | code.AppendLine($"{spacing}public {SwitchType(item.DataType)} {UpperFirst(item.DataName)} {{ get; set; }}");
147 | }
148 | }
149 | }
150 |
151 | public class JdRootObject
152 | {
153 | public JdData Data { get; set; }
154 | }
155 |
156 | public class JdData
157 | {
158 | public string ApiName { get; set; }
159 | public string Caption { get; set; }
160 | public string Description { get; set; }
161 | public JdPlist[] PLists { get; set; }
162 | public JdPlist[] SLists { get; set; }
163 | }
164 |
165 | public class JdPlist
166 | {
167 | public int NodeId { get; set; }
168 | public int? ParentId { get; set; }
169 | public string DataName { get; set; }
170 | public string DataType { get; set; }
171 | public string IsRequired { get; set; }
172 | public string SampleValue { get; set; }
173 | public string Description { get; set; }
174 | }
175 |
176 | public class JdAllApi
177 | {
178 | public JdDatum[] Data { get; set; }
179 | }
180 |
181 | public class JdDatum
182 | {
183 | public JdApi[] Apis { get; set; }
184 | }
185 |
186 | public class JdApi
187 | {
188 | public int ApiId { get; set; }
189 | public string ApiName { get; set; }
190 | }
191 | }
--------------------------------------------------------------------------------
/src/Jd.Sdk/Apis/JdUnionOpenGoodsBigfieldQuery.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace Jd.Sdk.Apis
4 | {
5 | ///
6 | /// 大字段商品查询接口(内测版)【申请】--请求参数
7 | /// 大字段商品查询接口(内测版)【申请】
8 | /// jd.union.open.goods.bigfield.query
9 | /// https://union.jd.com/openplatform/api/761
10 | ///
11 | public class JdUnionOpenGoodsBigfieldQueryRequest : JdBaseRequest
12 | {
13 | public JdUnionOpenGoodsBigfieldQueryRequest() { }
14 |
15 | public JdUnionOpenGoodsBigfieldQueryRequest(string appKey, string appSecret, string accessToken = null) : base(appKey, appSecret, accessToken) { }
16 |
17 | protected override string Method => "jd.union.open.goods.bigfield.query";
18 |
19 | protected override string ParamName => "goodsReq";
20 |
21 | public async Task> InvokeAsync()
22 | => await PostAsync>();
23 |
24 | ///
25 | /// 必填
26 | /// 描述:skuId集合
27 | /// 例如:29357345299
28 | ///
29 | public long[] SkuIds { get; set; }
30 | ///
31 | /// 不必填
32 | /// 描述:查询域集合,不填写则查询全部
33 | /// 例如:"categoryInfo","imageInfo","baseBigFieldInfo","bookBigFieldInfo","videoBigFieldInfo"
34 | ///
35 | public string[] Fields { get; set; }
36 | }
37 |
38 |
39 |
40 | ///
41 | /// 大字段商品查询接口(内测版)【申请】--响应参数
42 | /// 大字段商品查询接口(内测版)【申请】
43 | /// jd.union.open.goods.bigfield.query
44 | ///
45 | public class JdUnionOpenGoodsBigfieldQueryResponse
46 | {
47 | ///
48 | /// 描述:skuId
49 | /// 例如:1111
50 | ///
51 | public long? SkuId { get; set; }
52 | ///
53 | /// 描述:商品名称
54 | /// 例如:手机
55 | ///
56 | public string SkuName { get; set; }
57 | ///
58 | /// 描述:目录信息
59 | /// 例如:
60 | ///
61 | public JdUnionOpenGoodsBigfieldQuery_Categoryinfo CategoryInfo { get; set; }
62 | ///
63 | /// 描述:图片信心
64 | /// 例如:
65 | ///
66 | public JdUnionOpenGoodsBigfieldQuery_Imageinfo ImageInfo { get; set; }
67 | ///
68 | /// 描述:基础大字段信息
69 | /// 例如:
70 | ///
71 | public JdUnionOpenGoodsBigfieldQuery_Basebigfieldinfo BaseBigFieldInfo { get; set; }
72 | ///
73 | /// 描述:图书大字段信息
74 | /// 例如:
75 | ///
76 | public JdUnionOpenGoodsBigfieldQuery_Bookbigfieldinfo BookBigFieldInfo { get; set; }
77 | ///
78 | /// 描述:影音大字段信息
79 | /// 例如:
80 | ///
81 | public JdUnionOpenGoodsBigfieldQuery_Videobigfieldinfo VideoBigFieldInfo { get; set; }
82 | }
83 |
84 | ///
85 | /// 图片合集
86 | ///
87 | public class JdUnionOpenGoodsBigfieldQuery_Urlinfo
88 | {
89 | ///
90 | /// 描述: 图片链接地址,第一个图片链接为主图链接
91 | /// 例如:http://img14.360buyimg.com/ads/jfs/t22495/56/628456568/380476/9befc935/5b39fb01N7d1af390.jpg
92 | ///
93 | public string Url { get; set; }
94 | }
95 | ///
96 | /// 目录信息
97 | ///
98 | public class JdUnionOpenGoodsBigfieldQuery_Categoryinfo
99 | {
100 | ///
101 | /// 描述:一级类目ID
102 | /// 例如:6144
103 | ///
104 | public long? Cid1 { get; set; }
105 | ///
106 | /// 描述:一级类目名称
107 | /// 例如:珠宝首饰
108 | ///
109 | public string Cid1Name { get; set; }
110 | ///
111 | /// 描述:二级类目ID
112 | /// 例如:12041
113 | ///
114 | public long? Cid2 { get; set; }
115 | ///
116 | /// 描述:二级类目名称
117 | /// 例如:木手串/把件
118 | ///
119 | public string Cid2Name { get; set; }
120 | ///
121 | /// 描述:三级类目ID
122 | /// 例如:12052
123 | ///
124 | public long? Cid3 { get; set; }
125 | ///
126 | /// 描述:三级类目名称
127 | /// 例如:其他
128 | ///
129 | public string Cid3Name { get; set; }
130 | }
131 | ///
132 | /// 图片信心
133 | ///
134 | public class JdUnionOpenGoodsBigfieldQuery_Imageinfo
135 | {
136 | ///
137 | /// 描述:图片合集
138 | /// 例如:
139 | ///
140 | public JdUnionOpenGoodsBigfieldQuery_Urlinfo[] ImageList { get; set; }
141 | }
142 | ///
143 | /// 基础大字段信息
144 | ///
145 | public class JdUnionOpenGoodsBigfieldQuery_Basebigfieldinfo
146 | {
147 | ///
148 | /// 描述:商品介绍
149 | /// 例如:
150 | ///
151 | public string Wdis { get; set; }
152 | ///
153 | /// 描述:规格参数
154 | /// 例如:
155 | ///
156 | public string PropCode { get; set; }
157 | ///
158 | /// 描述:包装清单(仅自营商品)
159 | /// 例如:
160 | ///
161 | public string WareQD { get; set; }
162 | }
163 | ///
164 | /// 图书大字段信息
165 | ///
166 | public class JdUnionOpenGoodsBigfieldQuery_Bookbigfieldinfo
167 | {
168 | ///
169 | /// 描述:媒体评论
170 | /// 例如:
171 | ///
172 | public string Comments { get; set; }
173 | ///
174 | /// 描述:精彩文摘与插图(插图)
175 | /// 例如:
176 | ///
177 | public string Image { get; set; }
178 | ///
179 | /// 描述:内容摘要(内容简介)
180 | /// 例如:
181 | ///
182 | public string ContentDesc { get; set; }
183 | ///
184 | /// 描述:产品描述(相关商品)
185 | /// 例如:
186 | ///
187 | public string RelatedProducts { get; set; }
188 | ///
189 | /// 描述:编辑推荐
190 | /// 例如:
191 | ///
192 | public string EditerDesc { get; set; }
193 | ///
194 | /// 描述:目录
195 | /// 例如:
196 | ///
197 | public string Catalogue { get; set; }
198 | ///
199 | /// 描述:精彩摘要(精彩书摘)
200 | /// 例如:
201 | ///
202 | public string BookAbstract { get; set; }
203 | ///
204 | /// 描述:作者简介
205 | /// 例如:
206 | ///
207 | public string AuthorDesc { get; set; }
208 | ///
209 | /// 描述:前言(前言/序言)
210 | /// 例如:
211 | ///
212 | public string Introduction { get; set; }
213 | ///
214 | /// 描述:产品特色
215 | /// 例如:
216 | ///
217 | public string ProductFeatures { get; set; }
218 | }
219 | ///
220 | /// 影音大字段信息
221 | ///
222 | public class JdUnionOpenGoodsBigfieldQuery_Videobigfieldinfo
223 | {
224 | ///
225 | /// 描述:评论
226 | /// 例如:
227 | ///
228 | public string Comments { get; set; }
229 | ///
230 | /// 描述:商品描述(精彩剧照)
231 | /// 例如:
232 | ///
233 | public string Image { get; set; }
234 | ///
235 | /// 描述:内容摘要(内容简介)
236 | /// 例如:
237 | ///
238 | public string ContentDesc { get; set; }
239 | ///
240 | /// 描述:编辑推荐
241 | /// 例如:
242 | ///
243 | public string EditerDesc { get; set; }
244 | ///
245 | /// 描述:目录
246 | /// 例如:
247 | ///
248 | public string Catalogue { get; set; }
249 | ///
250 | /// 描述:包装清单
251 | /// 例如:
252 | ///
253 | public string Box_Contents { get; set; }
254 | ///
255 | /// 描述:特殊说明
256 | /// 例如:
257 | ///
258 | public string Material_Description { get; set; }
259 | ///
260 | /// 描述:说明书
261 | /// 例如:
262 | ///
263 | public string Manual { get; set; }
264 | ///
265 | /// 描述:产品特色
266 | /// 例如:
267 | ///
268 | public string ProductFeatures { get; set; }
269 | }
270 | }
271 |
272 |
--------------------------------------------------------------------------------
/src/Pdd.Sdk/Apis/PddDdkCmsPromUrlGenerate.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Newtonsoft.Json;
3 |
4 | namespace Pdd.Sdk.Apis
5 | {
6 | ///
7 | /// 生成商城-频道推广链接--请求参数
8 | /// 生成商城推广链接接口
9 | /// pdd.ddk.cms.prom.url.generate
10 | /// https://open.pinduoduo.com/#/apidocument/port?id=pdd.ddk.cms.prom.url.generate
11 | ///
12 | public class PddDdkCmsPromUrlGenerateRequest : PddBaseRequest
13 | {
14 | protected override string Type => "pdd.ddk.cms.prom.url.generate";
15 |
16 | public PddDdkCmsPromUrlGenerateRequest() { }
17 |
18 | public PddDdkCmsPromUrlGenerateRequest(string clientId, string clientSecret) : base(clientId, clientSecret) { }
19 |
20 | public async Task InvokeAsync()
21 | => await PostAsync();
22 | ///
23 | /// 不必填
24 | /// 是否生成短链接,true-是,false-否
25 | /// 例如:true
26 | ///
27 | public bool? GenerateShortUrl { get; set; }
28 | ///
29 | /// 不必填
30 | /// 是否生成手机跳转链接。true-是,false-否,默认false
31 | /// 例如:true
32 | ///
33 | public bool? GenerateMobile { get; set; }
34 | ///
35 | /// 不必填
36 | /// 单人团多人团标志。true-多人团,false-单人团 默认false
37 | /// 例如:true
38 | ///
39 | public bool? MultiGroup { get; set; }
40 | ///
41 | /// 不必填
42 | /// 自定义参数,为链接打上自定义标签。自定义参数最长限制64个字节。
43 | /// 例如:tag
44 | ///
45 | public string CustomParameters { get; set; }
46 | ///
47 | /// 不必填
48 | /// 是否唤起微信客户端, 默认false 否,true 是
49 | /// 例如:false
50 | ///
51 | public bool? GenerateWeappWebview { get; set; }
52 | ///
53 | /// 必填
54 | /// 唤起微信app推广短链接
55 | /// 例如:http://test.url
56 | ///
57 | public bool? WeAppWebViewShortUrl { get; set; }
58 | ///
59 | /// 必填
60 | /// 唤起微信app推广链接
61 | /// 例如:http://test.url
62 | ///
63 | public bool? WeAppWebViewUrl { get; set; }
64 | ///
65 | /// 不必填
66 | /// 0, "1.9包邮";1, "今日爆款"; 2, "品牌清仓"; 4,"PC端专属商城"
67 | /// 例如:0
68 | ///
69 | public int? ChannelType { get; set; }
70 | ///
71 | /// 必填
72 | /// 推广位列表,例如:["60005_612"]
73 | ///
74 | public string[] PIdList { get; set; }
75 | }
76 |
77 |
78 | ///
79 | /// 生成商城-频道推广链接--响应参数
80 | /// 生成商城推广链接接口
81 | ///
82 | public class PddDdkCmsPromUrlGenerateResponse : PddBaseResponse
83 | {
84 | ///
85 | /// total
86 | /// 例如:100
87 | ///
88 | [JsonProperty("total")]
89 | public int? Total { get; set; }
90 | ///
91 | /// 链接列表
92 | ///
93 | [JsonProperty("url_list")]
94 | public PddDdkCmsPromUrlGenerate_UrlList[] UrlList { get; set; }
95 | }
96 |
97 | ///
98 | /// 双人团链接列表
99 | ///
100 | public class PddDdkCmsPromUrlGenerate_MultiUrlList
101 | {
102 | ///
103 | /// 双人团唤醒拼多多app长链接
104 | ///
105 | [JsonProperty("mobile_url")]
106 | public string MobileUrl { get; set; }
107 | ///
108 | /// 双人团唤醒拼多多app短链接
109 | ///
110 | [JsonProperty("mobile_short_url")]
111 | public string MobileShortUrl { get; set; }
112 | ///
113 | /// 双人团唤醒微信链接
114 | ///
115 | [JsonProperty("we_app_web_view_url")]
116 | public string WeAppWebViewUrl { get; set; }
117 | ///
118 | /// 双人团长链接
119 | ///
120 | [JsonProperty("url")]
121 | public string Url { get; set; }
122 | ///
123 | /// 双人团短链接
124 | ///
125 | [JsonProperty("short_url")]
126 | public string ShortUrl { get; set; }
127 | ///
128 | /// 双人团唤醒微信短链接
129 | ///
130 | [JsonProperty("we_app_web_view_short_url")]
131 | public string WeAppWebViewShortUrl { get; set; }
132 | }
133 | ///
134 | /// 单人团链接列表
135 | ///
136 | public class PddDdkCmsPromUrlGenerate_SingleUrlList
137 | {
138 | ///
139 | /// 唤醒拼多多app长链接
140 | ///
141 | [JsonProperty("mobile_url")]
142 | public string MobileUrl { get; set; }
143 | ///
144 | /// 唤醒拼多多app短链接
145 | ///
146 | [JsonProperty("mobile_short_url")]
147 | public string MobileShortUrl { get; set; }
148 | ///
149 | /// 唤醒微信链接
150 | ///
151 | [JsonProperty("we_app_web_view_url")]
152 | public string WeAppWebViewUrl { get; set; }
153 | ///
154 | /// 长链接
155 | ///
156 | [JsonProperty("url")]
157 | public string Url { get; set; }
158 | ///
159 | /// 短链接
160 | ///
161 | [JsonProperty("short_url")]
162 | public string ShortUrl { get; set; }
163 | ///
164 | /// 唤醒微信短链接
165 | ///
166 | [JsonProperty("we_app_web_view_short_url")]
167 | public string WeAppWebViewShortUrl { get; set; }
168 | }
169 | ///
170 | /// 链接列表
171 | ///
172 | public class PddDdkCmsPromUrlGenerate_UrlList
173 | {
174 | ///
175 | /// 多人团唤醒微信推广长链接
176 | ///
177 | [JsonProperty("multi_we_app_web_view_url")]
178 | public string MultiWeAppWebViewUrl { get; set; }
179 | ///
180 | /// 双人团链接列表
181 | ///
182 | [JsonProperty("multi_url_list")]
183 | public PddDdkCmsPromUrlGenerate_MultiUrlList MultiUrlList { get; set; }
184 | ///
185 | /// 多人团唤醒拼多多app链接
186 | ///
187 | [JsonProperty("multi_group_mobile_short_url")]
188 | public string MultiGroupMobileShortUrl { get; set; }
189 | ///
190 | /// 唤醒拼多多app链接
191 | ///
192 | [JsonProperty("mobile_url")]
193 | public string MobileUrl { get; set; }
194 | ///
195 | /// CPSsign
196 | /// 例如:CM1891891_26364337_0c06f43f39cc6829be275d7067c31db5
197 | ///
198 | [JsonProperty("sign")]
199 | public string Sign { get; set; }
200 | ///
201 | /// 多人团唤醒微信推广短链接
202 | ///
203 | [JsonProperty("multi_we_app_web_view_short_url")]
204 | public string MultiWeAppWebViewShortUrl { get; set; }
205 | ///
206 | /// 多人团唤醒拼多多app长链接
207 | ///
208 | [JsonProperty("multi_group_mobile_url")]
209 | public string MultiGroupMobileUrl { get; set; }
210 | ///
211 | /// h5长链接
212 | ///
213 | [JsonProperty("url")]
214 | public string Url { get; set; }
215 | ///
216 | /// h5短链接
217 | ///
218 | [JsonProperty("short_url")]
219 | public string ShortUrl { get; set; }
220 | ///
221 | /// 单人团链接列表
222 | ///
223 | [JsonProperty("single_url_list")]
224 | public PddDdkCmsPromUrlGenerate_SingleUrlList SingleUrlList { get; set; }
225 | ///
226 | /// 多人团长链
227 | ///
228 | [JsonProperty("multi_group_url")]
229 | public string MultiGroupUrl { get; set; }
230 | ///
231 | /// 多人团短链
232 | ///
233 | [JsonProperty("multi_group_short_url")]
234 | public string MultiGroupShortUrl { get; set; }
235 | ///
236 | /// 唤醒拼多多app短链
237 | ///
238 | [JsonProperty("mobile_short_url")]
239 | public string MobileShortUrl { get; set; }
240 | ///
241 | /// 唤醒微信长链
242 | ///
243 | [JsonProperty("we_app_web_view_url")]
244 | public string WeAppWebViewUrl { get; set; }
245 | ///
246 | /// 唤醒微信短链
247 | ///
248 | [JsonProperty("we_app_web_view_short_url")]
249 | public string WeAppWebViewShortUrl { get; set; }
250 | }
251 | }
252 |
253 |
--------------------------------------------------------------------------------