31 lines
718 B
JavaScript
31 lines
718 B
JavaScript
//查询积分流水
|
|
module.exports = {
|
|
main: async (event) => {
|
|
let { data = {}, userInfo, util } = event;
|
|
let { db, _ } = util;
|
|
const { pageIndex = 1, pageSize = 20, type } = data;
|
|
|
|
const where = { user_id: userInfo.uid };
|
|
if (type) where.type = type; // 可选筛选 earn/spend
|
|
|
|
const countRes = await db.collection('jjx-points-log').where(where).count();
|
|
|
|
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
|
|
}
|
|
};
|
|
}
|
|
};
|
|
|