- 【求助】报错:查询参数对象值不能均为undefined?
云函数端代码如下 app.router('detail', async(ctx, next) => { let blogId = event.blogId //从云数据库中取到对应博客信息 // 详情查询 let detail = await blogCollection.where({ _id: blogId }).get().then((res) => { return res.data //获取到的博客数据储存在data中 }) // 评论查询 const countResult = await blogCollection.count() //查询数据总数 const total = countResult.total let commentList = {data: []} if (total > 0) { const batchTimes = Math.ceil(total / MAX_LIMIT) //要查询的次数,ceil为向上取整 const tasks = [] for (let i = 0; i < batchTimes; i++) { let promise = db.collection('blog-comment').skip(i * MAX_LIMIT) .limit(MAX_LIMIT).where({ blogId //要查询的索引为博客ID }).orderBy('createTime', 'desc').get() //通过get得到想要的结果 tasks.push(promise) } if (tasks.length > 0) { commentList = (await Promise.all(tasks)).reduce((acc, cur) => { //累加器 return { data: acc.data.concat(cur.data) } }) } } ctx.body = { //将获取到的信息返回到前台 commentList, detail, } }) 调用端代码如下 data: { blog: {}, commentList: [], blogId: '' }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { // console.log(options) this.setData({ blogId:options.blogId }) this._getBlogDetail() }, _getBlogDetail(blogId) { wx.showLoading({ title: '加载中', mask: true, }) wx.cloud.callFunction({ name: 'blog', data: { blogId: this.data.blogId, $url: 'detail', } }).then((res) => { let commentList = res.result.commentList.data for(let i = 0,len = commentList.length;i<len;i++){ commentList[i].createTime = formatTime(new Date(commentList[i].createTime)) } this.setData({ commentList, blog:res.result.detail[0], }) wx.hideLoading() console.log(res) }) }, 报错:cloud function service error code -504002, error message 查询参数对象值不能均为undefined 初学者实在是搞不定这个错误了,百度上也找不到对应的解决方法,求助各位大佬了
2020-04-28 - 这个错误是由于引起的呢->查询参数对象值不能均为undefined?
云函数: app.router('detail', async(ctx, next) => { let blogId = event.blogId // 详情查询 let detail = await blogCollection.where({ _id: blogId }).get().then((res) => { return res.data }) // 评论查询 const countResult = await blogCollection.count() const total = countResult.total let commentList = { data: [] } if (total > 0) { const batchTimes = Math.ceil(total / MAX_LIMIT) const tasks = [] for (let i = 0; i < batchTimes; i++) { let promise = db.collection('blog-comment').skip(i * MAX_LIMIT) .limit(MAX_LIMIT).where({ blogId }).orderBy('createTime', 'desc').get() tasks.push(promise) } if (tasks.length > 0) { commentList = (await Promise.all(tasks)).reduce((acc, cur) => { return { data: acc.data.concat(cur.data) } }) } } ctx.body = { / commentList, detail, } }) 调用端函数: onLoad: function (options) { console.log(options) this._getBlogDetail(options.blogId) }, _getBlogDetail(blogId){ wx.showLoading({ title: '加载中', true:true, }) wx.cloud.callFunction({ name :'blog', data:{ blogId, $url:'detail', } }).then((res) =>{ wx.hideLoading() console.log(res) }) },
2020-04-27 - 报错:Cannot read property 'createTime' of null?
app.router('detail', async(ctx,next)=>{ let blogId = event.blogId //从云数据库中取到对应博客信息 //详情查询 let detail = await blogCollection.where({ _id:blogId }).get().then((res)=>{ return res.data //获取到的博客数据储存在data中 }) //评论查询 const countResult = await blogCollection.count() //查询共有多少条数据 const total = countResult.total let commentList ={ data:[] } if(total > 0){ const batchTimes = Math.ceil(total/MAX_LIMIT) //要查询的次数,ceil为向上取整 const tasks = [] for(let i = 0;i<batchTimes;i++){ let promise = blogCollection.skip(i * MAX_LIMIT) .limit(MAX_LIMIT).where({ blogId //要查询的索引为博客ID }).orderBy('createTime' , 'desc').get() //通过get得到想要的结果 tasks.push(promise) } if(tasks.length > 0){ commentList = (await Promise.all(tasks)).reduce((acc,cur) => { return { data:acc.data.concat(cur.data) } }) } } ctx.body = { //将获取到的信息返回到前台 commentList, detail, }云函数端源代码如上,显示createTime报错,望指教一下
2020-04-27 - 报错:after argument list; at cloud.callFunction api?
直接贴代码,这是云函数端的代码 app.router('detail', async(ctx,next)=>{ let blogId = event.blogId //从云数据库中取到对应博客信息 //详情查询 let detail = await blogCollection.where({ _id:blogId }).get().then((res)=>{ return res.data //获取到的博客数据储存在data中 }) //评论查询 const countResult = await blogCollection.count() //查询共有多少条数据 const total = countResult.total let commentList ={ data:[] } if(total > 0){ const batchTimes = Math.ceil(total/ MAX_LIMIT) //要查询的次数,ceil为向上取整 const tasks = [] for(let i = 0;i<batchTimes;i++){ let promise = blogCollection.skip(i * MAX_LIMIT) .limit(MAX_LIMIT).where({ blogId //要查询的索引为博客ID }).orderBy('createTime' , 'desc').get() //通过get得到想要的结果 tasks.push(promise) } if(tasks.length > 0){ commentList = (await Promise.all(tasks)).reduce((acc,cur) => { return { data:acc.data.concat(cur.data) } }) } } ctx.body = { //将获取到的信息返回到前台 commentList, detail, } }) 这是调用端的函数 onLoad: function (options) { console.log(options) this._getBlogDetail(options.blogId) }, _getBlogDetail(blogId){ wx.showLoading({ title: '加载中', mask:true, }) wx.cloud.callFunction({ name:'blog', data:{ blogId, $url:'detail', } }).then((res) => { wx.hideLoading() console.log(res) }) }, 报错:Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 72f99dfd-8850-11ea-9985-525400f6258f, cloud function service error code -504002, error message missing ) after argument list; at cloud.callFunction api 请问这是什么错误引起的呢?望指导一下!
2020-04-27 - 请问这个问题是什么意思error message limitmust be integer?
错误代码:errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 81397806-822b-11ea-9f36-5254006d15a9, cloud function service error code -504002, error message limitmust be integer Error: limitmust be integer 我在云开发中调用云数据库,数据库中已有了数据,但是在开发者工具的AppData中请求不到数据,并报这个错误,但是相关的 "tcb-router": "^1.1.2", "wx-server-sdk": "^1.8.3" 已经安装成功,请问这应该如何解决
2020-04-19 - 开发者工具无法自动联想补全?
02.2003250,win10,64位 开发者工具无法自动联想输入,就是输入几个字母,自动联想显示一系列的相关内容 已经试了设置中的编辑设置,并重启了2次
2020-04-02