feat: 新增合同审查定时任务与积分体系,重构支付模块与余额流水查询

This commit is contained in:
2026-10-14 21:55:23 +08:00
parent 988e2e8853
commit 631e3caa4c
29 changed files with 2008 additions and 862 deletions
@@ -0,0 +1,37 @@
// 获取积分余额
module.exports = {
main: async (event) => {
let { data = {}, userInfo, util } = event;
let { db, _ } = util;
//默认积分500
let amount = 500;
const res = await db.collection('jjx-user-points').doc(userInfo.uid).get();
if (res.data.length === 0) {
// 新用户,自动赠送 500 积分
await db.collection('jjx-user-points').add({
_id: userInfo.uid,
balance: amount,
total_earned: amount,
total_spent: 0,
gift: amount,
update_time: new Date()
});
await db.collection('jjx-points-log').add({
user_id: userInfo.uid,
type: 'earn',
amount: amount,
balance_after: amount,
reason: '新用户注册赠送',
biz_type: 'gift',
_add_time: new Date()
});
return { code: 0, msg: 'ok', data: { balance: amount, total_earned: amount, total_spent: 0, gift: amount } };
}
return { code: 0, msg: 'ok', data: res.data[0] };
}
};