| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -105,6 +105,14 @@ public interface WxMaCodeService { | |||
| 105 | 105 | */ | |
| 106 | 106 | WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException; | |
| 107 | 107 | ||
| 108 | + /** | ||
| 109 | + * 查询小程序版本信息 | ||
| 110 | + * | ||
| 111 | + * @return 小程序的体验版和线上版本信息 | ||
| 112 | + * @throws WxErrorException 失败时抛出,具体错误码请看此接口的注释文档 | ||
| 113 | + */ | ||
| 114 | + WxMaCodeVersionInfo getVersionInfo() throws WxErrorException; | ||
| 115 | + | ||
| 108 | 116 | /** | |
| 109 | 117 | * 设置最低基础库版本(仅供第三方代小程序调用). | |
| 110 | 118 | * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -138,6 +138,12 @@ public WxMaCodeVersionDistribution getSupportVersion() throws WxErrorException { | |||
| 138 | 138 | return WxMaCodeVersionDistribution.fromJson(responseContent); | |
| 139 | 139 | } | |
| 140 | 140 | ||
| 141 | + @Override | ||
| 142 | + public WxMaCodeVersionInfo getVersionInfo() throws WxErrorException { | ||
| 143 | + String responseContent = this.service.post(GET_VERSION_INFO_URL, "{}"); | ||
| 144 | + return WxMaCodeVersionInfo.fromJson(responseContent); | ||
| 145 | + } | ||
| 146 | + | ||
| 141 | 147 | @Override | |
| 142 | 148 | public void setSupportVersion(String version) throws WxErrorException { | |
| 143 | 149 | JsonObject param = new JsonObject(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,91 @@ | |||
| 1 | + package cn.binarywang.wx.miniapp.bean.code; | ||
| 2 | + | ||
| 3 | + import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; | ||
| 4 | + import com.google.gson.annotations.SerializedName; | ||
| 5 | + import lombok.AllArgsConstructor; | ||
| 6 | + import lombok.Data; | ||
| 7 | + import lombok.NoArgsConstructor; | ||
| 8 | + | ||
| 9 | + import java.io.Serializable; | ||
| 10 | + | ||
| 11 | + /** | ||
| 12 | + * 查询小程序版本信息 | ||
| 13 | + * | ||
| 14 | + * @author <a href="https://github.com/leonxi">LeonXi</a> | ||
| 15 | + * @since 2022-04-13 16:45 | ||
| 16 | + */ | ||
| 17 | + @Data | ||
| 18 | + @NoArgsConstructor | ||
| 19 | + @AllArgsConstructor | ||
| 20 | + public class WxMaCodeVersionInfo implements Serializable { | ||
| 21 | + | ||
| 22 | + private static final long serialVersionUID = 6929700728659511688L; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 体验版信息 | ||
| 26 | + */ | ||
| 27 | + @SerializedName("exp_info") | ||
| 28 | + private ExpInfo expInfo; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 线上版信息 | ||
| 32 | + */ | ||
| 33 | + @SerializedName("release_info") | ||
| 34 | + private ReleaseInfo releaseInfo; | ||
| 35 | + | ||
| 36 | + public static WxMaCodeVersionInfo fromJson(String json) { | ||
| 37 | + return WxMaGsonBuilder.create().fromJson(json, WxMaCodeVersionInfo.class); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Data | ||
| 41 | + @NoArgsConstructor | ||
| 42 | + @AllArgsConstructor | ||
| 43 | + public static class ExpInfo implements Serializable { | ||
| 44 | + | ||
| 45 | + private static final long serialVersionUID = 6315578419554592943L; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 提交体验版的时间 | ||
| 49 | + */ | ||
| 50 | + @SerializedName("exp_time") | ||
| 51 | + private Long expTime; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 体验版版本信息 | ||
| 55 | + */ | ||
| 56 | + @SerializedName("exp_version") | ||
| 57 | + private String expVersion; | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * 体验版版本描述 | ||
| 61 | + */ | ||
| 62 | + @SerializedName("exp_desc") | ||
| 63 | + private String expDesc; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Data | ||
| 67 | + @NoArgsConstructor | ||
| 68 | + @AllArgsConstructor | ||
| 69 | + public static class ReleaseInfo implements Serializable { | ||
| 70 | + | ||
| 71 | + private static final long serialVersionUID = 2098307354673939939L; | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 发布线上版的时间 | ||
| 75 | + */ | ||
| 76 | + @SerializedName("release_time") | ||
| 77 | + private Long releaseTime; | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 线上版版本信息 | ||
| 81 | + */ | ||
| 82 | + @SerializedName("release_version") | ||
| 83 | + private String releaseVersion; | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 线上版本描述 | ||
| 87 | + */ | ||
| 88 | + @SerializedName("release_desc") | ||
| 89 | + private String releaseDesc; | ||
| 90 | + } | ||
| 91 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,6 +70,7 @@ public interface Code { | |||
| 70 | 70 | String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion"; | |
| 71 | 71 | String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion"; | |
| 72 | 72 | String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit"; | |
| 73 | + String GET_VERSION_INFO_URL = "https://api.weixin.qq.com/wxa/getversioninfo"; | ||
| 73 | 74 | } | |
| 74 | 75 | ||
| 75 | 76 | public interface Express { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,25 +1,21 @@ | |||
| 1 | 1 | package cn.binarywang.wx.miniapp.api.impl; | |
| 2 | 2 | ||
| 3 | - import java.util.Arrays; | ||
| 4 | - import java.util.HashMap; | ||
| 5 | - import java.util.List; | ||
| 6 | - import java.util.Map; | ||
| 7 | - | ||
| 8 | - import org.testng.annotations.*; | ||
| 9 | - | ||
| 10 | 3 | import cn.binarywang.wx.miniapp.api.WxMaCodeService; | |
| 11 | 4 | import cn.binarywang.wx.miniapp.api.WxMaService; | |
| 12 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCategory; | ||
| 13 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCodeAuditStatus; | ||
| 14 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCodeCommitRequest; | ||
| 15 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCodeExtConfig; | ||
| 16 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCodeSubmitAuditRequest; | ||
| 17 | - import cn.binarywang.wx.miniapp.bean.code.WxMaCodeVersionDistribution; | ||
| 5 | + import cn.binarywang.wx.miniapp.bean.code.*; | ||
| 18 | 6 | import cn.binarywang.wx.miniapp.config.WxMaConfig; | |
| 19 | 7 | import cn.binarywang.wx.miniapp.test.ApiTestModule; | |
| 20 | 8 | import com.google.inject.Inject; | |
| 9 | + import org.testng.annotations.Guice; | ||
| 10 | + import org.testng.annotations.Test; | ||
| 11 | + | ||
| 12 | + import java.util.Arrays; | ||
| 13 | + import java.util.HashMap; | ||
| 14 | + import java.util.List; | ||
| 15 | + import java.util.Map; | ||
| 21 | 16 | ||
| 22 | - import static org.testng.Assert.*; | ||
| 17 | + import static org.testng.Assert.assertNotNull; | ||
| 18 | + import static org.testng.Assert.assertTrue; | ||
| 23 | 19 | ||
| 24 | 20 | /** | |
| 25 | 21 | * @author <a href="https://github.com/charmingoh">Charming</a> | |
@@ -143,6 +139,12 @@ public void testGetSupportVersion() throws Exception { | |||
| 143 | 139 | System.out.println(distribution); | |
| 144 | 140 | } | |
| 145 | 141 | ||
| 142 | + @Test | ||
| 143 | + public void testGetVersionInfo() throws Exception { | ||
| 144 | + WxMaCodeVersionInfo versionInfo = wxService.getCodeService().getVersionInfo(); | ||
| 145 | + System.out.println(versionInfo); | ||
| 146 | + } | ||
| 147 | + | ||
| 146 | 148 | @Test | |
| 147 | 149 | public void testSetSupportVersion() throws Exception { | |
| 148 | 150 | wxService.getCodeService().setSupportVersion("1.2.0"); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments