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)