🐞 fix(gvg): 遗迹挑战次数添加元宝购买逻辑
This commit is contained in:
@@ -39,8 +39,11 @@ export default class GVGUserDailyData extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
hasLogin: boolean; // 是否登录
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
costGoldCnt: number; // 已使用元宝的次数
|
||||
|
||||
public static async findByRole(configId: number, leagueCode: string, roleId: string) {
|
||||
const result: GVGUserDailyDataType = await GVGUserDailyDataModel.findOne({ configId, leagueCode, roleId, time: getZeroPoint() }).select('food mineral wood score').lean();
|
||||
const result: GVGUserDailyDataType = await GVGUserDailyDataModel.findOne({ configId, leagueCode, roleId, time: getZeroPoint() }).select('food mineral wood score costGoldCnt').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -66,6 +69,16 @@ export default class GVGUserDailyData extends BaseModel {
|
||||
const result: GVGUserDailyDataType = await GVGUserDailyDataModel.findOneAndUpdate({ configId, leagueCode, roleId, time: getZeroPoint()}, { $inc: { food, mineral, wood }}, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async incCostGoldCnt(configId: number, leagueCode: string, roleId: string, costGold: boolean) {
|
||||
if(costGold) {
|
||||
const result: GVGUserDailyDataType = await GVGUserDailyDataModel.findOneAndUpdate({ configId, leagueCode, roleId, time: getZeroPoint() }, { $inc: { costGoldCnt: 1 } }, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
} else {
|
||||
const result: GVGUserDailyDataType = await GVGUserDailyDataModel.findOne({ configId, leagueCode, roleId, time: getZeroPoint() }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const GVGUserDailyDataModel = getModelForClass(GVGUserDailyData);
|
||||
|
||||
Reference in New Issue
Block a user