mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2025-09-19 18:22:24 +08:00
feat(wxapi): 新增检查加密信息是否由微信生成的接口
This commit is contained in:
@@ -35,6 +35,28 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaBusinessGetPayForOrderResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/business/checkencryptedmsg 接口。</para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html </para>
|
||||
/// <para>REF: https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/user-info/auth.checkEncryptedData.html </para>
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Models.WxaBusinessCheckEncryptedMessageResponse> ExecuteWxaBusinessCheckEncryptedMessageAsync(this WechatApiClient client, Models.WxaBusinessCheckEncryptedMessageRequest 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.Post, "wxa", "business", "checkencryptedmsg")
|
||||
.SetQueryParam("access_token", request.AccessToken);
|
||||
|
||||
return await client.SendRequestWithJsonAsync<Models.WxaBusinessCheckEncryptedMessageResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
#region GameMatch
|
||||
/// <summary>
|
||||
/// <para>异步调用 [POST] /wxa/business/gamematch/creatematchrule 接口。</para>
|
||||
|
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/business/checkencryptedmsg 接口的请求。</para>
|
||||
/// </summary>
|
||||
public class WxaBusinessCheckEncryptedMessageRequest : WechatApiRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置加密数据哈希值。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("encrypted_msg_hash")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("encrypted_msg_hash")]
|
||||
public string EncryptedMessageHash { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>表示 [POST] /wxa/business/checkencryptedmsg 接口的响应。</para>
|
||||
/// </summary>
|
||||
public class WxaBusinessCheckEncryptedMessageResponse : WechatApiResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取或设置是否是合法的数据。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("vaild")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("vaild")]
|
||||
public bool IsValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置加密数据生成的时间戳。
|
||||
/// </summary>
|
||||
[Newtonsoft.Json.JsonProperty("create_time")]
|
||||
[System.Text.Json.Serialization.JsonPropertyName("create_time")]
|
||||
public long CreateTimestamp { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user