测试:添加战斗测试
This commit is contained in:
@@ -138,7 +138,22 @@ export class GachaHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
let userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { hope: hope.map(cur => { return { ...cur, hasGet: false } }) })
|
||||
let userGacha = await UserGachaModel.findByRole(roleId, gachaId);
|
||||
let { hope: userHope = []} = await refreshGacha(gameData.gacha.get(gachaId), userGacha);
|
||||
for (let { id, hid } of hope) {
|
||||
let curHope = userHope.find(cur => cur.id == id);
|
||||
if(curHope) {
|
||||
if(curHope.hasGet) {
|
||||
continue;
|
||||
} else {
|
||||
curHope.hid = hid;
|
||||
curHope.hasGet = false;
|
||||
}
|
||||
} else {
|
||||
userHope.push({ id, hid, hasGet: false })
|
||||
}
|
||||
}
|
||||
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { hope: userHope });
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
gachaId,
|
||||
|
||||
@@ -256,6 +256,8 @@ export class ShopHandler {
|
||||
} else if (type == TASK_FUN_TYPE.ACHIEVEMENT) {
|
||||
await UserTaskModel.updateInfo(roleId, { achievementBox: [], achievementPoint: 0 });
|
||||
userTask = await removeHistoryTask(roleId, type, new Date(nowSeconds() * 1000 + 86400000));
|
||||
} else if (type == TASK_FUN_TYPE.PVP) {
|
||||
userTask = await removeHistoryTask(roleId, type, new Date(nowSeconds() * 1000 + 86400000));
|
||||
}
|
||||
|
||||
let curTask = await getCurTask(roleId, session);;
|
||||
|
||||
@@ -21,9 +21,9 @@ export async function getDailyBattleList(role: RoleType) {
|
||||
let dicDaily = gameData.daily;
|
||||
|
||||
let result = new Array();
|
||||
for(let {dailyType: type, name, timesPerDay, timesCanBuy } of dicDaily) {
|
||||
for(let {dailyType: type, 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 wars: {battleId: number, cost: number, star: number, status: number}[] = new Array();
|
||||
let dicDailyWar = gameData.dailyWarByType.get(type);
|
||||
for(let dic of dicDailyWar) {
|
||||
let war = getDailyWarStatus(dic, warStar);
|
||||
@@ -31,7 +31,7 @@ export async function getDailyBattleList(role: RoleType) {
|
||||
}
|
||||
let checkDailyResult = await getDailyNum(refreshResult, timesPerDay, timesCanBuy);
|
||||
result.push({
|
||||
type, name, ...checkDailyResult,
|
||||
type, ...checkDailyResult,
|
||||
wars
|
||||
});
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export async function getDailyBattleList(role: RoleType) {
|
||||
}
|
||||
|
||||
function getDailyWarStatus(dicDailyWar: DicWar, warStar: WarStar[]) {
|
||||
let {war_id, cost, gk_name, previousGk } = dicDailyWar;
|
||||
let {war_id, cost, previousGk } = dicDailyWar;
|
||||
let status = 0, star = 0;
|
||||
let curBattle = warStar.find(cur => cur.id == war_id);
|
||||
if(curBattle) {
|
||||
@@ -58,7 +58,7 @@ function getDailyWarStatus(dicDailyWar: DicWar, warStar: WarStar[]) {
|
||||
}
|
||||
}
|
||||
return {
|
||||
battleId: war_id, cost, star, status, name: gk_name
|
||||
battleId: war_id, cost, star, status
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user