From d47fb6463d07c9d69b568abd6d21b82969d3a29b Mon Sep 17 00:00:00 2001 From: JeffreySu Date: Sat, 30 Jul 2022 20:24:48 +0800 Subject: [PATCH] =?UTF-8?q?Open=20v4.14.6=20=E6=B7=BB=E5=8A=A0=E2=80=9C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E2=80=9D=E6=8E=A5=E5=8F=A3=20#2671=20?= =?UTF-8?q?=E6=84=9F=E8=B0=A2=20@jhzou1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Senparc.Weixin.Open.net6.csproj | 3 +- .../Senparc.Weixin.Open/WxaAPIs/WxaApi.cs | 54 +++++++++++++++++-- .../WxaJson/GetVersionInfoJsonResult.cs | 32 +++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaJson/GetVersionInfoJsonResult.cs diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Senparc.Weixin.Open.net6.csproj b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Senparc.Weixin.Open.net6.csproj index fbf4cc278f..f52c8feb6d 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Senparc.Weixin.Open.net6.csproj +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/Senparc.Weixin.Open.net6.csproj @@ -1,7 +1,7 @@ net462;netstandard2.0;netstandard2.1 - 4.14.5 + 4.14.6 Senparc.Weixin.Open Senparc.Weixin.Open true @@ -192,6 +192,7 @@ v4.14.2 添加小程序隐私接口 v4.14.3 补充小程序/公众号获取基本信息字段 v4.14.4 添加半屏小程序管理接口 + v4.14.6 添加“查询小程序版本信息”接口 https://github.com/JeffreySu/WeiXinMPSDK diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaApi.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaApi.cs index 3e3d490e06..8d1e404fc2 100644 --- a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaApi.cs +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaApi.cs @@ -37,6 +37,9 @@ and limitations under the License. 修改标识:mc7246 - 20220504 修改描述:v4.14.2 添加小程序隐私接口 + 修改标识:Senparc - 20220730 + 修改描述:v4.14.6 添加“查询小程序版本信息”接口 + ----------------------------------------------------------------*/ using Senparc.CO2NET.Extensions; @@ -55,6 +58,7 @@ namespace Senparc.Weixin.Open.WxaAPIs public class WxaApi { #region 同步方法 + #region 扫码关注组件 /// /// 【同步方法】获取展示的公众号信息 @@ -110,6 +114,7 @@ public static WxJsonResult UpdateShowWxaItem(string accessToken, int wxa_subscri } #endregion + #region 违规和申诉记录 /// /// 获取小程序违规处罚记录 @@ -151,7 +156,9 @@ public static GetAppealRecordsJsonResult GetAppealRecords(string accessToken, st } #endregion + #region 隐私接口 + /// /// 获取隐私接口列表 /// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html @@ -162,9 +169,7 @@ public static GetPrivacyInterfaceJsonResult GetPrivacyInterface(string accessTok { var url = $"{Config.ApiMpHost}/wxa/security/get_privacy_interface?access_token={accessToken.AsUrlData()}"; - return CommonJsonSend.Send(null, url, null, CommonJsonSendType.GET); - } /// @@ -178,7 +183,7 @@ public static GetPrivacyInterfaceJsonResult GetPrivacyInterface(string accessTok /// (辅助图片)填写图片的url ,最多10个 /// (辅助视频)填写视频的链接 ,最多支持1个;视频格式只支持mp4格式 /// - public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string accessToken, string api_name, string content, List url_list = null,List pic_list=null,List video_list=null) + public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string accessToken, string api_name, string content, List url_list = null, List pic_list = null, List video_list = null) { var url = $"{Config.ApiMpHost}/wxa/security/apply_privacy_interface?access_token={accessToken.AsUrlData()}"; @@ -194,9 +199,30 @@ public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string acces return CommonJsonSend.Send(null, url, data); } #endregion + + /// + /// 查询小程序版本信息 + /// 调用本接口可以查询小程序的体验版和线上版本信息。 + /// 说明:如果需要查询审核中版本信息可通过 getLatestAuditStatus 接口获取。 + /// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/getVersionInfo.html + /// + /// 第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。 + /// + public static GetVersionInfoJsonResult GetVersionInfo(string accessToken) + { + var url = $"{Config.ApiMpHost}/wxa/getversioninfo?access_token={accessToken.AsUrlData()}"; + + //要传空的json,不传会报错,如:{ } + var data = new + { + }; + return CommonJsonSend.Send(null, url, data, CommonJsonSendType.POST); + } + #endregion #region 异步方法 + #region 扫码关注组件 /// /// 【异步方法】获取展示的公众号信息 @@ -252,6 +278,7 @@ public static async Task UpdateShowWxaItemAsync(string accessToken } #endregion + #region 违规和申诉记录 /// /// 【异步方法】获取小程序违规处罚记录 @@ -293,7 +320,9 @@ public static async Task GetAppealRecordsAsync(strin } #endregion + #region 隐私接口 + /// /// 【异步方法】获取隐私接口列表 /// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html @@ -337,6 +366,25 @@ public static async Task ApplyPrivacyInterfaceA } #endregion + /// + /// 【异步方法】查询小程序版本信息 + /// 调用本接口可以查询小程序的体验版和线上版本信息。 + /// 说明:如果需要查询审核中版本信息可通过 getLatestAuditStatus 接口获取。 + /// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/getVersionInfo.html + /// + /// 第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。 + /// + public static async Task GetVersionInfoAsync(string accessToken) + { + var url = $"{Config.ApiMpHost}/wxa/getversioninfo?access_token={accessToken.AsUrlData()}"; + + //要传空的json,不传会报错,如:{ } + var data = new + { + }; + return await CommonJsonSend.SendAsync(null, url, data, CommonJsonSendType.POST); + } + #endregion } diff --git a/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaJson/GetVersionInfoJsonResult.cs b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaJson/GetVersionInfoJsonResult.cs new file mode 100644 index 0000000000..a7fe0e469b --- /dev/null +++ b/src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaJson/GetVersionInfoJsonResult.cs @@ -0,0 +1,32 @@ +using Senparc.Weixin.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Senparc.Weixin.Open.WxaAPIs +{ + public class GetVersionInfoJsonResult : WxJsonResult + { + public int errcode { get; set; } + public string errmsg { get; set; } + public Exp_Info exp_info { get; set; } + public Release_Info release_info { get; set; } + } + + public class Exp_Info + { + public int exp_time { get; set; } + public string exp_version { get; set; } + public string exp_desc { get; set; } + } + + public class Release_Info + { + public int release_time { get; set; } + public string release_version { get; set; } + public string release_desc { get; set; } + } + +}