Files
2025-10-22 07:50:31 +08:00

34 lines
980 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
module.exports = {
/**
* 文本违规检测示例
* @url template/openapi/weixin/pub/msgSecCheck 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
let { data = {}, userInfo, util } = event;
let { config, vk , db, _ } = util;
let { uid } = data;
let res = { code : 0, msg : 'ok' };
// 业务逻辑开始-----------------------------------------------------------
let { content } = data;
// 实际业务中content可能是评论的内容等
let msgSecCheckRes = await vk.openapi.weixin.security.msgSecCheck({
content
});
if(msgSecCheckRes.code !== 0){
// 未通过检测
return msgSecCheckRes;
}
// 若通过检测,则继续执行自己的业务
// ...
// ...
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}