后台:邮件审核人
This commit is contained in:
+10
-13
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import BaseModel from './BaseModel';
|
||||
import { getModelForClass, prop, DocumentType, mongoose, ReturnModelType } from '@typegoose/typegoose';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { GM_MAIL_STATUS, GM_MAIL_TYPE, MAIL_TIME_TYPE } from '../consts';
|
||||
import { SearchMailParam } from '../domain/backEndField/search';
|
||||
|
||||
@@ -23,6 +22,8 @@ export class Receiver {
|
||||
roleId?: string;
|
||||
@prop({ required: true })
|
||||
roleName?: string;
|
||||
@prop({ required: true })
|
||||
hasSend?: boolean;
|
||||
}
|
||||
|
||||
export default class GMMail extends BaseModel {
|
||||
@@ -78,6 +79,14 @@ export default class GMMail extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
status: GM_MAIL_STATUS; // 邮件状态
|
||||
|
||||
@prop({ required: true })
|
||||
viewBy: number; // 审核人
|
||||
|
||||
@prop({ required: true })
|
||||
viewAt: Date; // 审核时间
|
||||
|
||||
@prop({ required: true })
|
||||
sendTime: string; // 发送时间
|
||||
|
||||
public static async addMail(params: GMMailTypeParam, uid = 1) {
|
||||
const doc = new GMMailModel();
|
||||
@@ -96,20 +105,8 @@ export default class GMMail extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getMail(updatedMailAt: number, lean = true) {
|
||||
const result: GMMailType[] = await GMMailModel.find({ $or: [{updatedAt: { $gte: new Date(updatedMailAt) }}, {sendTime: { $lte: nowSeconds() }}], endTime: { $gte: nowSeconds()} }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async getMails( lean = true) {
|
||||
const result: GMMailType[] = await GMMailModel.find({ endTime: { $gte: nowSeconds() }}).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static getSearchObj(form: SearchMailParam) {
|
||||
let searchObj = {};
|
||||
console.log('******', form)
|
||||
if(form.createTimeStart) searchObj['createdAt'] = { $gt: new Date(form.createTimeStart * 1000) };
|
||||
if(form.createTimeEnd) searchObj['createdAt'] = { $lt: new Date(form.createTimeEnd * 1000) };
|
||||
if(form.serverId) searchObj['receivers.serverId'] = form.serverId;
|
||||
|
||||
@@ -10,6 +10,9 @@ class Reward {
|
||||
|
||||
export default class MailTemp extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
gmmailId: string;
|
||||
|
||||
@prop({ required: true })
|
||||
contentId: number; // dic_email_content.json中的id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user