抽卡:添加抽卡接口
This commit is contained in:
@@ -8,11 +8,11 @@ import { calAllHeroCe, pushCalPlayerCe, pushCalAllHeroCe } from './playerCeServi
|
||||
import { ItemModel } from '../db/Item';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { pinus } from 'pinus';
|
||||
import { addEquips, addBags, addSkins, addFigure, unlockFigure as pubUnlockFigure, createHero as pubCreateHero } from '../pubUtils/itemUtils';
|
||||
import { addEquips, addBags, addSkins, addFigure, unlockFigure as pubUnlockFigure, createHero as pubCreateHero, createHeroes as pubCreateHeroes } from '../pubUtils/itemUtils';
|
||||
import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { uniq, indexOf, findIndex } from 'underscore';
|
||||
import { HeroModel } from '../db/Hero';
|
||||
import { HeroModel, HeroUpdate } from '../db/Hero';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { Rank } from './rankService';
|
||||
import { pushTaskUpdate } from './taskService';
|
||||
@@ -304,7 +304,34 @@ export async function pushFigureUpdate(roleId: string, sid: string, figureInfo:
|
||||
}
|
||||
}
|
||||
|
||||
export async function createHero(roleId: string, sid: string, serverId: number, heroInfo) {
|
||||
/**
|
||||
* 创建多个武将
|
||||
* @param roleId
|
||||
* @param sid
|
||||
* @param serverId
|
||||
* @param heroInfo
|
||||
*/
|
||||
export async function createHeroes(roleId: string, sid: string, serverId: number, heroInfo: HeroUpdate[]) {
|
||||
let { heroes, role, figureInfo, calHeroResults, calAllHeroResults, taskPushMessage } = await pubCreateHeroes(roleId, heroInfo);
|
||||
|
||||
let r = new Rank(REDIS_KEY.HERO_NUM_RANK, { serverId });
|
||||
await r.setRankWithRoleInfo(roleId, role.heroNum, role.heroNumUpdatedAt, role);
|
||||
|
||||
await pushFigureUpdate(roleId, sid, figureInfo);
|
||||
|
||||
for(let calHeroResult of calHeroResults) {
|
||||
await pushCalPlayerCe(roleId, sid, calHeroResult);
|
||||
}
|
||||
for(let calAllHeroResult of calAllHeroResults) {
|
||||
await pushCalAllHeroCe(roleId, sid, calAllHeroResult);
|
||||
}
|
||||
|
||||
pushTaskUpdate(roleId, sid, null, taskPushMessage);
|
||||
|
||||
return heroes;
|
||||
}
|
||||
|
||||
export async function createHero(roleId: string, sid: string, serverId: number, heroInfo: HeroUpdate) {
|
||||
let { hero, role, figureInfo, calHeroResult, calAllHeroResult, taskPushMessage } = await pubCreateHero(roleId, heroInfo);
|
||||
|
||||
let r = new Rank(REDIS_KEY.HERO_NUM_RANK, { serverId });
|
||||
@@ -312,7 +339,7 @@ export async function createHero(roleId: string, sid: string, serverId: number,
|
||||
|
||||
await pushFigureUpdate(roleId, sid, figureInfo);
|
||||
|
||||
hero = await pushCalPlayerCe(roleId, sid, calHeroResult);
|
||||
await pushCalPlayerCe(roleId, sid, calHeroResult);
|
||||
await pushCalAllHeroCe(roleId, sid, calAllHeroResult);
|
||||
|
||||
pushTaskUpdate(roleId, sid, null, taskPushMessage);
|
||||
|
||||
Reference in New Issue
Block a user