累计充值

This commit is contained in:
dy 2023-12-30 16:32:26 +08:00
parent a5da9e1522
commit 6fd4e79fbe
4 changed files with 47 additions and 27 deletions

View File

@ -22,11 +22,14 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
{upsert: true}
);
}
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
payNum = payNum - (db.round || 0) * R.compose(R.sum(), R.map(i => i.total))(_hdinfo.data.tasks)
call.succ({
sTime: sTime,
recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo
payNum: payNum,
hdinfo: _hdinfo,
round: db.round || 0
});
}

View File

@ -21,14 +21,22 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
payNum = payNum - (db.round || 0) * R.compose(R.sum(), R.map(i => i.total))(_hdinfo.data.tasks)
if (payNum < conf.total) return call.error('', {code: -3});
await PlayerFun.sendPrize(call, conf.prize);
G.mongodb.cEvent(_dbType).updateOne(
if (db.recIndex.length + 1 >= _hdinfo.data.tasks.length) {
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$set: {recIndex: []}, $inc: {round: 1}}
);
} else {
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$push: {recIndex: call.req.index}}
);
}
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({

View File

@ -16,4 +16,6 @@ export type ResOpen = {
payNum: number;
/**活动信息 */
hdinfo: ReqAddHuoDong;
/** 当前领取轮次 */
round: number
};

View File

@ -10263,6 +10263,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
"type": "Reference",
"target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong"
}
},
{
"id": 4,
"name": "round",
"type": {
"type": "Number"
}
}
]
},