await 对此表达式类型没有影响?
onChangeFlockData: function (e) {
let tempArr = [];
let imgUrls = e.detail.all;
imgUrls.forEach(async(item) => {
tempArr.push(item.url)
if (item.imageSize >= 1048576) {
this.imgInfoCheck(item.url)
} else {
await this.imgSecCheck(item.url)
this.setData({
tempArr: tempArr
console.log("tempArr:::", this.data.tempArr)
imgSecCheck: function (tempUrl) {
wx.showLoading({
mask: true
wx.getFileSystemManager().readFile({
filePath: tempUrl,
encoding: "base64",
success: res => {
console.log(res)
let imgBuffer = res.data
wx.cloud.callFunction({
name: "msgSecCheck",
data: {
type: 'imgSecCheckBuffer', //以buffer方式上传送审
value: imgBuffer,
}).then(res => {
console.log("图片检测结果:", res)
if (res.result.errCode === 87014) {
wx.hideLoading()
wx.showToast({
title: '图片含有违法违规内容',
icon: 'none'
}).catch(err => {
console.log(err)
wx.hideLoading()
wx.showModal({
title: '提示',
content: '图片尺寸过大,请调整图片尺寸',
success(res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
fail: err => {
console.error(err);