mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-07-17 10:41:58 +08:00
feat(wxapi): 新增小程序联盟商品查询接口
This commit is contained in:
parent
8210869672
commit
21bbfb353d
@ -260,6 +260,66 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OpenProduct
|
||||
/// <summary>
|
||||
/// <para>异步调用 [GET] /union/promoter/open_product/list 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/union/custom_component/api/promoter/openproduct.html</para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.UnionPromoterOpenProductListResponse> ExecuteUnionPromoterOpenProductListAsync(this WechatApiClient client, Models.UnionPromoterOpenProductListRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (client is null) throw new ArgumentNullException(nameof(client));
|
||||
if (request is null) throw new ArgumentNullException(nameof(request));
|
||||
|
||||
IFlurlRequest flurlReq = client
|
||||
.CreateRequest(request, HttpMethod.Get, "union", "promoter", "open_product", "list")
|
||||
.SetQueryParam("access_token", request.AccessToken)
|
||||
.SetQueryParam("from", request.Offset)
|
||||
.SetQueryParam("limit", request.Limit);
|
||||
|
||||
if (request.QueryType != null)
|
||||
flurlReq.SetQueryParam("queryType", request.QueryType.Value);
|
||||
|
||||
if (request.Query != null)
|
||||
flurlReq.SetQueryParam("query", request.Query);
|
||||
|
||||
if (request.MaxPrice != null)
|
||||
flurlReq.SetQueryParam("maxPrice", request.MaxPrice.Value);
|
||||
|
||||
if (request.MinPrice != null)
|
||||
flurlReq.SetQueryParam("minPrice", request.MinPrice.Value);
|
||||
|
||||
if (request.MinCommissionValue != null)
|
||||
flurlReq.SetQueryParam("minCommissionValue", request.MinCommissionValue.Value);
|
||||
|
||||
if (request.MinCommissionRatio != null)
|
||||
flurlReq.SetQueryParam("minCommissionRatio", request.MinCommissionRatio.Value);
|
||||
|
||||
if (request.SortType != null)
|
||||
flurlReq.SetQueryParam("sortType", request.SortType.Value);
|
||||
|
||||
if (request.ShopAppIdList != null)
|
||||
flurlReq.SetQueryParam("shopAppIds", string.Join(",", request.ShopAppIdList));
|
||||
|
||||
if (request.CategoryId != null)
|
||||
flurlReq.SetQueryParam("categoryId", request.CategoryId);
|
||||
|
||||
if (request.CategoryIdList != null)
|
||||
flurlReq.SetQueryParam("category", string.Join(",", request.CategoryIdList));
|
||||
|
||||
if (request.CategoryIdBlackList != null)
|
||||
flurlReq.SetQueryParam("noCategory", string.Join(",", request.CategoryIdBlackList));
|
||||
|
||||
if (request.ProductIdList != null)
|
||||
flurlReq.SetQueryParam("productId", string.Join(",", request.ProductIdList));
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.UnionPromoterOpenProductListResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Order
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /union/promoter/order/info 接口。</para>
|
||||
|
@ -0,0 +1,110 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /union/promoter/open_product/list 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class UnionPromoterOpenProductListRequest : WechatApiRequest, IInferable<UnionPromoterOpenProductListRequest, UnionPromoterOpenProductListResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// <para>默认值:0</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int Offset { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置分页起始位置。
|
||||
/// <para>默认值:30</para>
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int Limit { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置搜索类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? QueryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置搜索关键词。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public string? Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品最高价格(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? MaxPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品最低价格(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? MinPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置佣金金额下限(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? MinCommissionValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置佣金比例下限(单位:万分之一)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? MinCommissionRatio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置排序类型。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? SortType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置类目 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public int? CategoryId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public IList<string>? ShopAppIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置类目 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public IList<int>? CategoryIdList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置黑名单类目 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public IList<int>? CategoryIdBlackList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
public IList<long>? ProductIdList { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,223 @@
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [GET] /union/promoter/open_product/list 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class UnionPromoterOpenProductListResponse : WechatApiResponse
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Product
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class ProductDetail
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Information
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Detail
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情图片 Url 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detailImg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detailImg")]
|
||||
public string[] ImageUrlList { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品标题。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("title")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("title")]
|
||||
public string Title { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品主图 URL 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("headImg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("headImg")]
|
||||
public string[] HeadImageUrlList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详情信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("detail")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("detail")]
|
||||
public Types.Detail Detail { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置品牌 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("brandId")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("brandId")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public int BrandId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 SKU 最低价格(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("minPrice")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("minPrice")]
|
||||
public int MinPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置总库存。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("totalStockNum")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("totalStockNum")]
|
||||
public int TotalStock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序页面路径。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("path")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("path")]
|
||||
public string? PagePath { get; set; }
|
||||
}
|
||||
|
||||
public class SKU
|
||||
{
|
||||
public static class Types
|
||||
{
|
||||
public class Information
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置缩略图 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("thumbImg")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("thumbImg")]
|
||||
public string ThumbnailUrl { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置售价(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("salePrice")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("salePrice")]
|
||||
public int SalePrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置市场价(单位:分)。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("marketPrice")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("marketPrice")]
|
||||
public int MarketPrice { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置库存量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("stockNum")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("stockNum")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public int Stock { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 SKU ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("skuId")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("skuId")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long SKUId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 SKU 基本信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("productSkuInfo")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("productSkuInfo")]
|
||||
public Types.Information Information { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("productId")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("productId")]
|
||||
[System.Text.Json.Serialization.JsonNumberHandling(System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString)]
|
||||
public long ProductId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品基本信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("info")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("info")]
|
||||
public Types.Information Information { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 SKU 列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("skus")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("skus")]
|
||||
public Types.SKU[] SKUList { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class Shop
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置小程序 AppId。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("appId")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("appId")]
|
||||
public string AppId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序名称。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("name")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("name")]
|
||||
public string Name { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序原始 ID。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("username")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("username")]
|
||||
public string Username { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置小程序头像 URL。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("headImgUrl")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("headImgUrl")]
|
||||
public string HeadImageUrl { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品详细信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("product")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("product")]
|
||||
public Types.ProductDetail ProductDetail { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品所属小商店信息。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("shopInfo")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("shopInfo")]
|
||||
public Types.Shop Shop { get; set; } = default!;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品列表。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("productList")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("productList")]
|
||||
public Types.Product[] ProductList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置商品总数量。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("total")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("total")]
|
||||
public int Total { get; set; }
|
||||
}
|
||||
}
|
@ -566,7 +566,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("productList")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("productList")]
|
||||
|
||||
public Types.Product[] ProductList { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
|
@ -0,0 +1,40 @@
|
||||
{
|
||||
"errcode": 0,
|
||||
"errmsg": "ok",
|
||||
"total": 59,
|
||||
"productList": [
|
||||
{
|
||||
"shopInfo": {
|
||||
"name": "医保非税小测试",
|
||||
"appId": "wx539e0b4872f196d1",
|
||||
"username": "gh_6e10896a3e3c",
|
||||
"headImgUrl": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM6PxkhYKuFL3Xy6ibu3lJAhosuicqM92GLDdBRHySZuVibiag"
|
||||
},
|
||||
"product": {
|
||||
"productId": "411668902",
|
||||
"info": {
|
||||
"title": "金幼小儿米茶膏11.8g*抑菌霜(限时送好产品)(1625192914000)",
|
||||
"headImg": [
|
||||
"https://snsdy.tc.qq.com/161/20304/snscosdownload/SZ/reserved/5fc36818000f255f00000000d0785609000000a000004f50?imageView2/3/w/750"
|
||||
],
|
||||
"brandId": "2100000000",
|
||||
"detail": {},
|
||||
"minPrice": 1,
|
||||
"totalStockNum": 100,
|
||||
"path": "pages/productDetail/productDetail?productId=1625192914000"
|
||||
},
|
||||
"skus": [
|
||||
{
|
||||
"skuId": "350377364",
|
||||
"productSkuInfo": {
|
||||
"thumbImg": "https://store.mp.video.tencent-cloud.com/161/20304/snscosdownload/SH/reserved/60de79d30007ec2000000000c7e04f09000000a100004f50",
|
||||
"salePrice": 1,
|
||||
"marketPrice": 1,
|
||||
"stockNum": "100"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user