去掉发邮件时的上限判断机制

This commit is contained in:
ciniao 2023-12-18 18:01:55 +08:00
parent ea179c2a3c
commit 3f275e4af4

View File

@ -186,27 +186,29 @@ export class EmailFun {
sendEmail.lngContent = email.lngContent sendEmail.lngContent = email.lngContent
} }
if (!isCross) { //太亏了换其他清理机制getAllEmail是性能消耗大户
let emailList = await this.getAllEmail(uid); //todo.. 换其他清理机制
if (emailList.length >= 50) { // if (!isCross) {
emailList.sort((a, b) => { // let emailList = await this.getAllEmail(uid);
let noPrizeA = a.prizeData == undefined ? 0 : 1; // if (emailList.length >= 50) {
let noPrizeB = b.prizeData == undefined ? 0 : 1; // emailList.sort((a, b) => {
let getA = a.prizeData?.isGet == true ? 0 : 1; // let noPrizeA = a.prizeData == undefined ? 0 : 1;
let getB = b.prizeData?.isGet == true ? 0 : 1; // let noPrizeB = b.prizeData == undefined ? 0 : 1;
// let getA = a.prizeData?.isGet == true ? 0 : 1;
// let getB = b.prizeData?.isGet == true ? 0 : 1;
if (noPrizeA != noPrizeB) { // if (noPrizeA != noPrizeB) {
return noPrizeA - noPrizeB; // return noPrizeA - noPrizeB;
} else if (getA != getB) { // } else if (getA != getB) {
return getA - getB; // return getA - getB;
} // }
return a.createTime - b.createTime; // return a.createTime - b.createTime;
}); // });
this.removeEmail(uid, emailList[0]._id); // this.removeEmail(uid, emailList[0]._id);
G.server.sendMsgByUid(uid, 'msg_s2c/EmailDel', emailList[0]._id); // G.server.sendMsgByUid(uid, 'msg_s2c/EmailDel', emailList[0]._id);
} // }
} // }
let _id = (await G.mongodb.collection('email').insertOne({ let _id = (await G.mongodb.collection('email').insertOne({
ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail) ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail)