珊瑚图片内容安全报错如何解决?
调用方式1:
// 发表动态
app.router('publish-feed', async (ctx, next) => {
const wxContext = cloud.getWXContext()
var openid = wxContext.OPENID
let feedPublish = await feedCollection.add({
data: {
sender_openid: openid,
...event.newMoment,
create_time: db.serverDate()
}
})
// 调用珊瑚图片内容安全
try {
var result = await cloud.openapi.serviceMarket.invokeService({
service: "wxee446d7507c68b11",
api: "imgSecCheck",
data: {
"Action": "ImageModeration",
"Scenes": ["PORN", "TERRORISM", "POLITICS"],
"ImageUrl": "http://mat1.gtimg.com/pingjs/ext2020/qqindex2018/dist/img/qq_logo_2x.png",
"ImageBase64": "",
"Config": "",
"Extra": ""
},
clientMsgId: 'monster-wx139544cf7cfe7adb'
})
console.log("security.imgSecCheck result: ", result)
} catch (error) {
console.log("security.imgSecCheck error: ", error)
}
ctx.body = feedPublish
})
报错1:
2020-12-22T17:41:23.113Z security.imgSecCheck error: { Error: errCode: 9301002 | errMsg: openapi.serviceMarket.invokeService:fail call api service failed request id:[MLw4UqiTQMb50Lfljj-zHnQlUxNEHNO9Vj2QZgZrgQ9gnl5D3xznTu8d0uj7kpeNcJ4] rid: 5fe22fc2-4dbd9c6c-4f0bfdf0
at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2227:31)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
errCode: 9301002,
errMsg: 'openapi.serviceMarket.invokeService:fail call api service failed request id:[MLw4UqiTQMb50Lfljj-zHnQlUxNEHNO9Vj2QZgZrgQ9gnl5D3xznTu8d0uj7kpeNcJ4] rid: 5fe22fc2-4dbd9c6c-4f0bfdf0' }
END RequestId:e78e03f9-447c-11eb-b00b-525400fff70d
Report RequestId:e78e03f9-447c-11eb-b00b-525400fff70d Duration:421ms Memory:256MB MemUsage:43.890625MB
调用方式2:
// 发表动态
app.router('publish-feed', async (ctx, next) => {
const wxContext = cloud.getWXContext()
var openid = wxContext.OPENID
let feedPublish = await feedCollection.add({
data: {
sender_openid: openid,
...event.newMoment,
create_time: db.serverDate()
}
})
console.log("event.newMoment: ", event.newMoment)
// 调用珊瑚图片内容安全
try {
var result = await cloud.openapi.serviceMarket.invokeService({
service: "wxee446d7507c68b11",
api: "imgSecCheck",
data: {
Action: "ImageModeration",
Scenes: ["PORN", "TERRORISM", "POLITICS"],
ImageUrl: "http://mat1.gtimg.com/pingjs/ext2020/qqindex2018/dist/img/qq_logo_2x.png",
ImageBase64: "",
Config: "",
Extra: ""
},
clientMsgId: 'monster-wx139544cf7cfe7adb'
})
console.log("security.imgSecCheck result: ", result)
} catch (error) {
console.log("security.imgSecCheck error: ", error)
}
ctx.body = feedPublish
})
报错2:
2020-12-22T17:47:48.106Z security.imgSecCheck error: { Error: errCode: 9301002 | errMsg: openapi.serviceMarket.invokeService:fail call api service failed request id:[MLwXfaQ54JUhmjy5S44tPFdxfcBiD0aGKLktBqRGTd_aZc-NmJeZ-U4QVxhn-xvbr7A] rid: 5fe23143-5b2db01a-0b2644d6
at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2227:31)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
errCode: 9301002,
errMsg: 'openapi.serviceMarket.invokeService:fail call api service failed request id:[MLwXfaQ54JUhmjy5S44tPFdxfcBiD0aGKLktBqRGTd_aZc-NmJeZ-U4QVxhn-xvbr7A] rid: 5fe23143-5b2db01a-0b2644d6' }
END RequestId:cd950d64-447d-11eb-8b0a-5254007c2bc0
Report RequestId:cd950d64-447d-11eb-8b0a-5254007c2bc0 Duration:516ms Memory:256MB MemUsage:45.132812MB