- 云开发中云函数调用失败?
[图片] const cloud = require('wx-server-sdk') cloud.init( { env: cloud.DYNAMIC_CURRENT_ENV, } ) const db = cloud.database(); exports.main = async(event, context) => { console.log(event) const wxContext = cloud.getWXContext(); const _id = event._id; const billData = await db.collection('tb_bill').doc(_id).get(); const bill = billData.data || null; if (bill && bill.wallet && bill.wallet !== "") { const tbWallet = db.collection("tb_wallet"); let wallets = await tbWallet.where({ _openid: wxContext.OPENID, _name: bill.wallet }).get(); if (wallets.data.length > 0) { let wallet = wallets.data[0]; let _balance = wallet._balance - bill.money; let updateRes = await tbWallet.doc(wallet._id).update({ data: { _balance: _balance } }); } } return await db.collection('tb_bill').where({ _id: _id }).remove(); }
2020-11-10 - 小程序Cannot read property '0' of undefined?
小白,不知为啥就这样了[图片][图片] [图片][图片][图片]运行就这样了[图片]
2020-11-02