修复充值经验任务计算,开服狂欢进度,优化dayPay查询

This commit is contained in:
dy 2023-12-18 19:12:51 +08:00
parent af0225005a
commit c8d6f7d433
2 changed files with 6 additions and 5 deletions

View File

@ -31,7 +31,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
call.succ({
...ops,
day: PublicShared.getOpenServerDay(call.conn.gud.cTime),
day: PublicShared.getOpenServerDay(),
taskFinished: taskFinished
});
}
@ -79,7 +79,7 @@ export async function getTaskVal(gud: player, taskTyps: string[]) {
else if (t.indexOf('toDayPay') != -1) {
let daystr = t.split('_')[1] || '1';
let day = Number(daystr);
let zeroTime = PublicShared.getToDayZeroTime(gud.cTime);
let zeroTime = PublicShared.getToDayZeroTime(G.openTime);
val[t] = await PayFun.getPayDaysAllPayNum(
gud.uid,
zeroTime + (day - 1) * 24 * 3600, zeroTime + day * 24 * 3600

View File

@ -478,9 +478,10 @@ export class PayFun {
*
*/
static async getPayDaysAllPayNum(uid: string, sTime: number, eTime: number) {
let logs = await G.mongodb.collection('dayPay').find({uid: uid}).toArray() || [];
logs = logs.filter(log => log.time >= sTime && log.time < eTime);
let logs = await G.mongodb.collection('dayPay').find({
uid: uid,
time: {$gte: sTime, $lt: eTime}
}).toArray() || [];
if (logs.length <= 0) return 0;
return logs.map(log => log.payNum).reduce((a, b) => a + b);