mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2588 【小程序】代码管理增加查询小程序版本信息的接口
This commit is contained in:
@@ -105,6 +105,14 @@ public interface WxMaCodeService {
|
||||
*/
|
||||
WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 查询小程序版本信息
|
||||
*
|
||||
* @return 小程序的体验版和线上版本信息
|
||||
* @throws WxErrorException 失败时抛出,具体错误码请看此接口的注释文档
|
||||
*/
|
||||
WxMaCodeVersionInfo getVersionInfo() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 设置最低基础库版本(仅供第三方代小程序调用).
|
||||
*
|
||||
|
||||
@@ -138,6 +138,12 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
||||
return WxMaCodeVersionDistribution.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMaCodeVersionInfo getVersionInfo() throws WxErrorException {
|
||||
String responseContent = this.service.post(GET_VERSION_INFO_URL, "{}");
|
||||
return WxMaCodeVersionInfo.fromJson(responseContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSupportVersion(String version) throws WxErrorException {
|
||||
JsonObject param = new JsonObject();
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package cn.binarywang.wx.miniapp.bean.code;
|
||||
|
||||
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 查询小程序版本信息
|
||||
*
|
||||
* @author <a href="https://github.com/leonxi">LeonXi</a>
|
||||
* @since 2022-04-13 16:45
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WxMaCodeVersionInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6929700728659511688L;
|
||||
|
||||
/**
|
||||
* 体验版信息
|
||||
*/
|
||||
@SerializedName("exp_info")
|
||||
private ExpInfo expInfo;
|
||||
|
||||
/**
|
||||
* 线上版信息
|
||||
*/
|
||||
@SerializedName("release_info")
|
||||
private ReleaseInfo releaseInfo;
|
||||
|
||||
public static WxMaCodeVersionInfo fromJson(String json) {
|
||||
return WxMaGsonBuilder.create().fromJson(json, WxMaCodeVersionInfo.class);
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ExpInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6315578419554592943L;
|
||||
|
||||
/**
|
||||
* 提交体验版的时间
|
||||
*/
|
||||
@SerializedName("exp_time")
|
||||
private Long expTime;
|
||||
|
||||
/**
|
||||
* 体验版版本信息
|
||||
*/
|
||||
@SerializedName("exp_version")
|
||||
private String expVersion;
|
||||
|
||||
/**
|
||||
* 体验版版本描述
|
||||
*/
|
||||
@SerializedName("exp_desc")
|
||||
private String expDesc;
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class ReleaseInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2098307354673939939L;
|
||||
|
||||
/**
|
||||
* 发布线上版的时间
|
||||
*/
|
||||
@SerializedName("release_time")
|
||||
private Long releaseTime;
|
||||
|
||||
/**
|
||||
* 线上版版本信息
|
||||
*/
|
||||
@SerializedName("release_version")
|
||||
private String releaseVersion;
|
||||
|
||||
/**
|
||||
* 线上版本描述
|
||||
*/
|
||||
@SerializedName("release_desc")
|
||||
private String releaseDesc;
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ public class WxMaApiUrlConstants {
|
||||
String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion";
|
||||
String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion";
|
||||
String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit";
|
||||
String GET_VERSION_INFO_URL = "https://api.weixin.qq.com/wxa/getversioninfo";
|
||||
}
|
||||
|
||||
public interface Express {
|
||||
|
||||
Reference in New Issue
Block a user