Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String bindTester(String wechatid) throws WxErrorException;
WxOpenResult bindTester(String wechatid) throws WxErrorException;

/**
* 解除绑定小程序体验者
Expand All @@ -228,7 +228,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String unbindTester(String wechatid) throws WxErrorException;
WxOpenResult unbindTester(String wechatid) throws WxErrorException;

/**
* 获得体验者列表
Expand All @@ -248,7 +248,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException;
WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException;

/**
* 获取体验小程序的体验二维码
Expand Down Expand Up @@ -294,31 +294,31 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String getAuditStatus(Long auditid) throws WxErrorException;
WxOpenMaQueryAuditResult getAuditStatus(Long auditid) throws WxErrorException;

/**
* 查询最新一次提交的审核状态(仅供第三方代小程序调用)
*
* @return
* @throws WxErrorException
*/
String getLatestAuditStatus() throws WxErrorException;
WxOpenMaQueryAuditResult getLatestAuditStatus() throws WxErrorException;

/**
* 发布已通过审核的小程序(仅供第三方代小程序调用)
*
* @return
* @throws WxErrorException
*/
String releaesAudited() throws WxErrorException;
WxOpenResult releaesAudited() throws WxErrorException;

/**
* 11. 小程序版本回退(仅供第三方代小程序调用)
*
* @return
* @throws WxErrorException
*/
String revertCodeReleaes() throws WxErrorException;
WxOpenResult revertCodeReleaes() throws WxErrorException;

/**
* 15. 小程序审核撤回
Expand All @@ -329,6 +329,21 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String undoCodeAudit() throws WxErrorException;
WxOpenResult undoCodeAudit() throws WxErrorException;

/**
* 查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
* @return
* @throws WxErrorException
*/
String getSupportVersion() throws WxErrorException;

/**
* 设置最低基础库版本(仅供第三方代小程序调用)
* @param version
* @return
* @throws WxErrorException
*/
String setSupportVersion(String version) throws WxErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ public String getAccountBasicInfo() throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String bindTester(String wechatid) throws WxErrorException {
public WxOpenResult bindTester(String wechatid) throws WxErrorException {
JsonObject paramJson = new JsonObject();
paramJson.addProperty("wechatid", wechatid);
String response = post(API_BIND_TESTER, GSON.toJson(paramJson));
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
Expand All @@ -161,11 +161,11 @@ public String bindTester(String wechatid) throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String unbindTester(String wechatid) throws WxErrorException {
public WxOpenResult unbindTester(String wechatid) throws WxErrorException {
JsonObject paramJson = new JsonObject();
paramJson.addProperty("wechatid", wechatid);
String response = post(API_UNBIND_TESTER, GSON.toJson(paramJson));
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
Expand Down Expand Up @@ -193,15 +193,15 @@ public WxOpenMaTesterListResult getTesterList() throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException {
public WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, WxMaOpenCommitExtInfo extInfo) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("template_id", templateId);
params.addProperty("user_version", userVersion);
params.addProperty("user_desc", userDesc);
//注意:ext_json必须是字符串类型
params.addProperty("ext_json", GSON.toJson(extInfo));
String response = post(API_CODE_COMMIT, GSON.toJson(params));
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
Expand Down Expand Up @@ -265,11 +265,11 @@ public WxOpenMaSubmitAuditResult submitAudit(WxOpenMaSubmitAuditMessage submitAu
* @throws WxErrorException
*/
@Override
public String getAuditStatus(Long auditid) throws WxErrorException {
public WxOpenMaQueryAuditResult getAuditStatus(Long auditid) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("auditid", auditid);
String response = post(API_GET_AUDIT_STATUS, GSON.toJson(params));
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaQueryAuditResult.class);
}

/**
Expand All @@ -279,9 +279,9 @@ public String getAuditStatus(Long auditid) throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String getLatestAuditStatus() throws WxErrorException {
public WxOpenMaQueryAuditResult getLatestAuditStatus() throws WxErrorException {
String response = get(API_GET_LATEST_AUDIT_STATUS, null);
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenMaQueryAuditResult.class);
}

/**
Expand All @@ -294,10 +294,10 @@ public String getLatestAuditStatus() throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String releaesAudited() throws WxErrorException {
public WxOpenResult releaesAudited() throws WxErrorException {
JsonObject params = new JsonObject();
String response = post(API_RELEASE, GSON.toJson(params));
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
Expand All @@ -307,9 +307,9 @@ public String releaesAudited() throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String revertCodeReleaes() throws WxErrorException {
public WxOpenResult revertCodeReleaes() throws WxErrorException {
String response = get(API_REVERT_CODE_RELEASE, null);
return response;
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
Expand All @@ -322,8 +322,36 @@ public String revertCodeReleaes() throws WxErrorException {
* @throws WxErrorException
*/
@Override
public String undoCodeAudit() throws WxErrorException {
public WxOpenResult undoCodeAudit() throws WxErrorException {
String response = get(API_UNDO_CODE_AUDIT, null);
return WxMaGsonBuilder.create().fromJson(response, WxOpenResult.class);
}

/**
* 查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
*
* @return
* @throws WxErrorException
*/
@Override
public String getSupportVersion() throws WxErrorException {
JsonObject params = new JsonObject();
String response = post(API_GET_WEAPP_SUPPORT_VERSION, GSON.toJson(params));
return response;
}

/**
* 设置最低基础库版本(仅供第三方代小程序调用)
*
* @param version
* @return
* @throws WxErrorException
*/
@Override
public String setSupportVersion(String version) throws WxErrorException {
JsonObject params = new JsonObject();
params.addProperty("version", version);
String response = post(API_SET_WEAPP_SUPPORT_VERSION, GSON.toJson(params));
return response;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -16,10 +15,7 @@
* @date 2018/9/12
*/
@Data
public class WxOpenMaCategoryListResult implements Serializable {

private String errcode;
private String errmsg;
public class WxOpenMaCategoryListResult extends WxOpenResult {

@SerializedName("category_list")
List<WxOpenMaCategory> categoryList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -13,10 +12,7 @@
* @date 2018/9/12
*/
@Data
public class WxOpenMaDomainResult implements Serializable {

private String errcode;
private String errmsg;
public class WxOpenMaDomainResult extends WxOpenResult {

@SerializedName("requestdomain")
List<String> requestdomainList;
Expand All @@ -29,5 +25,5 @@ public class WxOpenMaDomainResult implements Serializable {

@SerializedName("downloaddomain")
List<String> downloaddomainList;

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -15,10 +14,7 @@
* @date 2018/9/12
*/
@Data
public class WxOpenMaPageListResult implements Serializable {

private String errcode;
private String errmsg;
public class WxOpenMaPageListResult extends WxOpenResult {

@SerializedName("page_list")
List<String> pageList;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package me.chanjar.weixin.open.bean.result;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

/**
* @author yqx
* @date 2018/10/3
*/
@Data
public class WxOpenMaQueryAuditResult extends WxOpenResult {
/**
* 审核编号
*/
@SerializedName("auditid")
Long auditId;

/**
* 审核状态:2-审核中,0-审核通过,1-审核失败
*/
Integer status;

/**
* 审核失败原因
*/
String reason;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;

/**
* 微信开放平台小程序发布代码审核结果
*
* @author yqx
* @date 2018/9/12
*/
@Data
public class WxOpenMaSubmitAuditResult implements Serializable {

private String errcode;
private String errmsg;
public class WxOpenMaSubmitAuditResult extends WxOpenResult {

/**
* 审核编号
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -16,10 +15,7 @@
* @date 2018/9/12
*/
@Data
public class WxOpenMaTesterListResult implements Serializable {

private String errcode;
private String errmsg;
public class WxOpenMaTesterListResult extends WxOpenResult {

@SerializedName("members")
List<WxOpenMaMember> membersList;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package me.chanjar.weixin.open.bean.result;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;

/**
* 基础的微信开放平台请求结果
*
* @author yqx
* @date 2018/10/1
*/
@Data
public class WxOpenResult implements Serializable {
protected String errcode;
protected String errmsg;

/**
* 请求是否成功
*
* @return
*/
public boolean isSuccess() {
return StringUtils.equalsIgnoreCase(errcode, "0");
}

public String toString() {
return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
}
}