红点:修改推送方式
This commit is contained in:
@@ -12,7 +12,7 @@ import { STATUS } from '../../../consts/statusCode';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { RoleModel } from '../../../db/Role';
|
||||
import { RScriptRecordModel } from '../../../db/RScriptRecord';
|
||||
import { updateWarStar, checkBattleHeroes, roleLevelup } from '../../../services/normalBattleService';
|
||||
import { updateWarStar, checkBattleHeroes, roleLevelup, getBattleList } from '../../../services/normalBattleService';
|
||||
import { checkDungeonNum, checkDungeonAndIncrease } from '../../../services/dungeonService';
|
||||
import { switchOnFunc } from '../../../services/funcSwitchService';
|
||||
import { gameData } from '../../../pubUtils/data';
|
||||
@@ -110,40 +110,7 @@ export class NormalBattleHandler {
|
||||
let roleId = session.get('roleId');
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let { warStar } = role;
|
||||
|
||||
let scripts = await RScriptRecordModel.findbyRole(roleId, type);
|
||||
|
||||
let result = []; // 去重
|
||||
for (let { battleId, scriptBefore = '', scriptAfter = '' } of scripts) {
|
||||
|
||||
result.push({
|
||||
battleId,
|
||||
status: 0,
|
||||
star: 0,
|
||||
scriptBefore,
|
||||
scriptAfter
|
||||
});
|
||||
}
|
||||
for (let { id, star, warType } of warStar) {
|
||||
if (warType == type) {
|
||||
let curResult = result.find(cur => cur.battleId == id);
|
||||
if (curResult) {
|
||||
curResult.status = 1;
|
||||
curResult.star = star;
|
||||
} else {
|
||||
result.push({
|
||||
battleId: id,
|
||||
status: 1,
|
||||
star,
|
||||
scriptBefore: '',
|
||||
scriptAfter: ''
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
result = result.sort((a, b) => { return a.battleId - b.battleId });
|
||||
|
||||
let result = await getBattleList(role, type);
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
list: result
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user