- 当前 Bug 的表现(可附上截图)
不能登录云平台,错误为
登录失败关闭
{“base_resp”:{“ret”:-1,“errmsg”:""}}
- 预期表现
查询数据库中的相关数据
- 复现路径
使用代码进行一次库操作之后,再用开发工具直接登录
- 提供一个最简复现 Demo
const cloud = require('wx-server-sdk') cloud.init({ env: 'wxcloudtest-399ef4' }) // 云函数入口函数 exports.main = async (event, context) => { const db = cloud.database() return db.collection('menu').where({ _id: event._id, }).get().then(res => { if (res.data.length == 0) { return db.collection('menu').add({ data: { _id: 123456789, startTime: 123456789, endTime: 987654321, startDate: '2018-01-01', endDate: '2018-01-08', title: 'lllllll', fileID: 'llllllll', filePath: 'llllllll' } }).then(res => { return { errno: '0', errmsg: '写入menu成功', res: res } }).catch(rej => { return rej }) } else { return db.collection('menu').where({ _id: event._id, }).update({ data: { endTime: 987654321, endDate: '2018-01-08', title: 'lllllll', fileID: 'llllllll', filePath: 'llllllll' } }) .then(res => { return { errno: '0', errmsg: '修改menu成功', res: res } }) .catch(rej => { return rej }) } }) }
|