diff --git a/shared/db/Lot.ts b/shared/db/Lot.ts index 3ac444653..15ff6228f 100644 --- a/shared/db/Lot.ts +++ b/shared/db/Lot.ts @@ -54,6 +54,8 @@ export default class Lot extends BaseModel { status: number; // 拍品状态,0:无人竞拍;1:竞拍中;2:已竞拍;3:一口价 @prop({ required: true, default: 0 }) sort: number; // 排序 + @prop({ required: true, default: 0 }) + sendMail: boolean; // 是否是发邮件去的 public static async createRec(data: LotParam) { const code = genCode(8); @@ -145,8 +147,8 @@ export default class Lot extends BaseModel { } public static async setLotSoldByBegin(begin: Date, saveAuctionStage: number) { - const results: LotType[] = await LotModel.find({ begin, status: LOT_STATUS.ING }).sort({ sort: 1 }).select('-_id -__v').lean(); - await LotModel.updateMany({ begin, status: LOT_STATUS.ING }, { status: LOT_STATUS.SOLD, saveAuctionStage }); + await LotModel.updateMany({ begin, status: LOT_STATUS.ING }, { $set: { status: LOT_STATUS.SOLD, saveAuctionStage, sendMail: true } }); + const results: LotType[] = await LotModel.find({ begin, status: LOT_STATUS.SOLD, saveAuctionStage, sendMail: true }).sort({ sort: 1 }).select('-_id -__v').lean(); return results; }