红点:修改推送方式
This commit is contained in:
@@ -5,9 +5,53 @@
|
||||
import DailyRecord, { DailyRecordModel } from '../db/DailyRecord';
|
||||
import { resResult } from '../pubUtils/util';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
|
||||
/**
|
||||
* 获取全部每日关卡列表
|
||||
* @param role
|
||||
*/
|
||||
export async function getDailyBattleList(role: RoleType) {
|
||||
let { roleId, warStar } = role;
|
||||
let dicDaily = gameData.daily;
|
||||
|
||||
let result = new Array();
|
||||
for(let {dailyType: type, name, timesPerDay, timesCanBuy } of dicDaily) {
|
||||
let refreshResult = await DailyRecordModel.refreshRecord(roleId, type);
|
||||
let wars: {battleId: number, cost: number, star: number, status: number, name: string}[] = new Array();
|
||||
let dicDailyWar = gameData.dailyWarByType.get(type);
|
||||
for(let {war_id, cost, gk_name, previousGk } of dicDailyWar) {
|
||||
let status = 0, star = 0;
|
||||
let curBattle = warStar.find(cur => cur.id == war_id);
|
||||
if(curBattle) {
|
||||
status = 2;
|
||||
star = curBattle.star;
|
||||
} else {
|
||||
if (previousGk) {
|
||||
let preBattleRecord = warStar.find(cur => cur.id == previousGk);
|
||||
if(preBattleRecord) {
|
||||
status = 1;
|
||||
} else {
|
||||
status = 0;
|
||||
}
|
||||
} else {
|
||||
status = 1;
|
||||
}
|
||||
}
|
||||
wars.push({
|
||||
battleId: war_id, cost, star, status, name: gk_name
|
||||
});
|
||||
}
|
||||
let checkDailyResult = await getDailyNum(refreshResult, timesPerDay, timesCanBuy);
|
||||
result.push({
|
||||
type, name, ...checkDailyResult,
|
||||
wars
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 检查每日本次数checkBattle使用
|
||||
export async function checkDaily(roleId: string, battleId: number, inc: number) {
|
||||
let dailyWar = gameData.war.get(battleId);
|
||||
|
||||
Reference in New Issue
Block a user