From 3f275e4af40526f78e5b341abc2bb1160fa90203 Mon Sep 17 00:00:00 2001 From: ciniao <4041990@qq.com> Date: Mon, 18 Dec 2023 18:01:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=8F=91=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E4=B8=8A=E9=99=90=E5=88=A4=E6=96=AD=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/email.ts | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/public/email.ts b/src/public/email.ts index 1f70f02..b068322 100644 --- a/src/public/email.ts +++ b/src/public/email.ts @@ -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)