邮件:删除邮件

This commit is contained in:
luying
2021-08-24 15:14:35 +08:00
parent 7e8a32f4a6
commit 08395ec957
2 changed files with 11 additions and 6 deletions

View File

@@ -59,19 +59,23 @@ export default class ServerMail extends MailTemp {
* @param _id
* @param lean
*/
public static async delMailById(_id: string, roleId: string) {
public static async delMailById(id: string, roleId: string) {
const result: ServerMailType = await ServerMailModel.findOneAndUpdate(
{
_id: id,
sendTime:{ $lte: nowSeconds() },
'roleStatus.roleId': roleId,
$or: [{
roleStatus: {$elemMatch: {roleId, status: MAIL_STATUS.READ}}, hasGoods:false
'roleStatus.status': MAIL_STATUS.READ, hasGoods:false
}, {
roleStatus: {$elemMatch: {roleId, status: MAIL_STATUS.RECEIVED}}
'roleStatus.status': MAIL_STATUS.RECEIVED
}]
},
{ $set:{ 'roleStatus.$.status': MAIL_STATUS.DELETE, $push: { 'delRoles': roleId } } },
{ $set:{ 'roleStatus.$.status': MAIL_STATUS.DELETE}, $push: { delRoles: roleId } },
{ new: true }
).lean();
console.log('*******', result)
return result;
}