Skip to content

Commit

Permalink
第三方平台业务域名相关处理接口
Browse files Browse the repository at this point in the history
  • Loading branch information
mojinxun committed Feb 6, 2023
1 parent dfbe7b0 commit 5bfaf7a
Show file tree
Hide file tree
Showing 5 changed files with 196 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -613,19 +613,60 @@ public static UploadPrivacyExtFileResult UploadPrivacyExtFile(string componentAc
/// <returns></returns>
public static ModifyWxaServerDomainResult ModifyWxaServerDomain(string componentAccessToken, ModifyWxaServerDomain_Action action, string wxa_server_domain = null, bool? is_modify_published_together = null, int timeOut = Config.TIME_OUT)
{
var url =
string.Format(
Config.ApiMpHost + "/cgi-bin/component/modify_wxa_server_domain?access_token={0}",
componentAccessToken.AsUrlData());

var urlFormat = Config.ApiMpHost + "/cgi-bin/component/modify_wxa_jump_domain?access_token={0}";
var data = new
{
action = action.ToString(),
wxa_server_domain,
is_modify_published_together
};

return CommonJsonSend.Send<ModifyWxaServerDomainResult>(null, url, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
return CommonJsonSend.Send<ModifyWxaServerDomainResult>(componentAccessToken, urlFormat, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
}

/// <summary>
/// 获取第三方平台业务域名校验文件
/// <para>本接口用于获取第三方平台小程序业务域名的校验文件。</para>
/// <para>使用过程中如遇到问题,可在开放平台服务商专区发帖交流。</para>
/// <para>文档:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/thirdparty-management/domain-mgnt/getThirdpartyJumpDomainConfirmFile.html </para>
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="action">操作类型。</param>
/// <param name="wxa_jump_h5_domain">最多可以添加200个小程序业务域名,以;隔开。注意:域名不需带有http:// 等协议内容,也不能在域名末尾附加详细的 URI 地址,严格按照类似 www.qq.com 的写法。</param>
/// <param name="is_modify_published_together">是否同时修改“全网发布版本的值”。(false:只改“测试版”;true:同时改“测试版”和“全网发布版”)省略时,默认为false。</param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static GetDomainConfirmFileResult GetDomainConfirmFile(string componentAccessToken, int timeOut = Config.TIME_OUT)
{
var urlFormat = Config.ApiMpHost + "/cgi-bin/component/get_domain_confirmfile?access_token={0}";
return CommonJsonSend.Send<GetDomainConfirmFileResult>(componentAccessToken, urlFormat, null, CommonJsonSendType.POST, timeOut);
}

/// <summary>
/// 设置第三方平台业务域名
/// <para>本接口用于配置第三方平台小程序业务域名。</para>
/// <para>配置业务域名时,需要将校验文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。可以通过获取第三方小程序业务域名的校验文件接口获取检验文件。</para>
/// <para>授权给第三方代开发的小程序,其业务域名只可以为在第三方平台账号中配置的小程序业务域名。即调用接口设置小程序业务域名之前可以调本接口先进行第三方平台小程序业务域名配置。</para>
/// <para>使用过程中如遇到问题,可在开放平台服务商专区发帖交流。</para>
/// <para>文档:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/thirdparty-management/domain-mgnt/modifyThirdpartyJumpDomain.html</para>
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="action">操作类型。</param>
/// <param name="wxa_jump_h5_domain">最多可以添加200个小程序业务域名,以;隔开。注意:域名不需带有http:// 等协议内容,也不能在域名末尾附加详细的 URI 地址,严格按照类似 www.qq.com 的写法。</param>
/// <param name="is_modify_published_together">是否同时修改“全网发布版本的值”。(false:只改“测试版”;true:同时改“测试版”和“全网发布版”)省略时,默认为false。</param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static ModifyWxaJumpDomainResult ModifyWxaJumpDomain(string componentAccessToken, ModifyWxaJumpDomain_Action action, string wxa_jump_h5_domain = null, bool? is_modify_published_together = null, int timeOut = Config.TIME_OUT)
{
var urlFormat = Config.ApiMpHost + "/cgi-bin/component/modify_wxa_jump_domain?access_token={0}";
var data = new
{
action = action.ToString(),
wxa_jump_h5_domain,
is_modify_published_together
};

return CommonJsonSend.Send<ModifyWxaJumpDomainResult>(componentAccessToken, urlFormat, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
}

#endregion
Expand Down Expand Up @@ -1155,19 +1196,60 @@ public static async Task<UploadPrivacyExtFileResult> UploadPrivacyExtFileAsync(s
/// <returns></returns>
public static async Task<ModifyWxaServerDomainResult> ModifyWxaServerDomainAsync(string componentAccessToken, ModifyWxaServerDomain_Action action, string wxa_server_domain = null, bool? is_modify_published_together = null, int timeOut = Config.TIME_OUT)
{
var url =
string.Format(
Config.ApiMpHost + "/cgi-bin/component/modify_wxa_server_domain?access_token={0}",
componentAccessToken.AsUrlData());

var urlFormat = Config.ApiMpHost + "/cgi-bin/component/modify_wxa_jump_domain?access_token={0}";
var data = new
{
action = action.ToString(),
wxa_server_domain,
is_modify_published_together
};

return await CommonJsonSend.SendAsync<ModifyWxaServerDomainResult>(null, url, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
return await CommonJsonSend.SendAsync<ModifyWxaServerDomainResult>(componentAccessToken, urlFormat, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
}

/// <summary>
/// 获取第三方平台业务域名校验文件
/// <para>本接口用于获取第三方平台小程序业务域名的校验文件。</para>
/// <para>使用过程中如遇到问题,可在开放平台服务商专区发帖交流。</para>
/// <para>文档:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/thirdparty-management/domain-mgnt/getThirdpartyJumpDomainConfirmFile.html </para>
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="action">操作类型。</param>
/// <param name="wxa_jump_h5_domain">最多可以添加200个小程序业务域名,以;隔开。注意:域名不需带有http:// 等协议内容,也不能在域名末尾附加详细的 URI 地址,严格按照类似 www.qq.com 的写法。</param>
/// <param name="is_modify_published_together">是否同时修改“全网发布版本的值”。(false:只改“测试版”;true:同时改“测试版”和“全网发布版”)省略时,默认为false。</param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static async Task<GetDomainConfirmFileResult> GetDomainConfirmFileAsync(string componentAccessToken, int timeOut = Config.TIME_OUT)
{
var urlFormat = Config.ApiMpHost + "/cgi-bin/component/get_domain_confirmfile?access_token={0}";
return await CommonJsonSend.SendAsync<GetDomainConfirmFileResult>(componentAccessToken, urlFormat, null, CommonJsonSendType.POST, timeOut);
}

/// <summary>
/// 设置第三方平台业务域名
/// <para>本接口用于配置第三方平台小程序业务域名。</para>
/// <para>配置业务域名时,需要将校验文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。可以通过获取第三方小程序业务域名的校验文件接口获取检验文件。</para>
/// <para>授权给第三方代开发的小程序,其业务域名只可以为在第三方平台账号中配置的小程序业务域名。即调用接口设置小程序业务域名之前可以调本接口先进行第三方平台小程序业务域名配置。</para>
/// <para>使用过程中如遇到问题,可在开放平台服务商专区发帖交流。</para>
/// <para>文档:https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/thirdparty-management/domain-mgnt/modifyThirdpartyJumpDomain.html</para>
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="action">操作类型。</param>
/// <param name="wxa_jump_h5_domain">最多可以添加200个小程序业务域名,以;隔开。注意:域名不需带有http:// 等协议内容,也不能在域名末尾附加详细的 URI 地址,严格按照类似 www.qq.com 的写法。</param>
/// <param name="is_modify_published_together">是否同时修改“全网发布版本的值”。(false:只改“测试版”;true:同时改“测试版”和“全网发布版”)省略时,默认为false。</param>
/// <param name="timeOut"></param>
/// <returns></returns>
public static async Task<ModifyWxaJumpDomainResult> ModifyWxaJumpDomainAsync(string componentAccessToken, ModifyWxaJumpDomain_Action action, string wxa_jump_h5_domain = null, bool? is_modify_published_together = null, int timeOut = Config.TIME_OUT)
{
var urlFormat = Config.ApiMpHost + "/cgi-bin/component/modify_wxa_jump_domain?access_token={0}";
var data = new
{
action = action.ToString(),
wxa_jump_h5_domain,
is_modify_published_together
};

return await CommonJsonSend.SendAsync<ModifyWxaJumpDomainResult>(componentAccessToken, urlFormat, data, CommonJsonSendType.POST, timeOut, jsonSetting: new CO2NET.Helpers.Serializers.JsonSetting(true));
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*----------------------------------------------------------------
Copyright (C) 2023 Senparc
文件名:ModifyWxaServerDomainResult.cs
文件功能描述:设置第三方平台服务器域名 返回结果
创建标识:Senparc - 20230109
----------------------------------------------------------------*/

using Senparc.Weixin.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Senparc.Weixin.Open.ComponentAPIs
{
/// <summary>
/// 设置第三方平台业务域名 返回结果
/// </summary>
public class GetDomainConfirmFileResult : WxJsonResult
{
/// <summary>
/// 文件名
/// </summary>
public string file_name { get; set; }
/// <summary>
/// 文件内容
/// </summary>
public string file_content { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*----------------------------------------------------------------
Copyright (C) 2023 Senparc
文件名:ModifyWxaServerDomainResult.cs
文件功能描述:设置第三方平台服务器域名 返回结果
创建标识:Senparc - 20230109
----------------------------------------------------------------*/

using Senparc.Weixin.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Senparc.Weixin.Open.ComponentAPIs
{
/// <summary>
/// 设置第三方平台业务域名 返回结果
/// </summary>
public class ModifyWxaJumpDomainResult : WxJsonResult
{
/// <summary>
/// 目前生效的 “全网发布版”第三方平台“小程序业务域名”。如果修改失败,该字段不会返回。如果没有已发布的第三方平台,该字段也不会返回。
/// </summary>
public string published_wxa_jump_h5_domain { get; set; }
/// <summary>
/// 目前生效的 “测试版”第三方平台“小程序业务域名”。如果修改失败,该字段不会返回
/// </summary>
public string testing_wxa_jump_h5_domain { get; set; }
/// <summary>
/// 未通过验证的域名。如果不存在未通过验证的域名,该字段不会返回。
/// </summary>
public string invalid_wxa_jump_h5_domain { get; set; }
}
}
23 changes: 23 additions & 0 deletions src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,27 @@ public enum ModifyWxaServerDomain_Action
/// </summary>
get
}

/// <summary>
/// “设置第三方平台业务域名”接口,action 参数枚举
/// </summary>
public enum ModifyWxaJumpDomain_Action
{
/// <summary>
/// 添加
/// </summary>
add,
/// <summary>
/// 删除。说明,删除不存在的域名会视为成功,返回 errcode 为0
/// </summary>
delete,
/// <summary>
/// 覆盖
/// </summary>
set,
/// <summary>
/// 获取 ,action=get时,会同时返回测试版和全网发布版的“小程序服务器域名”值。
/// </summary>
get
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public class SubmitAuditPageInfo
/// </summary>
public string third_class { get; set; }

/// <summary>
/// 小程序页面的标题,标题长度不超过32
/// </summary>
public string title { get; set; }

/// <summary>
/// 一级类目的ID
/// </summary>
Expand All @@ -80,10 +85,5 @@ public class SubmitAuditPageInfo
/// 三级类目的ID
/// </summary>
public int third_id { get; set; }

/// <summary>
/// 小程序页面的标题,标题长度不超过32
/// </summary>
public string title { get; set; }
}
}

0 comments on commit 5bfaf7a

Please sign in to comment.