forked from infinityu/mina-wear-mask
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2. package all images without networking
- Loading branch information
Showing
10 changed files
with
133 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"permissions": { | ||
"openapi": [ | ||
"security.msgSecCheck", | ||
"security.imgSecCheck" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const cloud = require('wx-server-sdk'); | ||
cloud.init(); | ||
exports.main = async (event, context) => { | ||
console.log(event.txt); | ||
const { | ||
value, | ||
txt | ||
} = event; | ||
try { | ||
let msgR = false; | ||
let imageR = false; | ||
//检查 文字内容是否违规 | ||
if (txt) { | ||
msgR = await cloud.openapi.security.msgSecCheck({ | ||
content: txt | ||
}) | ||
} | ||
//检查 图片内容是否违规 | ||
if (value) { | ||
imageR = await cloud.openapi.security.imgSecCheck({ | ||
media: { | ||
header: { | ||
'Content-Type': 'application/octet-stream' | ||
}, | ||
contentType: 'image/png', | ||
value: Buffer.from(value) | ||
} | ||
}) | ||
} | ||
return { | ||
msgR, //内容检查返回值 | ||
imageR //图片检查返回值 | ||
}; | ||
} catch (err) { | ||
// 错误处理 | ||
// err.errCode !== 0 | ||
return err | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.