折腾了好几遍一直提示:VM81:1 Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 53d8b83f-d8f8-11e9-b940-525400dee61a, cloud function service error code -504002, error message errCode: -1 unknown error | errMsg: parameter.data should be object instead of undefined;; at cloud.callFunction api;
求助,各位大神!!谢谢!
云服务器代码
// 云函数入口文件
const cloud = require(‘wx-server-sdk’)
cloud.init()
const db = cloud.database()
const Balancesconn = db.collection(‘Parea’)
exports.main=async(event,context)=>{
return await Balancesconn.add({
Pareacode: “1811893”,
Pareaname: “秦淮区”
})
}
云客户端代码
const app = getApp()
const db = wx.cloud.database()
const Balancesconn = db.collection(‘Parea’)
var util = require(’…/…/utils/util.js’);
Page({
data: {
motto: ‘Hello World’,
userInfo: {},
cruserInfo:{},
arr:[],
employee: ‘’,
parea: ‘’,
hasUserInfo: false,
canIUse: wx.canIUse(‘button.open-type.getUserInfo’),
Balancess:[]
},
//事件处理函数
UserAdd: function (e) {
wx.cloud.callFunction({
// 云函数名称
name: ‘Balances’,
// 传给云函数的参数
})
.then(res => {
console.log(res)
})
.catch(console.error)
}
})