Compare commits
2 Commits
a5ad7ee2cf
...
af0225005a
Author | SHA1 | Date | |
---|---|---|---|
af0225005a | |||
3f275e4af4 |
@ -186,27 +186,29 @@ export class EmailFun {
|
||||
sendEmail.lngContent = email.lngContent
|
||||
}
|
||||
|
||||
if (!isCross) {
|
||||
let emailList = await this.getAllEmail(uid);
|
||||
if (emailList.length >= 50) {
|
||||
emailList.sort((a, b) => {
|
||||
let noPrizeA = a.prizeData == undefined ? 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;
|
||||
//太亏了!换其他清理机制,getAllEmail是性能消耗大户
|
||||
//todo.. 换其他清理机制
|
||||
// if (!isCross) {
|
||||
// let emailList = await this.getAllEmail(uid);
|
||||
// if (emailList.length >= 50) {
|
||||
// emailList.sort((a, b) => {
|
||||
// let noPrizeA = a.prizeData == undefined ? 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) {
|
||||
return noPrizeA - noPrizeB;
|
||||
} else if (getA != getB) {
|
||||
return getA - getB;
|
||||
}
|
||||
return a.createTime - b.createTime;
|
||||
});
|
||||
// if (noPrizeA != noPrizeB) {
|
||||
// return noPrizeA - noPrizeB;
|
||||
// } else if (getA != getB) {
|
||||
// return getA - getB;
|
||||
// }
|
||||
// return a.createTime - b.createTime;
|
||||
// });
|
||||
|
||||
this.removeEmail(uid, emailList[0]._id);
|
||||
G.server.sendMsgByUid(uid, 'msg_s2c/EmailDel', emailList[0]._id);
|
||||
}
|
||||
}
|
||||
// this.removeEmail(uid, emailList[0]._id);
|
||||
// G.server.sendMsgByUid(uid, 'msg_s2c/EmailDel', emailList[0]._id);
|
||||
// }
|
||||
// }
|
||||
|
||||
let _id = (await G.mongodb.collection('email').insertOne({
|
||||
ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail)
|
||||
|
Loading…
Reference in New Issue
Block a user