后台:定时邮件

This commit is contained in:
luying
2021-12-01 18:12:04 +08:00
parent eafc060093
commit 11bba498ce
3 changed files with 51 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ import BaseModel from './BaseModel';
import { getModelForClass, prop, DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';
import { GM_MAIL_STATUS, GM_MAIL_TYPE, MAIL_TIME_TYPE } from '../consts';
import { SearchMailParam } from '../domain/backEndField/search';
import { getCurDay, nowSeconds } from '../pubUtils/timeUtil';
class Reward {
@prop({ required: true })
@@ -142,6 +143,15 @@ export default class GMMail extends BaseModel {
return result;
}
public static async findCircleMails(env: string) {
const result: GMMailType[] = await GMMailModel.find({
timeType: MAIL_TIME_TYPE.CIRCLE,
circleStart: { $lt: nowSeconds() }, circleEnd: { $gte: nowSeconds() },
circleDay: { $in: [0, getCurDay(true)] }, 'receivers.env': env,
status: GM_MAIL_STATUS.PASS
});
return result;
}
}