Merge pull request #194 from sutra/mediaCheckAsync
Implement mediaCheckAsync.
This commit is contained in:
commit
7825a86fd1
@ -95,4 +95,22 @@ public class SecCheckApi extends TokenManagerApi {
|
|||||||
r.checkErrCode();
|
r.checkErrCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步校验图片/音频是否含有违法违规内容。
|
||||||
|
*
|
||||||
|
* @param mediaUrl 要检测的多媒体 URL
|
||||||
|
* @param mediaType {@code 1}: 音频; {@code 2}: 图片
|
||||||
|
* @return 任务 ID,用于匹配异步推送结果
|
||||||
|
* @throws WeixinException indicates getting access token failed.
|
||||||
|
* @see <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html">security.mediaCheckAsync</a>
|
||||||
|
*/
|
||||||
|
public String mediaCheckAsync(String mediaUrl, int mediaType) throws WeixinException {
|
||||||
|
final Map<String, Object> params = new HashMap<String, Object>(2);
|
||||||
|
params.put("media_url", mediaUrl);
|
||||||
|
params.put("media_type", mediaType);
|
||||||
|
final WxaApiAsyncResult r = this.post("wxa_media_check_async", params, WxaApiAsyncResult.TYPE_REFERENCE);
|
||||||
|
r.checkErrCode();
|
||||||
|
return r.getTraceId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.foxinmy.weixin4j.wxa.api;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.TypeReference;
|
||||||
|
|
||||||
|
class WxaApiAsyncResult extends WxaApiResult {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2020022001L;
|
||||||
|
|
||||||
|
public static final TypeReference<WxaApiAsyncResult> TYPE_REFERENCE
|
||||||
|
= new TypeReference<WxaApiAsyncResult>() {
|
||||||
|
};
|
||||||
|
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
public WxaApiAsyncResult() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTraceId() {
|
||||||
|
return traceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTraceId(String traceId) {
|
||||||
|
this.traceId = traceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -50,5 +50,8 @@ message_custom_typing={api_cgi_url}/message/custom/typing?access_token=%s
|
|||||||
# imgSecCheck
|
# imgSecCheck
|
||||||
wxa_img_sec_check={api_wxa_url}/img_sec_check?access_token=%s
|
wxa_img_sec_check={api_wxa_url}/img_sec_check?access_token=%s
|
||||||
|
|
||||||
|
# mediaCheckAsync
|
||||||
|
wxa_media_check_async={api_wxa_url}/media_check_async?access_token=%s
|
||||||
|
|
||||||
# msgSecCheck
|
# msgSecCheck
|
||||||
wxa_msg_sec_check={api_wxa_url}/msg_sec_check?access_token=%s
|
wxa_msg_sec_check={api_wxa_url}/msg_sec_check?access_token=%s
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user