|
|
@@ -3,12 +3,31 @@ package com.mrxu.framework.common.xcx.api;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.mrxu.framework.common.weixin.base.WxHttp;
|
|
|
import com.mrxu.framework.common.xcx.bean.FastRegisterBean;
|
|
|
+import com.mrxu.framework.common.xcx.bean.FastRegisterXcxRequest;
|
|
|
|
|
|
public class FastRegisterApi {
|
|
|
|
|
|
// 创建试用小程序
|
|
|
- private static final String fastRegisterUrl = "https://api.weixin.qq.com/wxa/component/fastregisterbetaweapp?access_token=";
|
|
|
+ private static final String fastRegisterBetaUrl = "https://api.weixin.qq.com/wxa/component/fastregisterbetaweapp?access_token=";
|
|
|
|
|
|
+ private static final String fastRegisterUrl = "https://api.weixin.qq.com/cgi-bin/component/fastregisterweapp?action=create&component_access_token=";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Register_Mini_Programs/Fast_Registration_Interface_document.html
|
|
|
+ * 快速注册企业小程序 关于快速注册小程序的详细介绍以及使用步骤、常见问题等请查看快速注册企业小程序介绍,本文为快速注册小程序的接口文档。
|
|
|
+ * @param accessToken
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static FastRegisterBean fastRegister(String accessToken, FastRegisterXcxRequest request) {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("code_type", request.getCode_type());
|
|
|
+ json.put("legal_persona_wechat", request.getLegal_persona_wechat());
|
|
|
+ json.put("legal_persona_name", request.getLegal_persona_name());
|
|
|
+ json.put("component_phone", request.getComponent_phone());
|
|
|
+ FastRegisterBean rs = WxHttp.post(FastRegisterBean.class,fastRegisterUrl+accessToken,json);
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastregister.html
|
|
|
@@ -21,19 +40,19 @@ public class FastRegisterApi {
|
|
|
* h5获取openid、小程序获取openid、网站应用获取openid
|
|
|
* @return
|
|
|
*/
|
|
|
- public static FastRegisterBean fastRegister(String accessToken,
|
|
|
+ public static FastRegisterBean fastRegisterBeta(String accessToken,
|
|
|
String name,
|
|
|
String openid) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("name", name);
|
|
|
json.put("openid", openid);
|
|
|
- FastRegisterBean rs = WxHttp.post(FastRegisterBean.class,fastRegisterUrl+accessToken,json);
|
|
|
+ FastRegisterBean rs = WxHttp.post(FastRegisterBean.class,fastRegisterBetaUrl+accessToken,json);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
String accessToken = "68_rxFBixbayDBLeIFwmMQULuWXBelJaZSwbIefKxSFa4-ZHeSifEUiGhn5MHeYQr0Rl0PM47m_TBQtRD8N3-Fyg9QyWA3sa3je8xPfcmAmMeNXMrYkcpKh_vzjkXIIVKiAJATGV";
|
|
|
- System.out.println(fastRegister(accessToken,"大爷测试小程序","ofY_46bSMJUpwn7lJlAYEqpOuJyM").getAuthorize_url());
|
|
|
+ System.out.println(fastRegisterBeta(accessToken,"大爷测试小程序","ofY_46bSMJUpwn7lJlAYEqpOuJyM").getAuthorize_url());
|
|
|
}
|
|
|
|
|
|
}
|