Skip to content

Commit

Permalink
Merge pull request #2685 from JeffreySu/Developer
Browse files Browse the repository at this point in the history
Open v4.14.6 添加“查询小程序版本信息”接口 #2671 感谢 @jhzou1
  • Loading branch information
JeffreySu authored Jul 30, 2022
2 parents c371fe7 + d47fb64 commit 3c73994
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1</TargetFrameworks>
<Version>4.14.5</Version>
<Version>4.14.6</Version>
<AssemblyName>Senparc.Weixin.Open</AssemblyName>
<RootNamespace>Senparc.Weixin.Open</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down Expand Up @@ -192,6 +192,7 @@
v4.14.2 添加小程序隐私接口
v4.14.3 补充小程序/公众号获取基本信息字段
v4.14.4 添加半屏小程序管理接口
v4.14.6 添加“查询小程序版本信息”接口
</PackageReleaseNotes>
<RepositoryUrl>https://github.com/JeffreySu/WeiXinMPSDK</RepositoryUrl>
</PropertyGroup>
Expand Down
54 changes: 51 additions & 3 deletions src/Senparc.Weixin.Open/Senparc.Weixin.Open/WxaAPIs/WxaApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ and limitations under the License.
修改标识:mc7246 - 20220504
修改描述:v4.14.2 添加小程序隐私接口
修改标识:Senparc - 20220730
修改描述:v4.14.6 添加“查询小程序版本信息”接口
----------------------------------------------------------------*/

using Senparc.CO2NET.Extensions;
Expand All @@ -55,6 +58,7 @@ namespace Senparc.Weixin.Open.WxaAPIs
public class WxaApi
{
#region 同步方法

#region 扫码关注组件
/// <summary>
/// 【同步方法】获取展示的公众号信息
Expand Down Expand Up @@ -110,6 +114,7 @@ public static WxJsonResult UpdateShowWxaItem(string accessToken, int wxa_subscri
}

#endregion

#region 违规和申诉记录
/// <summary>
/// 获取小程序违规处罚记录
Expand Down Expand Up @@ -151,7 +156,9 @@ public static GetAppealRecordsJsonResult GetAppealRecords(string accessToken, st
}

#endregion

#region 隐私接口

/// <summary>
/// 获取隐私接口列表
/// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
Expand All @@ -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<GetPrivacyInterfaceJsonResult>(null, url, null, CommonJsonSendType.GET);

}

/// <summary>
Expand All @@ -178,7 +183,7 @@ public static GetPrivacyInterfaceJsonResult GetPrivacyInterface(string accessTok
/// <param name="pic_list">(辅助图片)填写图片的url ,最多10个</param>
/// <param name="video_list">(辅助视频)填写视频的链接 ,最多支持1个;视频格式只支持mp4格式</param>
/// <returns></returns>
public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string accessToken, string api_name, string content, List<string> url_list = null,List<string> pic_list=null,List<string> video_list=null)
public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string accessToken, string api_name, string content, List<string> url_list = null, List<string> pic_list = null, List<string> video_list = null)
{
var url = $"{Config.ApiMpHost}/wxa/security/apply_privacy_interface?access_token={accessToken.AsUrlData()}";

Expand All @@ -194,9 +199,30 @@ public static ApplyPrivacyInterfaceJsonResult ApplyPrivacyInterface(string acces
return CommonJsonSend.Send<ApplyPrivacyInterfaceJsonResult>(null, url, data);
}
#endregion

/// <summary>
/// 查询小程序版本信息
/// <para>调用本接口可以查询小程序的体验版和线上版本信息。</para>
/// <para>说明:如果需要查询审核中版本信息可通过 getLatestAuditStatus 接口获取。</para>
/// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/getVersionInfo.html
/// </summary>
/// <param name="accessToken">第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。</param>
/// <returns></returns>
public static GetVersionInfoJsonResult GetVersionInfo(string accessToken)
{
var url = $"{Config.ApiMpHost}/wxa/getversioninfo?access_token={accessToken.AsUrlData()}";

//要传空的json,不传会报错,如:{ }
var data = new
{
};
return CommonJsonSend.Send<GetVersionInfoJsonResult>(null, url, data, CommonJsonSendType.POST);
}

#endregion

#region 异步方法

#region 扫码关注组件
/// <summary>
/// 【异步方法】获取展示的公众号信息
Expand Down Expand Up @@ -252,6 +278,7 @@ public static async Task<WxJsonResult> UpdateShowWxaItemAsync(string accessToken
}

#endregion

#region 违规和申诉记录
/// <summary>
/// 【异步方法】获取小程序违规处罚记录
Expand Down Expand Up @@ -293,7 +320,9 @@ public static async Task<GetAppealRecordsJsonResult> GetAppealRecordsAsync(strin
}

#endregion

#region 隐私接口

/// <summary>
/// 【异步方法】获取隐私接口列表
/// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html
Expand Down Expand Up @@ -337,6 +366,25 @@ public static async Task<ApplyPrivacyInterfaceJsonResult> ApplyPrivacyInterfaceA
}
#endregion

/// <summary>
/// 【异步方法】查询小程序版本信息
/// <para>调用本接口可以查询小程序的体验版和线上版本信息。</para>
/// <para>说明:如果需要查询审核中版本信息可通过 getLatestAuditStatus 接口获取。</para>
/// https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/getVersionInfo.html
/// </summary>
/// <param name="accessToken">第三方平台接口调用凭证authorizer_access_token,该参数为 URL 参数,非 Body 参数。</param>
/// <returns></returns>
public static async Task<GetVersionInfoJsonResult> GetVersionInfoAsync(string accessToken)
{
var url = $"{Config.ApiMpHost}/wxa/getversioninfo?access_token={accessToken.AsUrlData()}";

//要传空的json,不传会报错,如:{ }
var data = new
{
};
return await CommonJsonSend.SendAsync<GetVersionInfoJsonResult>(null, url, data, CommonJsonSendType.POST);
}

#endregion

}
Expand Down
Original file line number Diff line number Diff line change
@@ -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; }
}

}

0 comments on commit 3c73994

Please sign in to comment.