//查询积分流水 module.exports = { main: async (event) => { let { data = {}, userInfo, util } = event; let { vk, db, _ } = util; const { pageIndex = 1, pageSize = 50, biz_type } = data; console.log('getLog uid:', userInfo.uid); // 先查全部看看有没有数据 const allRes = await db.collection('jjx-points-log').limit(5).get(); console.log('getLog all data count:', allRes.data.length); if (allRes.data.length > 0) { console.log('getLog first record:', JSON.stringify(allRes.data[0])); } const where = { user_id: userInfo.uid }; if (biz_type) where.biz_type = biz_type; const countRes = await db.collection('jjx-points-log').where(where).count(); console.log('getLog filtered count:', countRes.total); const listRes = await db.collection('jjx-points-log') .where(where) .orderBy('_add_time', 'desc') .skip((pageIndex - 1) * pageSize) .limit(pageSize) .get(); return { code: 0, msg: 'ok', data: { total: countRes.total, rows: listRes.data } }; } };