You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-library/service/wechatopen/wxa.media_check_async.go

59 lines
2.6 KiB

package wechatopen
import (
"context"
"github.com/dtapps/go-library/utils/gojson"
"github.com/dtapps/go-library/utils/gorequest"
"net/http"
)
type WxaMediaCheckAsyncResponse struct {
Errcode int `json:"errcode"` // 错误码
Errmsg string `json:"errmsg"` // 错误信息
TraceId string `json:"trace_id"` // 唯一请求标识,标记单次请求,用于匹配异步推送结果
Result struct {
Suggest string `json:"suggest"` // 小程序的username
Label int `json:"label"` // 小程序的username
} `json:"result"` // 小程序的username
ToUserName string `json:"ToUserName"` // 小程序的username
FromUserName string `json:"FromUserName"` // 平台推送服务UserName
CreateTime int `json:"CreateTime"` // 发送时间
MsgType string `json:"MsgType"` // 默认为event
Event string `json:"Event"` // 默认为wxa_media_check
Appid string `json:"appid"` // 小程序的appid
Version int `json:"version"` // 小程序的username
Detail []struct {
Strategy string `json:"strategy"` // 小程序的username
Errcode int `json:"errcode"` // 小程序的username
Suggest string `json:"suggest"` // 小程序的username
Label int `json:"label"` // 小程序的username
Prob int `json:"prob"` // 小程序的username
} `json:"detail"` // 小程序的username
}
type WxaMediaCheckAsyncResult struct {
Result WxaMediaCheckAsyncResponse // 结果
Body []byte // 内容
Http gorequest.Response // 请求
}
func newWxaMediaCheckAsyncResult(result WxaMediaCheckAsyncResponse, body []byte, http gorequest.Response) *WxaMediaCheckAsyncResult {
return &WxaMediaCheckAsyncResult{Result: result, Body: body, Http: http}
}
// WxaMediaCheckAsync 音视频内容安全识别
// https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/sec-center/sec-check/mediaCheckAsync.html
12 months ago
func (c *Client) WxaMediaCheckAsync(ctx context.Context, authorizerAccessToken string, notMustParams ...gorequest.Params) (*WxaMediaCheckAsyncResult, error) {
// 参数
params := gorequest.NewParamsWith(notMustParams...)
// 请求
12 months ago
request, err := c.request(ctx, apiUrl+"/wxa/media_check_async?access_token="+authorizerAccessToken, params, http.MethodPost)
if err != nil {
return newWxaMediaCheckAsyncResult(WxaMediaCheckAsyncResponse{}, request.ResponseBody, request), err
}
// 定义
var response WxaMediaCheckAsyncResponse
err = gojson.Unmarshal(request.ResponseBody, &response)
return newWxaMediaCheckAsyncResult(response, request.ResponseBody, request), err
}