🎨 优化小程序版本信息接口返回

This commit is contained in:
cocoa 2022-07-27 19:58:53 +08:00 committed by GitHub
parent d056cc8abe
commit 18a79b5b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 77 additions and 4 deletions

View File

@ -713,6 +713,6 @@ public interface WxOpenMaService extends WxMaService {
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult getVersionInfo() throws WxErrorException;
WxOpenVersioninfoResult getVersionInfo() throws WxErrorException;
}

View File

@ -441,10 +441,9 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
}
@Override
public WxOpenResult getVersionInfo() throws WxErrorException {
public WxOpenVersioninfoResult getVersionInfo() throws WxErrorException {
JsonObject params = new JsonObject();
String response = post(API_GET_VERSION_INFO, GSON.toJson(params));
WxOpenResult result = WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
return result;
return WxMaGsonBuilder.create().fromJson(response, WxOpenVersioninfoResult.class);
}
}

View File

@ -0,0 +1,74 @@
package me.chanjar.weixin.open.bean.result;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import java.io.Serializable;
import java.util.List;
/**
* 小程序版本信息
*
* @author cocoa
* @date 20220727
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxOpenVersioninfoResult extends WxOpenResult {
private static final long serialVersionUID = -1042219138582803275L;
@SerializedName("exp_info")
ExpInfo expInfo;
@SerializedName("release_info")
ReleaseInfo releaseInfo;
@Override
public String toString() {
return WxOpenGsonBuilder.create().toJson(this);
}
@Data
public static class ReleaseInfo {
/**
* 发布线上版的时间
*/
@SerializedName("release_time")
private Long releaseTime;
/**
* 线上版版本信息
*/
@SerializedName("release_version")
private String releaseVersion;
/**
* 线上版本描述
*/
@SerializedName("release_desc")
private String releaseDesc;
}
@Data
public static class ExpInfo {
/**
* 提交体验版的时间
*/
@SerializedName("exp_time")
private Long expTime;
/**
* 头像已使用修改次数本月
*/
@SerializedName("exp_version")
private String expVersion;
/**
* 头像修改次数总额度本月
*/
@SerializedName("exp_desc")
private String expDesc;
}
}