我在进行图像鉴黄测试是报错,下面是我的代码和云端的报错,在网上找了好久没有找到原因,帮忙看下:
const cloudAppId = "XXXX";
const secretId = "XXXXX";
const secretKey = "XXXXX";
const TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appsecretId;
const CHECK_URL = "https://api.weixin.qq.com/wxa/msg_sec_check?access_token=";
function getImageUrl(fileId)
{
const baseUrl = "https://636c-cloudde-5c0a91-1300515261.tcb.qcloud.la";
const baseFileId = "cloud://cloudde-5c0a91.636c-cloudde-5c0a91-1300515261";
const path = fileId.replace(baseFileId, baseUrl);
return path;
};
// 云函数入口函数
exports.main = async (event, context) => {
console.log(event);
const content = event.content;
const location = event.location;
const author = event.author;
const images = event.images;
const imageUrls = [];
images.forEach((value, index)=>{
const imageUrl = getImageUrl(value)
imageUrls.push(imageUrl);
});
//图片鉴黄
console.log(cloudAppId);
console.log("????????");
const imageclient = new ImageClient({cloudAppId, secretId, secretKey});
const imageResp = await imageclient.imgPornDetect({
data: {
url_list: imageUrls
}
})
console.log('------------------');
console.log(imageResp.body);
console.log("=============-")
//文字处理
………………
}
云端报错:
2019-11-18T15:41:32.611Z XXXXX
2019-11-18T15:41:32.611Z ????????
2019-11-18T15:41:32.669Z ------------------
2019-11-18T15:41:32.669Z {"code":3,"message":"don't find appid or appid is illegal"}
谢谢
相似问题