优化:任务中的活动读内存
This commit is contained in:
@@ -15,6 +15,7 @@ import { reduceCe, resResult } from "./util";
|
||||
import { calculatetopLineup, } from "./playerCe";
|
||||
import { GuildModel, GuildType } from "../db/Guild";
|
||||
import { PvpDefenseModel } from "../db/PvpDefense";
|
||||
import { ActivityModelType } from "../db/Activity";
|
||||
|
||||
// 储存在内存中的初始数据
|
||||
export function getInitRoleInfo() {
|
||||
@@ -219,7 +220,6 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
this.addRoleUpdateParam({ frames, heads, spines });
|
||||
// 更新战力
|
||||
await this.saveCeToDb();
|
||||
await this.clearTask();
|
||||
}
|
||||
|
||||
// 创建初始账号时候的初始
|
||||
@@ -233,10 +233,9 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
heroeInfos.push({ ...heroInfo, skins, _id: new HeroModel()._id});
|
||||
}
|
||||
this.resultHeroes = await HeroModel.insertHeroes(this.roleId, this.roleName, this.serverId, heroeInfos);
|
||||
await this.clearTask();
|
||||
}
|
||||
|
||||
private async clearTask() {
|
||||
public async clearTask(activitiesTypeMap: ActivityModelType[]) {
|
||||
// 任务
|
||||
console.log('****** checkTask before', Date.now())
|
||||
let m1 = await checkTask(this.roleId, TASK_TYPE.HERO_NUM, this.heroNum, true, {});
|
||||
@@ -247,8 +246,8 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
console.log('****** checkTask after', Date.now())
|
||||
//成长任务
|
||||
console.log('****** accomplishTask before', Date.now())
|
||||
let mm1 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_NUM, this.heroNum)
|
||||
let mm2 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_QUALITY, this.heroNum, { heroes: this.resultHeroes })
|
||||
let mm1 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_NUM, this.heroNum, null, activitiesTypeMap)
|
||||
let mm2 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_QUALITY, this.heroNum, { heroes: this.resultHeroes }, activitiesTypeMap)
|
||||
console.log('****** accomplishTask after', Date.now())
|
||||
this.activityTaskPushMessage.push(...mm1, ...mm2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user