feat(wxapi): 新增微信小店获取关联账号企微 ID 接口

This commit is contained in:
Fu Diwei 2025-04-07 20:00:09 +08:00
parent 186494f82b
commit f5478bb68c
6 changed files with 102 additions and 7 deletions

View File

@ -162,18 +162,19 @@
</details>
#### 5. 视频号
#### 5. 微信小店(原视频号
<details>
<summary>[展开查看]</summary>
| | 微信 API | 备注 |
| :-: | :--------: | :--: |
| √ | 视频号小店 | |
| √ | 视频号助手 | |
| √ | 招商团长 | |
| √ | 本地生活 | |
| | 微信 API | 备注 |
| :-: | :------------: | :--: |
| √ | 微信小店 | |
| √ | 合作账号 | |
| √ | 企业微信 | |
| √ | 小程序连接小店 | |
| √ | 罗盘商家版 | |
</details>

View File

@ -5639,6 +5639,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
#endregion
#endregion
#region ECWecom
/// <summary>
/// <para>异步调用 [POST] /channels/ec/wecom/get_wecom_id 接口。</para>
/// <para>
/// REF: <br/>
/// <![CDATA[ https://developers.weixin.qq.com/doc/store/shop/API/wecom/getwecomid.html ]]>
/// </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.ChannelsECWecomGetWecomIdResponse> ExecuteChannelsECWecomGetWecomIdAsync(this WechatApiClient client, Models.ChannelsECWecomGetWecomIdRequest 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", "wecom", "get_wecom_id")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendFlurlRequestAsJsonAsync<Models.ChannelsECWecomGetWecomIdResponse>(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false);
}
#endregion
#region ECWindow
/// <summary>
/// <para>异步调用 [POST] /channels/ec/window/product/add 接口。</para>

View File

@ -0,0 +1,22 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/wecom/get_wecom_id 接口的请求。</para>
/// </summary>
public class ChannelsECWecomGetWecomIdRequest : WechatApiRequest, IInferable<ChannelsECWecomGetWecomIdRequest, ChannelsECWecomGetWecomIdResponse>
{
/// <summary>
/// 获取或设置企业微信 CorpId。
/// </summary>
[Newtonsoft.Json.JsonProperty("corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("corp_id")]
public string CorpId { get; set; } = string.Empty;
/// <summary>
/// 获取或设置企业微信 UserId。
/// </summary>
[Newtonsoft.Json.JsonProperty("user_id")]
[System.Text.Json.Serialization.JsonPropertyName("user_id")]
public string UserId { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,35 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /channels/ec/wecom/get_wecom_id 接口的响应。</para>
/// </summary>
public class ChannelsECWecomGetWecomIdResponse : WechatApiResponse
{
public static class Types
{
public class Data
{
/// <summary>
/// 获取或设置企业微信 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_corp_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")]
public string WecomAppId { get; set; } = default!;
/// <summary>
/// 获取或设置企业微信账号 ID。
/// </summary>
[Newtonsoft.Json.JsonProperty("wecom_user_id")]
[System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")]
public string WecomUserId { get; set; } = default!;
}
}
/// <summary>
/// 获取或设置返回数据。
/// </summary>
[Newtonsoft.Json.JsonProperty("data")]
[System.Text.Json.Serialization.JsonPropertyName("data")]
public Types.Data Data { get; set; } = default!;
}
}

View File

@ -0,0 +1,4 @@
{
"corp_id": "wwsdnnaoiwjeoifawe",
"user_id": "张三"
}

View File

@ -0,0 +1,8 @@
{
"errcode": "0",
"errmsg": "ok",
"data": {
"wecom_corp_id": "seuiwebrxuusdfasddfas",
"wecom_user_id": "sdnfanwbbbxcfzxvdfadf"
}
}