// 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() const db = cloud.database() const _ = db.command // 云函数入口函数 exports.main = async (event, context) => { const { OPENID } = cloud.getWXContext() if (event.msg_id) { const questions = await db.collection('question') .aggregate() .match({ msg_id: event.msg_id, answer: _.neq('') }) .sort({ rank: 1 }) .skip(event.page_token) .limit(event.page_size) .end() return { list: questions.list, next_page_token: event.page_token + questions.list.length, status: 'OK' } } }