|
|
@@ -1,9 +1,56 @@
|
|
|
package com.mrxu.framework.common.weixin.api;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.mrxu.framework.common.weixin.base.WxHttp;
|
|
|
+import com.mrxu.framework.common.weixin.base.WxResult;
|
|
|
+import com.mrxu.framework.common.weixin.bean.CommitPage;
|
|
|
+import com.mrxu.framework.common.weixin.bean.ComponentToken;
|
|
|
+
|
|
|
// 发布指定小程序相关接口
|
|
|
// https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/commit.html
|
|
|
public class ComponentDeployApi {
|
|
|
|
|
|
- // todo
|
|
|
+ private static String commit = "https://api.weixin.qq.com/wxa/commit?access_token=";
|
|
|
+
|
|
|
+ private static String get_page = "https://api.weixin.qq.com/wxa/get_page?access_token=";
|
|
|
+
|
|
|
+ private static String get_qrcode = "https://api.weixin.qq.com/wxa/get_qrcode?access_token=";
|
|
|
+
|
|
|
+ private static String submit_audit = "https://api.weixin.qq.com/wxa/submit_audit?access_token=";
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传小程序代码并生成体验版
|
|
|
+ * access_token String 是 第三方平台接口调用令牌authorizer_access_token
|
|
|
+ * template_id String 是 代码库中的代码模板 ID,可通过获取代码模板列表接口获取template_id
|
|
|
+ * 注意,如果该模板 id 为标准模板库的模板id,则ext_json可支持的参数为:{"extAppid":" ", "ext": {}, "window": {}}
|
|
|
+ * ext_json String 是 为了方便第三方平台的开发者引入 extAppid 的开发调试工作,引入ext.json配置文件概念,该参数则是用于控制 ext.json 配置文件的内容。关于该参数的补充说明请查看下方的"ext_json补充说明"。
|
|
|
+ * user_version String 是 代码版本号,开发者可自定义(长度不要超过 64 个字符)
|
|
|
+ * user_desc String 是 代码描述,开发者可自定义
|
|
|
+ */
|
|
|
+ // https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/commit.html
|
|
|
+ public static WxResult commit(String accessToken,String templateId,String extJson,String userVersion,String userDesc) {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("template_id", templateId);
|
|
|
+ json.put("ext_json", extJson);
|
|
|
+ json.put("user_version", userVersion);
|
|
|
+ json.put("user_desc", userDesc);
|
|
|
+ WxResult rs = WxHttp.post(WxResult.class,commit+accessToken,json);
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 获取已上传的代码的页面列表
|
|
|
+ */
|
|
|
+ // https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_page.html
|
|
|
+ public static CommitPage getPage(String accessToken) {
|
|
|
+ CommitPage rs = WxHttp.get(CommitPage.class,get_page+accessToken,null);
|
|
|
+ return rs;
|
|
|
+ }
|
|
|
+
|
|
|
+ // https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_qrcode.html
|
|
|
+ public static String getQrcode(String accessToken,String path) {
|
|
|
+ return get_qrcode+accessToken+"&path="+path;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|