Skip to content

Commit eaf28fe

Browse files
authored
🎨 #4061 【开放平台】增加快速创建企业小程序的接口
1 parent 4083e35 commit eaf28fe

2 files changed

Lines changed: 57 additions & 1 deletion

File tree

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ public interface WxOpenComponentService {
124124
* 快速创建小程序接口.
125125
*/
126126
String FAST_REGISTER_WEAPP_URL = "https://api.weixin.qq.com/cgi-bin/component/fastregisterweapp?action=create";
127+
128+
/**
129+
* 快速创建企业小程序接口.
130+
*/
131+
String FAST_REGISTER_ENTERPRISE_WEAPP_URL = "https://api.weixin.qq.com/wxa/component/fastregisterenterpriseweapp?action=create";
132+
133+
/**
134+
* 快速创建企业小程序查询接口.
135+
*/
136+
String FAST_REGISTER_ENTERPRISE_WEAPP_QUERY_URL = "https://api.weixin.qq.com/wxa/component/fastregisterenterpriseweapp?action=query";
137+
127138
/**
128139
* The constant FAST_REGISTER_WEAPP_SEARCH_URL.
129140
*/
@@ -611,7 +622,7 @@ public interface WxOpenComponentService {
611622

612623
/**
613624
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
614-
* 第三方平台快速创建小程序.
625+
* 第三方平台快速创建小程序. 2026-04-30 已下线
615626
* 注意:创建任务逻辑串行,单次任务结束后才可以使用相同信息下发第二次任务,请注意规避任务阻塞
616627
*
617628
* @param name 企业名(需与工商部门登记信息一致)
@@ -622,9 +633,34 @@ public interface WxOpenComponentService {
622633
* @param componentPhone 第三方联系电话(方便法人与第三方联系)
623634
* @return . wx open result
624635
* @throws WxErrorException .
636+
* @deprecated 2026-04-30 接口已经下线
625637
*/
638+
@Deprecated
626639
WxOpenResult fastRegisterWeapp(String name, String code, String codeType, String legalPersonaWechat, String legalPersonaName, String componentPhone) throws WxErrorException;
627640

641+
/**
642+
* https://developers.weixin.qq.com/doc/oplatform/openApi/register-management/fast-registration-ent/api_fastregisterenterpriseweapp.html
643+
* 第三方平台快速创建企业小程序.
644+
* 注意:创建任务逻辑串行,单次任务结束后才可以使用相同信息下发第二次任务,请注意规避任务阻塞
645+
*
646+
* @param name 企业名(需与工商部门登记信息一致)
647+
* @param code 企业代码,18位统一信用代码
648+
* @param componentPhone 第三方联系电话(方便法人与第三方联系)
649+
* @return . wx open result
650+
* @throws WxErrorException .
651+
*/
652+
WxOpenRegisterPersonalWeappResult fastRegisterEnterpriseWeapp(String name, String code, String componentPhone) throws WxErrorException;
653+
654+
/**
655+
* https://developers.weixin.qq.com/doc/oplatform/openApi/register-management/fast-registration-ent/api_fastregisterenterpriseweapp.html
656+
* 查询企业小程序注册任务状态
657+
*
658+
* @param taskid 任务ID
659+
* @return the wx open result
660+
* @throws WxErrorException
661+
*/
662+
WxOpenRegisterPersonalWeappResult fastRegisterEnterpriseWeappQuery(String taskid) throws WxErrorException;
663+
628664
/**
629665
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
630666
* 查询第三方平台快速创建小程序的任务状态

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,26 @@ public WxOpenResult fastRegisterWeapp(String name, String code, String codeType,
643643
return WxOpenGsonBuilder.create().fromJson(response, WxOpenResult.class);
644644
}
645645

646+
@Override
647+
public WxOpenRegisterPersonalWeappResult fastRegisterEnterpriseWeapp(String name, String code, String componentPhone) throws WxErrorException {
648+
JsonObject jsonObject = new JsonObject();
649+
jsonObject.addProperty("name", name);
650+
jsonObject.addProperty("code", code);
651+
jsonObject.addProperty("component_phone", componentPhone);
652+
jsonObject.addProperty("new_version", true);
653+
String response = post(FAST_REGISTER_ENTERPRISE_WEAPP_URL, jsonObject.toString(), "access_token");
654+
return WxOpenGsonBuilder.create().fromJson(response, WxOpenRegisterPersonalWeappResult.class);
655+
}
656+
657+
@Override
658+
public WxOpenRegisterPersonalWeappResult fastRegisterEnterpriseWeappQuery(String taskid) throws WxErrorException {
659+
JsonObject jsonObject = new JsonObject();
660+
jsonObject.addProperty("taskid", taskid);
661+
jsonObject.addProperty("new_version", true);
662+
String response = post(FAST_REGISTER_ENTERPRISE_WEAPP_QUERY_URL, jsonObject.toString(), "access_token");
663+
return WxOpenGsonBuilder.create().fromJson(response, WxOpenRegisterPersonalWeappResult.class);
664+
}
665+
646666
@Override
647667
public WxOpenResult fastRegisterWeappSearch(String name, String legalPersonaWechat, String legalPersonaName) throws WxErrorException {
648668
JsonObject jsonObject = new JsonObject();

0 commit comments

Comments
 (0)