云开发的security.msgSecCheck,为何都是ok?
浏览过好几个相关问题,发现都是v1版本的,没有现版本的,并且现在的官方文档上我也没看见他们测试的用例会返回87014这个代码呀
这个是现在的官方文档地址
下面是我的代码按照官方文档改的,如果哪里有错谢谢各位大佬帮忙指正
这是云开发的
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const wxContext = cloud.getWXContext().OPENID
const result = await cloud.openapi.security.msgSecCheck({
"openid": wxContext,
"scene": 2,
"version": 2,
"content": event.content
})
return result
} catch (err) {
return err
}
}
这是自己的
reviewsend: function (e) {
let sms = this.data.sms
var reviewlegality = true;
var that = this;
if (sms.length < 3) {
wx.showToast({
title: '再多说点吧!',
icon: 'none',
duration: 800,
})
return
}
else {
console.log(sms)
wx.cloud.callFunction({
name: 'msgSecCheck',
data: {
content: sms,
},
success(res) {
console.log('msgSecCheck-res', res)
if (res.result.errCode != 0) {
console.log(res.result.errCode)
wx.showToast({
icon: 'none',
title: '文字违规',
})
this.setData({
reviewlegality: false
})
console.log(reviewlegality)
return
} else {
if (!reviewlegality) {
return;
}
var i = that.data.currentlyreviewid
let commentsNumber = "articlesdata[" + i + "].articlecommentsNumber"
let hasreviewed = "articlesdata[" + i + "].articlehasreviewed"
let reviewicon = "articlesdata[" + i + "].articlereviewicon"
that.setData({
reviewvalue: sms,
sms: '',
[commentsNumber]: that.data.articlesdata[i].articlecommentsNumber + 1,
[hasreviewed]: true,
[reviewicon]: 'more'
})
wx.showToast({
title: '评论成功'
})
}
}, fail(err) {
console.log('msgSecCheck-err', err)
return
}
});
console.log(reviewlegality)
}
},
打xjpmzd会有一个risky标签,单打xjp就没有
然后看他们用的示例也没问题