feat(wxapi): 新增微信小店获取商品的移动应用跳转 Scheme 码接口

This commit is contained in:
Fu Diwei
2025-04-07 20:22:41 +08:00
parent 404df5cd77
commit 2c407fc59d
7 changed files with 108 additions and 2 deletions

View File

@@ -162,7 +162,22 @@
</details>
#### 5. 微信小店(原视频号
#### 5. 视频号
<details>
<summary>[展开查看]</summary>
| | 微信 API | 备注 |
| :-: | :--------: | :--: |
| √ | 视频号小店 | |
| √ | 视频号助手 | |
| √ | 联盟带货 | |
| √ | 本地生活 | |
</details>
#### 6. 微信小店
<details>
@@ -178,7 +193,7 @@
</details>
#### 6. 开放平台
#### 7. 开放平台
<details>

View File

@@ -4104,6 +4104,29 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECProductQrcodeGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// <para>异步调用 [POST] /channels/ec/product/scheme/get 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/product/get_scheme.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECProductSchemeGetResponse> ExecuteChannelsECProductSchemeGetAsync(this WechatApiClient client, Models.ChannelsECProductSchemeGetRequest 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", "product", "scheme", "get")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECProductSchemeGetResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#region ECProduct/LimitedDiscountTask
/// <summary>
/// <para>异步调用 [POST] /channels/ec/product/limiteddiscounttask/add 接口。</para>

View File

@@ -39,6 +39,13 @@ namespace SKIT.FlurlHttpClient.Wechat.Api.Models
[Newtonsoft.Json.JsonProperty("out_goods_info")]
[System.Text.Json.Serialization.JsonPropertyName("out_goods_info")]
public string? OutGoodsInfo { get; set; }
/// <summary>
/// 获取或设置商品额外信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("goods_ext")]
[System.Text.Json.Serialization.JsonPropertyName("goods_ext")]
public string? GoodsExtraInfo { get; set; }
}
}
}

View File

@@ -0,0 +1,36 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/product/scheme/get 接口的请求。</para>
/// </summary>
public class ChannelsECProductSchemeGetRequest : WechatApiRequest, IInferable<ChannelsECProductSchemeGetRequest, ChannelsECProductSchemeGetResponse>
{
/// <summary>
/// 获取或设置商品 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("product_id")]
[System.Text.Json.Serialization.JsonPropertyName("product_id")]
public long ProductId { get; set; }
/// <summary>
/// 获取或设置来源 AppId。
/// </summary>
[Newtonsoft.Json.JsonProperty("from_appid")]
[System.Text.Json.Serialization.JsonPropertyName("from_appid")]
public string FromAppId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置过期时间(单位:秒)。
/// </summary>
[Newtonsoft.Json.JsonProperty("expire")]
[System.Text.Json.Serialization.JsonPropertyName("expire")]
public int ExpiresIn { get; set; }
/// <summary>
/// 获取或设置附加信息。
/// </summary>
[Newtonsoft.Json.JsonProperty("ext_info")]
[System.Text.Json.Serialization.JsonPropertyName("ext_info")]
public string? ExtraInfo { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/product/scheme/get 接口的响应。</para>
/// </summary>
public class ChannelsECProductSchemeGetResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置商品跳转 Scheme 链接。
/// </summary>
[Newtonsoft.Json.JsonProperty("openlink")]
[System.Text.Json.Serialization.JsonPropertyName("openlink")]
public string OpenLink { get; set; } = default!;
}
}

View File

@@ -0,0 +1,5 @@
{
"product_id": "324545",
"from_appid": "APPID",
"expire": 100
}

View File

@@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"openlink": "weixin://dl/business/?st=123"
}