🐞 fix(gvg): 内政帮收改为按玩家收获
This commit is contained in:
@@ -139,15 +139,18 @@ export default class GVGLeagueFarm extends BaseModel {
|
||||
}));
|
||||
if(result.modifiedCount == 0) return [];
|
||||
const fieldResult: GVGLeagueFarmType[] = await GVGLeagueFarmModel.find({ batchCode }).sort({ fieldId: 1 }).select('-_id -createdAt -updatedAt -__v -configId -leagueCode').lean();
|
||||
await GVGLeagueFarmModel.updateMany({ batchCode }, { $set: { seedType: 0 } })
|
||||
await GVGLeagueFarmModel.updateMany({ batchCode }, { $set: { seedType: 0 } });
|
||||
return fieldResult;
|
||||
}
|
||||
|
||||
public static async helpHarvest(configId: number, leagueCode: string, farmId: number, fieldId: number) {
|
||||
const result: GVGLeagueFarmType = await GVGLeagueFarmModel.findOneAndUpdate(
|
||||
{ configId, leagueCode, farmId, fieldId, harvestTime: { $lt: nowSeconds() }, unlockTime: { $gt: nowSeconds() } },
|
||||
{ $set: { unlockTime: 0, harvestTime: 0, lockRoleId: '', lockRoleName: '' }}, { new: true }).lean();
|
||||
return result
|
||||
public static async helpHarvest(configId: number, leagueCode: string, farmId: number, roleId: string) {
|
||||
const batchCode = genCode(10);
|
||||
const result = await GVGLeagueFarmModel.updateMany({ configId, leagueCode, farmId, lockRoleId: roleId, harvestTime: { $lt: nowSeconds() } },
|
||||
{ $set: { unlockTime: 0, harvestTime: 0, lockRoleId: '', lockRoleName: '', batchCode }}, { new: true });
|
||||
if(result.modifiedCount == 0) return [];
|
||||
const fieldResult: GVGLeagueFarmType[] = await GVGLeagueFarmModel.find({ batchCode }).lean();
|
||||
await GVGLeagueFarmModel.updateMany({ batchCode }, { $set: { seedType: 0 } });
|
||||
return fieldResult
|
||||
}
|
||||
|
||||
public static async releaseLock(configId: number, leagueCode: string, farmId: number, roleId: string) {
|
||||
|
||||
Reference in New Issue
Block a user