邮件:删除邮件
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user