mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-07 14:17:47 +08:00
🆕 #2588 【小程序】代码管理增加查询小程序版本信息的接口
This commit is contained in:
parent
a88619a7dc
commit
f3921c7332
@ -105,6 +105,14 @@ public interface WxMaCodeService {
|
|||||||
*/
|
*/
|
||||||
WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException;
|
WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小程序版本信息
|
||||||
|
*
|
||||||
|
* @return 小程序的体验版和线上版本信息
|
||||||
|
* @throws WxErrorException 失败时抛出,具体错误码请看此接口的注释文档
|
||||||
|
*/
|
||||||
|
WxMaCodeVersionInfo getVersionInfo() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置最低基础库版本(仅供第三方代小程序调用).
|
* 设置最低基础库版本(仅供第三方代小程序调用).
|
||||||
*
|
*
|
||||||
|
@ -138,6 +138,12 @@ public class WxMaCodeServiceImpl implements WxMaCodeService {
|
|||||||
return WxMaCodeVersionDistribution.fromJson(responseContent);
|
return WxMaCodeVersionDistribution.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxMaCodeVersionInfo getVersionInfo() throws WxErrorException {
|
||||||
|
String responseContent = this.service.post(GET_VERSION_INFO_URL, "{}");
|
||||||
|
return WxMaCodeVersionInfo.fromJson(responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSupportVersion(String version) throws WxErrorException {
|
public void setSupportVersion(String version) throws WxErrorException {
|
||||||
JsonObject param = new JsonObject();
|
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 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 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 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 {
|
public interface Express {
|
||||||
|
@ -1,25 +1,21 @@
|
|||||||
package cn.binarywang.wx.miniapp.api.impl;
|
package cn.binarywang.wx.miniapp.api.impl;
|
||||||
|
|
||||||
|
import cn.binarywang.wx.miniapp.api.WxMaCodeService;
|
||||||
|
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||||
|
import cn.binarywang.wx.miniapp.bean.code.*;
|
||||||
|
import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
||||||
|
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import org.testng.annotations.Guice;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.testng.annotations.*;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
import cn.binarywang.wx.miniapp.api.WxMaCodeService;
|
|
||||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCategory;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeAuditStatus;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeCommitRequest;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeExtConfig;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeSubmitAuditRequest;
|
|
||||||
import cn.binarywang.wx.miniapp.bean.code.WxMaCodeVersionDistribution;
|
|
||||||
import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
|
||||||
import cn.binarywang.wx.miniapp.test.ApiTestModule;
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
|
|
||||||
import static org.testng.Assert.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="https://github.com/charmingoh">Charming</a>
|
* @author <a href="https://github.com/charmingoh">Charming</a>
|
||||||
@ -143,6 +139,12 @@ public class WxMaCodeServiceImplTest {
|
|||||||
System.out.println(distribution);
|
System.out.println(distribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetVersionInfo() throws Exception {
|
||||||
|
WxMaCodeVersionInfo versionInfo = wxService.getCodeService().getVersionInfo();
|
||||||
|
System.out.println(versionInfo);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetSupportVersion() throws Exception {
|
public void testSetSupportVersion() throws Exception {
|
||||||
wxService.getCodeService().setSupportVersion("1.2.0");
|
wxService.getCodeService().setSupportVersion("1.2.0");
|
||||||
|
Loading…
Reference in New Issue
Block a user