图片审查接口传huang图也返回ok?
发布于 5 年前 作者 mengming 9661 次浏览 来自 官方Issues

调用imgSecCheck传黄图也返回ok

// 云函数入口文件
const cloud = require('wx-server-sdk')
 
cloud.init()
 
// 云函数入口函数
exports.main = async(event, context) => {
  const {
    value
  } = event;
  try {
    const res = await cloud.openapi.security.imgSecCheck({
      media: {
        contentType: 'image/jpg',
        value: Buffer.from(value)
      }
    })
    return res;
  } catch (err) {
    return err;
  }
}
wx.cloud.init({})
        wx.cloud.callFunction({
          name: "imgseccheck",
          data: {
            value: buffer.data
          }
        }).then(
          imgRes => {
            console.log(imgRes)
            if (imgRes.result.errorCode == "87014") {
              wx.showToast({
                title: '图片含有违法违规内容',
                icon: 'none',
                duration: 1000,
              })
              setTimeout(function() {
                wx.navigateBack()
              }, 1000)
              return
            } else {
              //图片正常
 
            }
          }
        )
2 回复

关于内容安全监测测试内容的问题,可以先自行确认以下问题:

1、是否采用post请求方式

2、是否已经把unicode转为utf-8  

(参考链接:https://www.jb51.net/article/70251.htm

3、内容安全监测主要是覆盖涉政,色情,违法这几类

图片看一下?

回到顶部