寻宝:修改奖励

This commit is contained in:
luying
2022-07-27 19:58:17 +08:00
parent e1dc6307d2
commit f65b8b8545
5 changed files with 39 additions and 24 deletions
+7
View File
@@ -45,6 +45,13 @@ export default class FriendPoint extends BaseModel {
return rec;
}
public static async updateComBattleCntToday(roleId: string, roleName: string, cntInc: number, maxPerDay: number, type: number, lean = true) {
const curTime = getZeroPointD();
// 当 oldCnt + cntInc > maxPerDay 时需计算实际可以获得的点数:cntInc - (newCnt - maxPerDay)
const rec: FriendPointType = await FriendPointModel.findOneAndUpdate({roleId, roleName, createdAt: {$gte: curTime}, comBattleCnt: {$lt: maxPerDay}, type}, {$inc: {comBattleCnt: cntInc}}, {upsert: true, new: true}).lean(lean);
return rec;
}
/**
* @description 某个类型当天情谊点获取情况
* @static