Przeglądaj źródła

#794 增加实现开放小程序的设置支持版本库接口;增加WxOpenResult开放平台返回类型并修改相关接口实现。

master
Binary Wang 6 lat temu
committed by GitHub
rodzic
commit
3c84ceeff8
Nie znaleziono w bazie danych klucza dla tego podpisu ID klucza GPG: 4AEE18F83AFDEB23
9 zmienionych plików z 132 dodań i 50 usunięć
  1. +23
    -8
      weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java
  2. +43
    -15
      weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java
  3. +1
    -5
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaCategoryListResult.java
  4. +2
    -6
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java
  5. +1
    -5
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaPageListResult.java
  6. +27
    -0
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java
  7. +1
    -6
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaSubmitAuditResult.java
  8. +1
    -5
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaTesterListResult.java
  9. +33
    -0
      weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenResult.java

+ 23
- 8
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java Wyświetl plik

@@ -219,7 +219,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String bindTester(String wechatid) throws WxErrorException;
WxOpenResult bindTester(String wechatid) throws WxErrorException;

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

/**
* 获得体验者列表
@@ -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;

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

/**
* 查询最新一次提交的审核状态(仅供第三方代小程序调用)
@@ -302,7 +302,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String getLatestAuditStatus() throws WxErrorException;
WxOpenMaQueryAuditResult getLatestAuditStatus() throws WxErrorException;

/**
* 发布已通过审核的小程序(仅供第三方代小程序调用)
@@ -310,7 +310,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String releaesAudited() throws WxErrorException;
WxOpenResult releaesAudited() throws WxErrorException;

/**
* 11. 小程序版本回退(仅供第三方代小程序调用)
@@ -318,7 +318,7 @@ public interface WxOpenMaService extends WxMaService {
* @return
* @throws WxErrorException
*/
String revertCodeReleaes() throws WxErrorException;
WxOpenResult revertCodeReleaes() throws WxErrorException;

/**
* 15. 小程序审核撤回
@@ -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;

}

+ 43
- 15
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImpl.java Wyświetl plik

@@ -146,11 +146,11 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -161,11 +161,11 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -193,7 +193,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
@@ -201,7 +201,7 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
//注意: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);
}

/**
@@ -265,11 +265,11 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -279,9 +279,9 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -294,10 +294,10 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -307,9 +307,9 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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);
}

/**
@@ -322,8 +322,36 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ
* @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;
}



+ 1
- 5
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaCategoryListResult.java Wyświetl plik

@@ -6,7 +6,6 @@ import me.chanjar.weixin.open.bean.ma.WxOpenMaCategory;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

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

/**
@@ -16,10 +15,7 @@ import java.util.List;
* @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;


+ 2
- 6
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaDomainResult.java Wyświetl plik

@@ -3,7 +3,6 @@ package me.chanjar.weixin.open.bean.result;
import com.google.gson.annotations.SerializedName;
import lombok.Data;

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

/**
@@ -13,10 +12,7 @@ import java.util.List;
* @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;
@@ -29,5 +25,5 @@ public class WxOpenMaDomainResult implements Serializable {

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

+ 1
- 5
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaPageListResult.java Wyświetl plik

@@ -5,7 +5,6 @@ import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

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

/**
@@ -15,10 +14,7 @@ import java.util.List;
* @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;


+ 27
- 0
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaQueryAuditResult.java Wyświetl plik

@@ -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;
}

+ 1
- 6
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaSubmitAuditResult.java Wyświetl plik

@@ -3,8 +3,6 @@ package me.chanjar.weixin.open.bean.result;
import com.google.gson.annotations.SerializedName;
import lombok.Data;

import java.io.Serializable;

/**
* 微信开放平台小程序发布代码审核结果
*
@@ -12,10 +10,7 @@ import java.io.Serializable;
* @date 2018/9/12
*/
@Data
public class WxOpenMaSubmitAuditResult implements Serializable {

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

/**
* 审核编号


+ 1
- 5
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenMaTesterListResult.java Wyświetl plik

@@ -6,7 +6,6 @@ import me.chanjar.weixin.open.bean.ma.WxOpenMaMember;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

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

/**
@@ -16,10 +15,7 @@ import java.util.List;
* @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;


+ 33
- 0
weixin-java-open/src/main/java/me/chanjar/weixin/open/bean/result/WxOpenResult.java Wyświetl plik

@@ -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);
}
}

Ładowanie…
Anuluj
Zapisz