feat(wxapi): 新增云开发查询是否绑定手机号的接口

This commit is contained in:
Fu Diwei 2022-05-01 21:53:01 +08:00
parent 7f42ad1851
commit e31c04bf8a
6 changed files with 59 additions and 1 deletions

View File

@ -406,6 +406,26 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
return await client.SendRequestWithJsonAsync<Models.TcbUseCloudAccessTokenResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /tcb/checkmobile 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/common/checkmobile.html </para>
/// </summary>
/// <param name="client"></param>
/// <param name="request"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static async Task<Models.TcbCheckMobileResponse> ExecuteTcbCheckMobileAsync(this WechatApiClient client, Models.TcbCheckMobileRequest 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, "tcb", "checkmobile")
.SetQueryParam("access_token", request.AccessToken);
return await client.SendRequestWithJsonAsync<Models.TcbCheckMobileResponse>(flurlReq, data: request, cancellationToken: cancellationToken);
}
/// <summary>
/// <para>异步调用 [POST] /tcb/uploadappconfig 接口。</para>
/// <para>REF: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/cloudbase/common/uploadAppConfig.html </para>

View File

@ -10,6 +10,6 @@
/// </summary>
[Newtonsoft.Json.JsonProperty("have_open")]
[System.Text.Json.Serialization.JsonPropertyName("have_open")]
public bool IsHaveOpen { get; set; }
public bool HasOpenAccount { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /tcb/checkmobile 接口的请求。</para>
/// </summary>
public class TcbCheckMobileRequest : WechatApiRequest, IInferable<TcbCheckMobileRequest, TcbCheckMobileResponse>
{
/// <summary>
/// 获取或设置是否在小程序未绑定手机号时推送模版消息给管理员收集手机号。
/// </summary>
[Newtonsoft.Json.JsonProperty("push_tmpl")]
[System.Text.Json.Serialization.JsonPropertyName("push_tmpl")]
public bool? RequestPushTemplateMessage { get; set; }
}
}

View File

@ -0,0 +1,15 @@
namespace SKIT.FlurlHttpClient.Wechat.Api.Models
{
/// <summary>
/// <para>表示 [POST] /tcb/checkmobile 接口的响应。</para>
/// </summary>
public class TcbCheckMobileResponse : WechatApiResponse
{
/// <summary>
/// 获取或设置是否绑定了手机号。
/// </summary>
[Newtonsoft.Json.JsonProperty("has_mobile")]
[System.Text.Json.Serialization.JsonPropertyName("has_mobile")]
public bool HasMobile { get; set; }
}
}

View File

@ -0,0 +1,3 @@
{
"push_tmpl": true
}

View File

@ -0,0 +1,5 @@
{
"errcode": 0,
"errmsg": "ok",
"has_mobile": true
}