Skip to content

Commit

Permalink
Open v4.14.7 添加“获取公众号关联的小程序”接口 #2672 感谢 @fuchangqing123
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySu committed Jul 30, 2022
1 parent 34acf31 commit 4d1e540
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 2 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.6</Version>
<Version>4.14.7</Version>
<AssemblyName>Senparc.Weixin.Open</AssemblyName>
<RootNamespace>Senparc.Weixin.Open</RootNamespace>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ and limitations under the License.
创建标识:Senparc - 20180716
修改标识:Senparc - 20220730
修改描述:v4.14.7 添加“获取公众号关联的小程序”接口
----------------------------------------------------------------*/

using Senparc.CO2NET.Extensions;
Expand All @@ -42,7 +44,7 @@ and limitations under the License.

namespace Senparc.Weixin.Open.WxOpenAPIs
{
[NcApiBind(NeuChar.PlatformType.WeChat_Open,true)]
[NcApiBind(NeuChar.PlatformType.WeChat_Open, true)]
public class WxOpenApi
{
#region 同步方法
Expand Down Expand Up @@ -158,6 +160,22 @@ public static WxJsonResult ModifyCategory(string accessToken, int first, int sec

#endregion

#region 小程序管理

/// <summary>
/// 获取公众号关联的小程序
/// </summary>
/// <param name="accessToken">小程序的access_token</param>
/// <returns></returns>
public static WxaMpLinkGetJsonResult WxaMpLinkGet(string accessToken)
{
var url = $"{Config.ApiMpHost}/cgi-bin/wxopen/wxamplinkget?access_token={accessToken.AsUrlData()}";
return CommonJsonSend.Send<WxaMpLinkGetJsonResult>(null, url, null, CommonJsonSendType.POST);
}

#endregion


#endregion

#region 异步方法
Expand Down Expand Up @@ -246,6 +264,21 @@ public static async Task<WxJsonResult> ModifyCategoryAsync(string accessToken, i

#endregion

#region 小程序管理

/// <summary>
/// 获取公众号关联的小程序
/// </summary>
/// <param name="accessToken">小程序的access_token</param>
/// <returns></returns>
public static async Task<WxaMpLinkGetJsonResult> WxaMpLinkGetAsync(string accessToken)
{
var url = $"{Config.ApiMpHost}/cgi-bin/wxopen/wxamplinkget?access_token={accessToken.AsUrlData()}";
return await CommonJsonSend.SendAsync<WxaMpLinkGetJsonResult>(null, url, null, CommonJsonSendType.POST);
}

#endregion

#endregion
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Senparc.Weixin.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Senparc.Weixin.Open.WxOpenAPIs
{
public class WxaMpLinkGetJsonResult : WxJsonResult
{
public int errcode { get; set; }
public string errmsg { get; set; }
public Wxopens wxopens { get; set; }
}

public class Wxopens
{
public Item[] items { get; set; }
}

public class Item
{
/// <summary>
/// status:关联状态
/// <para>1:已关联</para>
/// <para>2:等待小程序管理员确认中</para>
/// <para>3:小程序管理员拒绝关联</para>
/// <para>12:等待公众号管理员确认中</para>
/// </summary>
public int status { get; set; }
/// <summary>
/// 小程序 gh_id
/// </summary>
public string username { get; set; }
/// <summary>
/// 小程序 appid
/// </summary>
public string appid { get; set; }
/// <summary>
/// (官方文档无说明)例:SOURCE_NORMAL
/// </summary>
public string source { get; set; }
/// <summary>
/// 昵称
/// </summary>
public string nickname { get; set; }
/// <summary>
/// 是否在公众号管理页展示中
/// </summary>
public int selected { get; set; }
/// <summary>
/// 是否展示在附近的小程序中
/// </summary>
public int nearby_display_status { get; set; }
/// <summary>
/// 是否已经发布
/// </summary>
public int released { get; set; }
/// <summary>
/// 头像 url
/// </summary>
public string headimg_url { get; set; }
/// <summary>
/// 微信认证及支付信息
/// </summary>
public Func_Infos[] func_infos { get; set; }
/// <summary>
/// (官方文档无说明)例:1
/// </summary>
public int copy_verify_status { get; set; }
/// <summary>
/// 小程序邮箱
/// </summary>
public string email { get; set; }
}

/// <summary>
/// 微信认证及支付信息
/// </summary>
public class Func_Infos
{
/// <summary>
/// 0 表示未开通,1 表示开通
/// </summary>
public int status { get; set; }
/// <summary>
/// (官方文档无说明)例:1、2
/// </summary>
public int id { get; set; }
/// <summary>
/// “微信认证”“微信支付”等字符串信息
/// </summary>
public string name { get; set; }
}

}

0 comments on commit 4d1e540

Please sign in to comment.