寻宝:修改奖励

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
+4 -1
View File
@@ -48,6 +48,8 @@ export class RoleStatus {
@prop({ required: true })
roleName: string;
@prop({ required: true })
sid: string;
@prop({ required: true })
guildCode: string;
@prop({ required: true })
isCap: boolean;
@@ -96,7 +98,7 @@ export class RoleStatus {
@prop({ required: true, default: 0 })
frdRatio: number = 0;
constructor(role: RoleUpdate, isCap: boolean, isFrd: boolean, heroes: ComRoleStatusHero[] = [], isRobot = false) {
constructor(role: RoleUpdate, sid: string, isCap: boolean, isFrd: boolean, heroes: ComRoleStatusHero[] = [], isRobot = false) {
if(role) {
this.roleId = role.roleId||'';
this.roleName = role.roleName||'';
@@ -107,6 +109,7 @@ export class RoleStatus {
this.topLineupCe = role.topLineupCe||0;
this.lv = role.lv||1;
}
this.sid = sid;
this.isCap = isCap;
this.totalDmg = 0;
this.isFrd = isFrd;
+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