Skip to content

Commit

Permalink
🎨 #2593 【小程序】消息推送类添加图片/音频安全检测2.0结果字段
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyulai authored Apr 18, 2022
1 parent 4d01470 commit b6ee83d
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import lombok.Builder;
import lombok.Data;
import me.chanjar.weixin.common.util.xml.XStreamCDataConverter;

import java.io.Serializable;

Expand All @@ -19,6 +23,60 @@ public class WxMaMediaAsyncCheckResult implements Serializable {
@SerializedName("trace_id")
private String traceId;

/**
* 综合结果
*/
@Data
@Builder
@XStreamAlias("result")
public static class ResultBean implements Serializable {
/**
* suggest : risky
* label : 20001
*/
@SerializedName("suggest")
@XStreamAlias("suggest")
@XStreamConverter(value = XStreamCDataConverter.class)
private String suggest;
@SerializedName("label")
@XStreamAlias("label")
@XStreamConverter(value = XStreamCDataConverter.class)
private String label;
}

/**
* 详细检测结果
*/
@Data
@Builder
@XStreamAlias("detail")
public static class DetailBean implements Serializable {
/**
* strategy : content_model
* errcode : 0
* suggest : risky
* label : 20006
* prob : 90
*/
@SerializedName("strategy")
@XStreamAlias("strategy")
@XStreamConverter(value = XStreamCDataConverter.class)
private String strategy;
@SerializedName("errcode")
@XStreamAlias("errcode")
private Integer errcode;
@SerializedName("suggest")
@XStreamAlias("suggest")
@XStreamConverter(value = XStreamCDataConverter.class)
private String suggest;
@SerializedName("label")
@XStreamAlias("label")
@XStreamConverter(value = XStreamCDataConverter.class)
private String label;
@SerializedName("prob")
@XStreamAlias("prob")
private Integer prob;
}

public static WxMaMediaAsyncCheckResult fromJson(String json) {
return WxMaGsonBuilder.create().fromJson(json, WxMaMediaAsyncCheckResult.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import lombok.Data;
import me.chanjar.weixin.common.error.WxRuntimeException;
import me.chanjar.weixin.common.util.XmlUtils;
Expand All @@ -18,6 +19,7 @@
import java.io.InputStream;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -144,6 +146,29 @@ public class WxMaMessage implements Serializable {
@XStreamConverter(value = XStreamCDataConverter.class)
private String statusCode;

/**
* 异步校验图片/音频内容安全 接口版本
* @since 2.0
*/
@SerializedName("version")
@XStreamAlias("version")
private Integer version;
/**
* 异步校验图片/音频内容安全 综合结果
* @since 2.0
*/
@SerializedName("result")
@XStreamAlias("result")
private WxMaMediaAsyncCheckResult.ResultBean result;
/**
* 异步校验图片/音频内容安全 详细检测结果
* @since 2.0
*/
@SerializedName("detail")
@XStreamAlias("detail")
@XStreamImplicit
private List<WxMaMediaAsyncCheckResult.DetailBean> detail;

@SerializedName("Scene")
@XStreamAlias("Scene")
private Integer scene;
Expand Down

0 comments on commit b6ee83d

Please sign in to comment.