🐞 fix(gvg): 农场收获之后有残留

This commit is contained in:
luying
2023-02-08 19:54:28 +08:00
parent e5df5fe4f0
commit eb7ce1a079

View File

@@ -135,7 +135,7 @@ export default class GVGLeagueFarm extends BaseModel {
public static async harvest(configId: number, leagueCode: string, farmId: number, fieldIds: number[], roleId: string) {
const batchCode = genCode(10);
const result = await GVGLeagueFarmModel.bulkWrite(fieldIds.map(fieldId => {
return { updateOne: { filter: { configId, leagueCode, farmId, fieldId, lockRoleId: roleId, harvestTime: { $lt: nowSeconds() } }, update: { $set: { unlockTime: 0, harvestTime: 0, lockRoleId: '', lockRoleName: '', batchCode }} } }
return { updateOne: { filter: { configId, leagueCode, farmId, fieldId, lockRoleId: roleId, harvestTime: { $lt: nowSeconds() } }, update: { $set: { unlockTime: 0, harvestTime: 0, seedType: 0, lockRoleId: '', lockRoleName: '', batchCode }} } }
}));
if(result.modifiedCount == 0) return [];
const fieldResult: GVGLeagueFarmType[] = await GVGLeagueFarmModel.find({ batchCode }).sort({ fieldId: 1 }).select('-_id -createdAt -updatedAt -__v -configId -leagueCode').lean();