feat(wxapi): 新增微信小店获取店铺二维码、H5 链接、口令等接口

This commit is contained in:
Fu Diwei 2025-04-07 20:58:39 +08:00
parent f89ca8a1fc
commit 2616ea0f6a
18 changed files with 267 additions and 2 deletions

View File

@ -4,7 +4,7 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Events
/// <para>表示 EVENT.channels_ec_aftersale_update 事件的数据。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/aftersale/ec_callback/channels_ec_aftersale_update.html ]]> <br>
/// <![CDATA[ https://developers.weixin.qq.com/doc/channels/API/aftersale/ec_callback/channels_ec_aftersale_update.html ]]> <br />
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/aftersale/ec_callback/channels_ec_aftersale_update.html ]]>
/// </para>
/// </summary>

View File

@ -704,6 +704,77 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECBasicsHomepageBannerRemoveResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECBasics/Shop
/// <summary>
/// <para>异步调用 [POST] /channels/ec/basics/shop/h5url/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/basics/getshoph5url.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECBasicsShopH5UrlGetResponse> ExecuteChannelsECBasicsShopH5UrlGetAsync(this WechatApiClient client, Models.ChannelsECBasicsShopH5UrlGetRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "basics", "shop", "h5url", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECBasicsShopH5UrlGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/basics/shop/taglink/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/basics/getshoptaglink.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECBasicsShopTagLinkGetResponse> ExecuteChannelsECBasicsShopTagLinkGetAsync(this WechatApiClient client, Models.ChannelsECBasicsShopTagLinkGetRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "basics", "shop", "taglink", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECBasicsShopTagLinkGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/basics/shop/qrcode/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/basics/getshopqrcode.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECBasicsShopQrcodeGetResponse> ExecuteChannelsECBasicsShopQrcodeGetAsync(this WechatApiClient client, Models.ChannelsECBasicsShopQrcodeGetRequest 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
.CreateFlurlRequest(request, HttpMethod.Post, "channels", "ec", "basics", "shop", "qrcode", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECBasicsShopQrcodeGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#endregion
#region ECBrand

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/h5url/get 接口的请求。</para>
/// </summary>
public class ChannelsECBasicsShopH5UrlGetRequest : WechatApiRequest, IInferable<ChannelsECBasicsShopH5UrlGetRequest, ChannelsECBasicsShopH5UrlGetResponse>
{
/// <summary>
/// 获取或设置商品 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/h5url/get 接口的响应。</para>
/// </summary>
public class ChannelsECBasicsShopH5UrlGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置店铺 H5 短链。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_h5url")]
[System.Text.Json.Serialization.JsonPropertyName("shop_h5url")]
public string ShopH5Url { get; set; } = default!;
}
}

View File

@ -0,0 +1,29 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/qrcode/get 接口的请求。</para>
/// </summary>
public class ChannelsECBasicsShopQrcodeGetRequest : WechatApiRequest, IInferable<ChannelsECBasicsShopQrcodeGetRequest, ChannelsECBasicsShopQrcodeGetResponse>
{
/// <summary>
/// 获取或设置二维码类型。
/// </summary>
[Newtonsoft.Json.JsonProperty("qrcode_type")]
[System.Text.Json.Serialization.JsonPropertyName("qrcode_type")]
public int QrcodeType { get; set; }
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/qrcode/get 接口的响应。</para>
/// </summary>
public class ChannelsECBasicsShopQrcodeGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置店铺二维码链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_qrcode")]
[System.Text.Json.Serialization.JsonPropertyName("shop_qrcode")]
public string ShopQrcode { get; set; } = default!;
}
}

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/taglink/get 接口的请求。</para>
/// </summary>
public class ChannelsECBasicsShopTagLinkGetRequest : WechatApiRequest, IInferable<ChannelsECBasicsShopTagLinkGetRequest, ChannelsECBasicsShopTagLinkGetResponse>
{
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/basics/shop/taglink/get 接口的响应。</para>
/// </summary>
public class ChannelsECBasicsShopTagLinkGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置店铺微信口令。
/// </summary>
[Newtonsoft.Json.JsonProperty("shop_taglink")]
[System.Text.Json.Serialization.JsonPropertyName("shop_taglink")]
public string ShopTagLink { get; set; } = default!;
}
}

View File

@ -11,5 +11,19 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -11,5 +11,19 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -10,6 +10,6 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
/// </summary>
[Newtonsoft.Json.JsonProperty("openlink")]
[System.Text.Json.Serialization.JsonPropertyName("openlink")]
public string OpenLink { get; set; } = default!;
public string ProductScheme { get; set; } = default!;
}
}

View File

@ -11,5 +11,19 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string? WecomCorpId { get; set; }
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string? WecomUserId { get; set; }
}
}

View File

@ -0,0 +1,4 @@
{
"wecom_corp_id": "wpxxxxxxxx",
"wecom_user_id": "woxxxxxxxx"
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"shop_h5url": "https://channels.weixin.qq.com/shop/b/xsgVVZtSGpqwd45"
}

View File

@ -0,0 +1,4 @@
{
"wecom_corp_id": "wpxxxxxxxx",
"wecom_user_id": "woxxxxxxxx"
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"shop_qrcode": "https://res.wx.qq.com/shop/material/shop/xxxxxxxxxxxxxxxxxxxxxxxxxx.png"
}

View File

@ -0,0 +1,4 @@
{
"wecom_corp_id": "wpxxxxxxxx",
"wecom_user_id": "woxxxxxxxx"
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"shop_taglink": "#微信小店://微信小店/qwrwqtwqgqwwweq"
}