✨ feat(邮件): 添加专属邮件

This commit is contained in:
luying
2023-04-06 17:36:44 +08:00
parent ec65f880b7
commit 579ee7846f
7 changed files with 17 additions and 6 deletions
+2 -2
View File
@@ -87,7 +87,7 @@ export default class Mail extends MailTemp {
* @param roleId
*/
public static async delMailsByRoleId(roleId: string) {
const ids: { _id: string }[] = await MailModel.find({ roleId, $or: [{ $and: [{ status: MAIL_STATUS.READ, hasGoods: false }] }, { status: MAIL_STATUS.RECEIVED }], sendTime:{$lte: nowSeconds()} }).select('_id').lean();
const ids: { _id: string }[] = await MailModel.find({ roleId, $or: [{ $and: [{ status: MAIL_STATUS.READ, hasGoods: false }] }, { status: MAIL_STATUS.RECEIVED }], sendTime:{$lte: nowSeconds()}, isSp: false }).select('_id').lean();
let result: MailType[] = [];
for(let _id of ids) {
let rec = await MailModel.findByIdAndUpdate(_id, { $set:{ status: MAIL_STATUS.DELETE }}, { new: true }).lean();
@@ -128,7 +128,7 @@ export default class Mail extends MailTemp {
* @param lean
*/
public static async findRewardsMails(roleId: string, lean = true) {
const result: MailType[] = await MailModel.find({ roleId, status: {$in: [ MAIL_STATUS.CREATE, MAIL_STATUS.READ ] }, sendTime:{$lte: nowSeconds()} }).lean(lean);
const result: MailType[] = await MailModel.find({ roleId, status: {$in: [ MAIL_STATUS.CREATE, MAIL_STATUS.READ ] }, sendTime:{$lte: nowSeconds()}, isSp: false }).lean(lean);
return result;
}
}