排行榜:修复一键领取

This commit is contained in:
luying
2021-05-08 19:42:24 +08:00
parent 78e3c26a7a
commit 082266493a
4 changed files with 39 additions and 17 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { HANG_UP_CONSTS, ROLE_TERAPH, ROLE_SELECT, ABI_TYPE, TIME_OUTPUT_TYPE } from './../consts';
import { HANG_UP_CONSTS, ROLE_TERAPH, ROLE_SELECT, ABI_TYPE } from './../consts';
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, Ref, mongoose } from '@typegoose/typegoose';
import User from './User';
@@ -641,8 +641,8 @@ export default class Role extends BaseModel {
return roles[Math.floor(roles.length / 2)]
}
public static async receiveRankReward(roleId: string, id: number) {
const role: RoleType = await RoleModel.findOneAndUpdate({ roleId, rankReceived: { $nin: [id] } }, { $push: { rankReceived: id } }, { new: true }).lean();
public static async receiveRankReward(roleId: string, ids: number[]) {
const role: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $push: { rankReceived: { $each: ids } } }, { new: true }).lean();
return role;
}
}
@@ -1,4 +1,4 @@
import { TASK_TYPE, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
import { ACTIVITY_RESOURCES_TYPE } from '../../consts';
import { ActivityModelType } from '../../db/Activity';
import { ActivityThirtyDaysModelType } from '../../db/ActivityThirtyDays';
import { ActivityThirtyDaysPointRewardModelType } from '../../db/ActivityThirtyDaysPointReward';
+1 -1
View File
@@ -4,7 +4,7 @@ import { HeroModel, HeroType } from '../db/Hero';
import fs = require('fs');
import path = require('path');
import { HERO_CE_RATIO, ABI_STAGE, GACHA_TO_FLOOR, TIME_OUTPUT_TYPE, REFRESH_TIME } from '../consts';
import { HERO_CE_RATIO, ABI_STAGE, GACHA_TO_FLOOR, REFRESH_TIME } from '../consts';
import { findIndex } from 'underscore';
import { getTimeFunM } from './timeUtil';