#562 小程序增加代码管理相关 API

* 微信开放平台:1. WxOpenInRedisConfigStorage 支持 JedisPool/JedisSentinelPool 等 Pool<Jedis> 的子类;2. WxOpenInRedisConfigStorage 增加 keyPrefix 以支持可配置的前缀;

* 微信开放平台:增加小程序代码模板库管理

* 小程序:增加代码管理相关 API
This commit is contained in:
Charming
2018-04-26 23:02:22 +08:00
committed by Binary Wang
parent 75c038d464
commit 0247486b13
18 changed files with 1027 additions and 14 deletions

View File

@@ -0,0 +1,62 @@
package cn.binarywang.wx.miniapp.bean.code;
import com.google.gson.annotations.SerializedName;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 小程序帐号的可选类目,其中 address / tag / title 是提交审核会用到的
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:44
*/
@Data
@Builder
public class WxMaCategory implements Serializable {
private static final long serialVersionUID = -7663757440028175135L;
/**
* 一级类目名称
*/
@SerializedName("first_class")
private String firstClass;
/**
* 二级类目名称
*/
@SerializedName("second_class")
private String secondClass;
/**
* 三级类目名称
*/
@SerializedName("third_class")
private String thirdClass;
/**
* 一级类目的ID编号
*/
@SerializedName("first_id")
private Long firstId;
/**
* 二级类目的ID编号
*/
@SerializedName("second_id")
private Long secondId;
/**
* 三级类目的ID编号
*/
@SerializedName("third_id")
private Long thirdId;
/**
* 小程序的页面,可通过“获取小程序的第三方提交代码的页面配置”接口获得
*/
private String address;
/**
* 小程序的标签多个标签用空格分隔标签不能多于10个标签长度不超过20
*/
private String tag;
/**
* 小程序页面的标题,标题长度不超过32
*/
private String title;
}

View File

@@ -0,0 +1,37 @@
package cn.binarywang.wx.miniapp.bean.code;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 小程序代码审核状态
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:44:39
*/
@Data
@Builder
public class WxMaCodeAuditStatus implements Serializable {
private static final long serialVersionUID = 4655119308692217268L;
/**
* 审核 ID
*/
@SerializedName(value = "auditId", alternate = {"auditid"})
private Long auditId;
/**
* 审核状态其中0为审核成功1为审核失败2为审核中
*/
private Integer status;
/**
* 当status=1审核被拒绝时返回的拒绝原因
*/
private String reason;
public static WxMaCodeAuditStatus fromJson(String json) {
return WxMaGsonBuilder.create().fromJson(json, WxMaCodeAuditStatus.class);
}
}

View File

@@ -0,0 +1,39 @@
package cn.binarywang.wx.miniapp.bean.code;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* 微信代码请求上传参数
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:44:47
*/
@Data
@Builder
public class WxMaCodeCommitRequest implements Serializable {
private static final long serialVersionUID = 7495157056049312108L;
/**
* 代码库中的代码模版ID
*/
private Long templateId;
/**
* 第三方自定义的配置
*/
private WxMaCodeExtConfig extConfig;
/**
* 代码版本号,开发者可自定义
*/
private String userVersion;
/**
* 代码描述,开发者可自定义
*/
private String userDesc;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,199 @@
package cn.binarywang.wx.miniapp.bean.code;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 上传代码需要用到的第三方自定义的配置
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:44
*/
@Data
@Builder
public class WxMaCodeExtConfig implements Serializable {
private static final long serialVersionUID = -7666911367458178753L;
/**
* 配置 ext.json 是否生效
* 必填:是
*/
private boolean extEnable;
/**
* 配置 extAppid
* 必填:是
*/
private String extAppid;
/**
* 开发自定义的数据字段
* 必填:否
*/
private Object ext;
/**
* 单独设置每个页面的 json
* 必填:否
* key: page 名称,如 pages/logs/logs
* value: page 配置
*/
private Map<String, PageConfig> extPages;
/**
* 是否直接提交到待审核列表
* 必填:否
*/
private Boolean directCommit;
/**
* 设置页面路径(同 app.json 相同的字段,填写会覆盖 app.json
* 必填:否
*/
private List<String> pages;
/**
* 设置默认页面的窗口表现(同 app.json 相同的字段,填写会覆盖 app.json
* 必填:否
*/
private PageConfig window;
/**
* 设置各种网络请求的超时时间(同 app.json 相同的字段,填写会覆盖 app.json
* 必填:否
*/
private NetworkTimeout networkTimeout;
/**
* 设置是否开启 debug 模式(同 app.json 相同的字段,填写会覆盖 app.json
* 必填:否
*/
private Boolean debug;
/**
* page.json 配置,页面配置
* 文档https://mp.weixin.qq.com/debug/wxadoc/dev/framework/config.html
*/
@Data
@Builder
public static class PageConfig {
/**
* 导航栏背景颜色,如"#000000" HexColor
* 默认:#000000
*/
private String navigationBarBackgroundColor;
/**
* 导航栏标题颜色,仅支持 black/white
* 默认white
*/
private String navigationBarTextStyle;
/**
* 导航栏标题文字内容
*/
private String navigationBarTitleText;
/**
* 窗口的背景色 HexColor
* 默认:#ffffff
*/
private String backgroundColor;
/**
* 下拉背景字体、loading 图的样式,仅支持 dark/light
* 默认dark
*/
private String backgroundTextStyle;
/**
* 是否开启下拉刷新,详见页面相关事件处理函数
* 默认false
*/
private String enablePullDownRefresh;
/**
* 设置为 true 则页面整体不能上下滚动;只在 page.json 中有效,无法在 app.json 中设置该项
* 默认false
*/
private Boolean disableScroll;
/**
* 页面上拉触底事件触发时距页面底部距离单位为px
* 默认50
*/
private Integer onReachBottomDistance;
}
/**
* tabBar 配置
*/
@Data
@Builder
public static class TabBar {
/**
* HexColor, tab 上的文字默认颜色
*/
private String color;
/**
* HexColor, tab 上的文字选中时的颜色
*/
private String selectedColor;
/**
* HexColor, tab 的背景色
*/
private String backgroundColor;
/**
* tabbar 上边框的颜色,仅支持 black/white
*/
private String borderStyle;
/**
* tab 的列表最少2个、最多5个 tab
*/
private List<Item> list;
/**
* 可选值 bottom、top
*/
private String position;
/**
* list item
*/
@Data
@Builder
public static class Item {
/**
* 是 页面路径,必须在 pages 中先定义
*/
private String pagePath;
/**
* tab 上按钮文字
*/
private String text;
/**
* 图片路径icon 大小限制为40kb建议尺寸为 81px * 81px当 postion 为 top 时,此参数无效,不支持网络图片
*/
private String iconPath;
/**
* 选中时的图片路径icon 大小限制为40kb建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效
*/
private String selectedIconPath;
}
}
/**
* 各种网络请求的超时时间
*/
@Data
@Builder
public static class NetworkTimeout {
/**
* wx.request的超时时间单位毫秒默认为60000
* 必填:否
*/
private Integer request;
/**
* wx.connectSocket的超时时间单位毫秒默认为60000
* 必填:否
*/
private Integer connectSocket;
/**
* wx.uploadFile的超时时间单位毫秒默认为60000
* 必填:否
*/
private Integer uploadFile;
/**
* wx.downloadFile的超时时间单位毫秒默认为60000
* 必填:否
*/
private Integer downloadFile;
}
}

View File

@@ -0,0 +1,30 @@
package cn.binarywang.wx.miniapp.bean.code;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 提交审核的请求
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:45
*/
@Data
@Builder
public class WxMaCodeSubmitAuditRequest implements Serializable {
private static final long serialVersionUID = 8854979405505241314L;
/**
* 提交审核项的一个列表至少填写1项至多填写5项
*/
@SerializedName("item_list")
private List<WxMaCategory> itemList;
public String toJson() {
return WxMaGsonBuilder.create().toJson(this);
}
}

View File

@@ -0,0 +1,30 @@
package cn.binarywang.wx.miniapp.bean.code;
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
import lombok.Data;
import java.util.Map;
/**
* 小程序代码版本号分布
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:45
*/
@Data
public class WxMaCodeVersionDistribution {
/**
* 当前版本
*/
private String nowVersion;
/**
* 受影响用户占比
* key: version, 版本号
* value: percentage, 受影响比例
*/
private Map<String, Float> uvInfo;
public static WxMaCodeVersionDistribution fromJson(String json) {
return WxMaGsonBuilder.create().fromJson(json, WxMaCodeVersionDistribution.class);
}
}

View File

@@ -0,0 +1,7 @@
/**
* 微信小程序代码管理相关的 bean
*
* @author <a href="https://github.com/charmingoh">Charming</a>
* @since 2018-04-26 19:44
*/
package cn.binarywang.wx.miniapp.bean.code;