初始:修复提前初始远征数据bug

This commit is contained in:
luying
2021-06-24 15:18:41 +08:00
parent de89b01886
commit bdd7edaeaf
6 changed files with 28 additions and 21 deletions
@@ -33,6 +33,7 @@ export class ExpeditionBattleHandler {
let roleName = session.get('roleName'); let roleName = session.get('roleName');
let res = await getExpeditionStatus(roleId, roleName); let res = await getExpeditionStatus(roleId, roleName);
if(!res) return resResult(STATUS.ROLE_IS_NOT_INIT);
return resResult(STATUS.SUCCESS, res); return resResult(STATUS.SUCCESS, res);
} }
@@ -90,7 +90,7 @@ export class EntryHandler {
checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SUM, role); checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SUM, role);
checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SERIES, role); checkTaskWithRole(serverId, role.roleId, self.app.get('serverId'), role.funcs, TASK_TYPE.LOGIN_SERIES, role);
// 推送数据 // 推送数据
pushData(role, session); if(role.hasInit) pushData(role, session);
role['heros'] = heros; role['heros'] = heros;
role['equips'] = equips; role['equips'] = equips;
@@ -20,6 +20,7 @@ import { checkTaskWithHero, checkTask, checkTaskWithArgs, checkActivityTask } fr
import { getGoldObject, getCoinObject } from '../../../pubUtils/itemUtils'; import { getGoldObject, getCoinObject } from '../../../pubUtils/itemUtils';
import { RScriptRecordModel } from '../../../db/RScriptRecord'; import { RScriptRecordModel } from '../../../db/RScriptRecord';
import { checkPvp } from '../../../services/pvpService'; import { checkPvp } from '../../../services/pvpService';
import { pushData } from '../../../services/connectorService';
export default function (app: Application) { export default function (app: Application) {
return new RoleHandler(app); return new RoleHandler(app);
@@ -63,6 +64,7 @@ export class RoleHandler {
await RScriptRecordModel.setScript(roleId, battleId, warInfo.warType, 2, SCRIPT.SCRIPT_NAME); await RScriptRecordModel.setScript(roleId, battleId, warInfo.warType, 2, SCRIPT.SCRIPT_NAME);
await checkPvp(role); await checkPvp(role);
return resResult(STATUS.SUCCESS, { return resResult(STATUS.SUCCESS, {
roleId, roleName, heroes roleId, roleName, heroes
}) })
+1 -1
View File
@@ -51,7 +51,7 @@ export async function pushData(role: RoleType, session: FrontendOrBackendSession
modules.push('auction', 'train', 'boss', 'wishPool', 'guildActivity', 'donate'); modules.push('auction', 'train', 'boss', 'wishPool', 'guildActivity', 'donate');
} }
let notIncludeModule: string[] = []; let notIncludeModule: string[] = [];
if (pushType == 'refresh') { if (pushType == 'refresh') { // 每天5点刷新的时候不推送
notIncludeModule = ['rank', 'mail', 'school', 'auction', 'train', 'chat', 'battle']; notIncludeModule = ['rank', 'mail', 'school', 'auction', 'train', 'chat', 'battle'];
} }
+22 -19
View File
@@ -18,6 +18,9 @@ import { ExpeditionRecordModel } from '../db/ExpeditionRecord';
* @param roleName * @param roleName
*/ */
export async function getExpeditionStatus(roleId: string, roleName: string) { export async function getExpeditionStatus(roleId: string, roleName: string) {
// 重置次数
let role = await RoleModel.findByRoleId(roleId);
if(!role.hasInit) return false
// 获取远征关卡状态 // 获取远征关卡状态
let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId); let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId);
if (!expeditionRecord) { // 首次新建一条记录 if (!expeditionRecord) { // 首次新建一条记录
@@ -37,8 +40,6 @@ export async function getExpeditionStatus(roleId: string, roleName: string) {
curLv = expeditionWarRecord[expeditionWarRecord.length - 1].expeditionId; curLv = expeditionWarRecord[expeditionWarRecord.length - 1].expeditionId;
} }
// 重置次数
let role = await RoleModel.findByRoleId(roleId);
let curTime = new Date(); let curTime = new Date();
let { resetCnt } = await getResetRemainCnt(curTime, roleId, role); let { resetCnt } = await getResetRemainCnt(curTime, roleId, role);
@@ -145,23 +146,25 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
let hero = heroes[heroIndex]; let hero = heroes[heroIndex];
if(hero) { if(hero) {
let h = <HeroType>hero.hero; let h = <HeroType>hero.hero;
let { star, lv, attr: heroAttrs, ce } = h; if(h) {
let dicHero = gameData.hero.get(hero.actorId); let { star, lv, attr: heroAttrs, ce } = h;
let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs); let dicHero = gameData.hero.get(hero.actorId);
let heroInfo = { let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs);
actorId: hero.actorId, let heroInfo = {
actorName: dicHero.name, actorId: hero.actorId,
skill:0, actorName: dicHero.name,
seid:'&', skill:0,
star, seid:'&',
spine: 0, star,
attribute: newAttribute, spine: 0,
lv, attribute: newAttribute,
ce lv,
}; ce
};
enemyObj.enemies.push({...json, ...heroInfo});
heroIndex ++; enemyObj.enemies.push({...json, ...heroInfo});
heroIndex ++;
}
} }
} }
} }
+1
View File
@@ -220,6 +220,7 @@ export const STATUS = {
REWARD_HAS_RECEIVED: { code: 30003, simStr: '奖励已领取' }, REWARD_HAS_RECEIVED: { code: 30003, simStr: '奖励已领取' },
NOT_CONSUME_GOODS: { code: 30004, simStr: '非消耗品' }, NOT_CONSUME_GOODS: { code: 30004, simStr: '非消耗品' },
AP_IS_FULL: { code: 30005, simStr: '满体力不可使用道具' }, AP_IS_FULL: { code: 30005, simStr: '满体力不可使用道具' },
ROLE_IS_NOT_INIT: { code: 30006, simStr: '玩家未初始化' },
// 武将养成通用 30100 - 30199 // 武将养成通用 30100 - 30199