Skip to content
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

小程序内容安全 #415

Merged
merged 7 commits into from
Jul 13, 2021
Merged

小程序内容安全 #415

merged 7 commits into from
Jul 13, 2021

Conversation

cxjhk
Copy link
Contributor

@cxjhk cxjhk commented Jul 13, 2021

`wc := wechat.NewWechat()
memory := cache.NewMemory()
cfg := &miniConfig.Config{
AppID: "",
AppSecret: "",
Cache: memory,
}

miniprogram := wc.GetMiniProgram(cfg)
res, _ := miniprogram.GetContentSecurity().CheckText("特3456书yuuo莞6543李zxcz蒜7782法fgnv级")
fmt.Println(res.Errmsg)
fmt.Println(res.Errcode)

`

Comment on lines 22 to 25
type ResContent struct {
Errcode int `json:"errcode"`
Errmsg string `json:"errmsg"`
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个直接去掉吧。 直接用util.CommonError,字段都是一样的


//CheckText 检测文字
//@text 需要检测的文字
func (content *Content) CheckText(text string) (result ResContent, err error) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接返回一个error不行吗? 在util.DecodeWithCommonError中已经判断了0 才行正常的

1:修改返回值 改为error异常统一返回
@silenceper silenceper merged commit c8522f1 into silenceper:release-2.0 Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants