|
@@ -0,0 +1,39 @@
|
|
|
|
|
+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;
|
|
|
|
|
+
|
|
|
|
|
+public class FastRegister {
|
|
|
|
|
+
|
|
|
|
|
+ // 创建试用小程序
|
|
|
|
|
+ private static final String fastRegisterUrl = "https://api.weixin.qq.com/wxa/component/fastregisterbetaweapp?access_token=";
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastregister.html
|
|
|
|
|
+ * @param accessToken 第三方平台令牌component_access_token
|
|
|
|
|
+ * @param name 小程序名称,昵称半自动设定,强制后缀“的体验小程序”。且该参数会进行关键字检查,如果命中品牌关键字则会报错。
|
|
|
|
|
+ * 如遇到品牌大客户要用试用小程序,建议用户先换个名字,认证后再修改成品牌名。
|
|
|
|
|
+ * 只支持4-30个字符
|
|
|
|
|
+ * @param openid 微信用户的openid(不是微信号),试用小程序创建成功后会默认将该用户设置为小程序管理员。
|
|
|
|
|
+ * 获取openid的方法请查看公众号获取openid
|
|
|
|
|
+ * h5获取openid、小程序获取openid、网站应用获取openid
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static FastRegisterBean fastRegister(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);
|
|
|
|
|
+ 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());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|