- subscribeMessage.send errCode: -504002报错?
[图片]Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: TypeError: Do not know how to serialize a BigInt 调用订阅消息后测试消息可以发送成功,但是返回值报错Do not know how to serialize a BigInt,无法判断是否发送成功。 2022-05-01 解决方法:云函数的返回值不要返回result,直接返回result.errCode,就不会报错。原因是直接返回result被序列化导致报错(其实就是bug),所以返回result.errCode足以用于判断!
2022-05-01 - 发布图片,上传图片个数
各位前辈大家好,我想请问如何在这段代码中设置上传图片的最少个数,比如最少上传一张图片否则不能发布内容并且做出提示 chooseImage: function () { var that = this; wx.chooseImage({ count: 9 - that.data.cloudImgList.length, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success(res) { console.log(res.tempFilePaths) // 上传图片 that.data.tempImgList = res.tempFilePaths that.uploadImages() }, }) }, uploadImages() { var that = this; for (var i = 0; i < this.data.tempImgList.length; i++) { wx.cloud.uploadFile({ cloudPath: `actionImages/${Math.random()}_${Date.now()}.${this.data.tempImgList[i].match(/\.(\w+)$/)[1]}`, filePath: this.data.tempImgList[i], success(res) { console.log(res.fileID) that.data.cloudImgList.push(res.fileID) that.setData({ cloudImgList: that.data.cloudImgList }) } }) } },
2021-01-25