From f5478bb68cb0b26b88f838a5daa191db4b7923e7 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 7 Apr 2025 20:00:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(wxapi):=20=E6=96=B0=E5=A2=9E=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E5=B0=8F=E5=BA=97=E8=8E=B7=E5=8F=96=E5=85=B3=E8=81=94?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E4=BC=81=E5=BE=AE=20ID=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/WechatApi/Basic_ModelDefinition.md | 15 ++++---- ...echatApiClientExecuteChannelsExtensions.cs | 25 +++++++++++++ .../ChannelsECWecomGetWecomIdRequest.cs | 22 ++++++++++++ .../ChannelsECWecomGetWecomIdResponse.cs | 35 +++++++++++++++++++ .../ChannelsECWecomGetWecomIdRequest.json | 4 +++ .../ChannelsECWecomGetWecomIdResponse.json | 8 +++++ 6 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs create mode 100644 src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json create mode 100644 test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json diff --git a/docs/WechatApi/Basic_ModelDefinition.md b/docs/WechatApi/Basic_ModelDefinition.md index 8ddb0522..e1001230 100644 --- a/docs/WechatApi/Basic_ModelDefinition.md +++ b/docs/WechatApi/Basic_ModelDefinition.md @@ -162,18 +162,19 @@ -#### 5. 视频号 +#### 5. 微信小店(原视频号)
[展开查看] -| | 微信 API | 备注 | -| :-: | :--------: | :--: | -| √ | 视频号小店 | | -| √ | 视频号助手 | | -| √ | 招商团长 | | -| √ | 本地生活 | | +| | 微信 API | 备注 | +| :-: | :------------: | :--: | +| √ | 微信小店 | | +| √ | 合作账号 | | +| √ | 企业微信 | | +| √ | 小程序连接小店 | | +| √ | 罗盘商家版 | |
diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs index d7d40d71..7d8e92f2 100644 --- a/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Extensions/WechatApiClientExecuteChannelsExtensions.cs @@ -5639,6 +5639,31 @@ namespace SKIT.FlurlHttpClient.Wechat.Api #endregion #endregion + #region ECWecom + /// + /// 异步调用 [POST] /channels/ec/wecom/get_wecom_id 接口。 + /// + /// REF:
+ /// + ///
+ ///
+ /// + /// + /// + /// + public static async Task 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(flurlReq, data: request, cancellationToken: cancellationToken).ConfigureAwait(false); + } + #endregion + #region ECWindow /// /// 异步调用 [POST] /channels/ec/window/product/add 接口。 diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs new file mode 100644 index 00000000..672e2b95 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.cs @@ -0,0 +1,22 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/wecom/get_wecom_id 接口的请求。 + /// + public class ChannelsECWecomGetWecomIdRequest : WechatApiRequest, IInferable + { + /// + /// 获取或设置企业微信 CorpId。 + /// + [Newtonsoft.Json.JsonProperty("corp_id")] + [System.Text.Json.Serialization.JsonPropertyName("corp_id")] + public string CorpId { get; set; } = string.Empty; + + /// + /// 获取或设置企业微信 UserId。 + /// + [Newtonsoft.Json.JsonProperty("user_id")] + [System.Text.Json.Serialization.JsonPropertyName("user_id")] + public string UserId { get; set; } = string.Empty; + } +} diff --git a/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs new file mode 100644 index 00000000..cdc86487 --- /dev/null +++ b/src/SKIT.FlurlHttpClient.Wechat.Api/Models/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.cs @@ -0,0 +1,35 @@ +namespace SKIT.FlurlHttpClient.Wechat.Api.Models +{ + /// + /// 表示 [POST] /channels/ec/wecom/get_wecom_id 接口的响应。 + /// + public class ChannelsECWecomGetWecomIdResponse : WechatApiResponse + { + public static class Types + { + public class Data + { + /// + /// 获取或设置企业微信 ID。 + /// + [Newtonsoft.Json.JsonProperty("wecom_corp_id")] + [System.Text.Json.Serialization.JsonPropertyName("wecom_corp_id")] + public string WecomAppId { get; set; } = default!; + + /// + /// 获取或设置企业微信账号 ID。 + /// + [Newtonsoft.Json.JsonProperty("wecom_user_id")] + [System.Text.Json.Serialization.JsonPropertyName("wecom_user_id")] + public string WecomUserId { get; set; } = default!; + } + } + + /// + /// 获取或设置返回数据。 + /// + [Newtonsoft.Json.JsonProperty("data")] + [System.Text.Json.Serialization.JsonPropertyName("data")] + public Types.Data Data { get; set; } = default!; + } +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json new file mode 100644 index 00000000..3c3f5918 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdRequest.json @@ -0,0 +1,4 @@ +{ + "corp_id": "wwsdnnaoiwjeoifawe", + "user_id": "张三" +} diff --git a/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json new file mode 100644 index 00000000..4fd58f89 --- /dev/null +++ b/test/SKIT.FlurlHttpClient.Wechat.Api.UnitTests/ModelSamples/Channels/ECWecom/ChannelsECWecomGetWecomIdResponse.json @@ -0,0 +1,8 @@ +{ + "errcode": "0", + "errmsg": "ok", + "data": { + "wecom_corp_id": "seuiwebrxuusdfasddfas", + "wecom_user_id": "sdnfanwbbbxcfzxvdfadf" + } +}