Skip to content

Commit 18a79b5

Browse files
authored
🎨 优化小程序版本信息接口返回
1 parent d056cc8 commit 18a79b5

File tree

3 files changed

+77
-4
lines changed

3 files changed

+77
-4
lines changed

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,6 @@ WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, Li
713713
* @return the wx open result
714714
* @throws WxErrorException the wx error exception
715715
*/
716-
WxOpenResult getVersionInfo() throws WxErrorException;
716+
WxOpenVersioninfoResult getVersionInfo() throws WxErrorException;
717717

718718
}

weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,9 @@ private JsonArray toJsonArray(List<String> strList) {
441441
}
442442

443443
@Override
444-
public WxOpenResult getVersionInfo() throws WxErrorException {
444+
public WxOpenVersioninfoResult getVersionInfo() throws WxErrorException {
445445
JsonObject params = new JsonObject();
446446
String response = post(API_GET_VERSION_INFO, GSON.toJson(params));
447-
WxOpenResult result = WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
448-
return result;
447+
return WxMaGsonBuilder.create().fromJson(response, WxOpenVersioninfoResult.class);
449448
}
450449
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
package me.chanjar.weixin.open.bean.result;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import lombok.Data;
5+
import lombok.EqualsAndHashCode;
6+
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
7+
8+
import java.io.Serializable;
9+
import java.util.List;
10+
11+
/**
12+
* 小程序版本信息
13+
*
14+
* @author cocoa
15+
* @date 20220727
16+
*/
17+
@Data
18+
@EqualsAndHashCode(callSuper = true)
19+
public class WxOpenVersioninfoResult extends WxOpenResult {
20+
21+
private static final long serialVersionUID = -1042219138582803275L;
22+
23+
@SerializedName("exp_info")
24+
ExpInfo expInfo;
25+
26+
@SerializedName("release_info")
27+
ReleaseInfo releaseInfo;
28+
29+
@Override
30+
public String toString() {
31+
return WxOpenGsonBuilder.create().toJson(this);
32+
}
33+
34+
@Data
35+
public static class ReleaseInfo {
36+
/**
37+
* 发布线上版的时间
38+
*/
39+
@SerializedName("release_time")
40+
private Long releaseTime;
41+
/**
42+
* 线上版版本信息
43+
*/
44+
@SerializedName("release_version")
45+
private String releaseVersion;
46+
/**
47+
* 线上版本描述
48+
*/
49+
@SerializedName("release_desc")
50+
private String releaseDesc;
51+
}
52+
53+
54+
@Data
55+
public static class ExpInfo {
56+
/**
57+
* 提交体验版的时间
58+
*/
59+
@SerializedName("exp_time")
60+
private Long expTime;
61+
/**
62+
* 头像已使用修改次数(本月)
63+
*/
64+
@SerializedName("exp_version")
65+
private String expVersion;
66+
/**
67+
* 头像修改次数总额度(本月)
68+
*/
69+
@SerializedName("exp_desc")
70+
private String expDesc;
71+
}
72+
73+
74+
}

0 commit comments

Comments
 (0)