-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weapp v3版本文本检测好像用的还是腾讯的v1的接口? #78
Comments
sdk := weapp.NewClient("your-appid", "your-secret")
cli := sdk.NewSecurity() 是这样调用的吗? |
|
我试试你说的这个方法 |
这个方法可以使用,谢谢 |
可以检测到非法内容,但是返回的错是一个json反序列化的错.而不是腾讯返回的错误类型。查看源码应该是Label这个字段 一个是string,一个是int.官方返回的是string. type MsgSecCheckResponse struct {
request.CommonError
// 唯一请求标识,标记单次请求
TraceId string `json:"trace_id"`
// 综合结果
Result struct {
// 建议,有risky、pass、review三种值
Suggest string `json:"suggest"`
// 命中标签枚举值,100 正常;10001 广告;20001 时政;20002 色情;20003 辱骂;20006 违法犯罪;20008 欺诈;20012 低俗;20013 版权;21000 其他
Label string `json:"label"`
} `json:"result"`
// 详细检测结果
Detail []struct {
// 策略类型
Strategy string `json:"strategy"`
// 错误码,仅当该值为0时,该项结果有效
Errcode int `json:"errcode"`
// 建议,有risky、pass、review三种值
Suggest string `json:"suggest"`
// 命中标签枚举值,100 正常;10001 广告;20001 时政;20002 色情;20003 辱骂;20006 违法犯罪;20008 欺诈;20012 低俗;20013 版权;21000 其他
Label int `json:"label"`
// 0-100,代表置信度,越高代表越有可能属于当前返回的标签(label)
Prob int `json:"prob"`
// 命中的自定义关键词
Keyword string `json:"keyword"`
} `json:"detail"`
} |
https://developers.weixin.qq.com/community/develop/doc/000c225a578f60210f3dea20451400 Result结构体的label 应为int类型 |
OK了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Q:调用v3版本的MSGSecCheck,貌似有些内容检测不出来;
腾讯文本检测API v2介绍页:
https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.msgSecCheck.html
The text was updated successfully, but these errors were encountered: