fix bug 远征显示下一关等
This commit is contained in:
@@ -67,7 +67,7 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
ce: number; // 敌军战力
|
||||
|
||||
public static async getRecordByCode(expeditionCode: string, lean = true) {
|
||||
const result = await ExpeditionWarRecordModel.find({ expeditionCode }).select('expeditionId battleId battleCode battleStatus ce').sort({expeditionId: 1}).lean(lean);
|
||||
const result = await ExpeditionWarRecordModel.find({ expeditionCode, battleStatus: {$gte: 0} }).select('expeditionId battleId battleCode battleStatus ce').sort({expeditionId: 1}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -76,14 +76,19 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async saveRecord(expeditionCode: string, expeditionId: number, params: {roleId: string, battleId: number, enemyFrom: number, enemyId: string, enemies: Array<any>}, lean = true) {
|
||||
public static async saveRecord(expeditionCode: string, expeditionId: number, params: {roleId: string, battleId: number, enemyFrom: number, enemyId: string, enemies: Array<any>, battleStatus: number}, lean = true) {
|
||||
const doc = new ExpeditionWarRecordModel();
|
||||
const update = Object.assign(doc.toJSON(), params, {expeditionCode, expeditionId});
|
||||
const result = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, update, {new: true, upsert: true}).select('expeditionId battleId battleCode battleStatus enemyFrom enemies ce').lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateStatus(expeditionCode: string, expeditionId: number, battleStatus: number, battleCode: string, lean = true) {
|
||||
public static async updateStatus(expeditionCode: string, expeditionId: number, battleStatus: number, lean = true) {
|
||||
const result = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, {battleStatus}, {new: true}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateBattleCode(expeditionCode: string, expeditionId: number, battleStatus: number, battleCode: string, lean = true) {
|
||||
const result = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, {battleStatus, battleCode}, {new: true}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export default class HangUpRecord extends BaseModel {
|
||||
public static async initRecord(roleId: string, roleName: string, lean = true) {
|
||||
const curTime = new Date();
|
||||
const recDoc = new HangUpRecordModel();
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime});
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime, startLv: HANG_UP_CONSTS.ENABLE_LV});
|
||||
const rec = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: HANG_UP_CONSTS.ENABLE_LV}, update, {upsert: true, new: true}).lean(lean);
|
||||
return rec;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ export default class HangUpRecord extends BaseModel {
|
||||
public static async updateRec(roleId: string, roleName: string, endLv: number, endTime: Date, needReceiveGoods: Array<{gid:number, count: number}>, lean = true) {
|
||||
await HangUpRecordModel.findOneAndUpdate({roleId, received: false}, {endLv, endTime, received: true, notReceivedGoods: needReceiveGoods}).lean(lean);
|
||||
const recDoc = new HangUpRecordModel();
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: endTime});
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: endTime, startLv: endLv});
|
||||
delete update._id;
|
||||
const newRec = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: endLv, received: false}, update, {upsert: true, new: true}).lean(lean);
|
||||
return newRec;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { updateCe } from '../pubUtils/util';
|
||||
* 英雄表
|
||||
*/
|
||||
@index({ roleId: 1, hid: 1 })
|
||||
@index({ roleId: 1, seqId: 1 })
|
||||
export default class Hero extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
@@ -60,6 +61,10 @@ export default class Hero extends BaseModel {
|
||||
return heros || [];
|
||||
}
|
||||
|
||||
public static async findBySeqIdRange(seqIds: Array<number>, roleId: string, lean = true) {
|
||||
const hero = await HeroModel.find({ seqId: {$in: seqIds}, roleId }).lean(lean);
|
||||
return hero;
|
||||
}
|
||||
public static async findBySeqIdAndRole(seqId: number, roleId: string, lean = true) {
|
||||
const hero = await HeroModel.findOne({ seqId, roleId }).lean(lean);
|
||||
return hero;
|
||||
|
||||
@@ -123,7 +123,7 @@ export default class Role extends BaseModel {
|
||||
|
||||
@prop({ required: true, default: 0})
|
||||
towerTaskCnt: number; // 刷新派遣任务的次数,向上累加,每天8个
|
||||
@prop({ required: true, default: new Date()})
|
||||
@prop({ required: false})
|
||||
towerTaskRefTime: Date; // 刷新派遣任务的时间
|
||||
|
||||
// 奇遇事件相关
|
||||
|
||||
Reference in New Issue
Block a user