From e075b86d185876e0f54b63721e90a9e44d44af9d Mon Sep 17 00:00:00 2001 From: zhiyu1998 Date: Fri, 14 Apr 2023 11:11:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf:=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=AB=B9=E7=99=BD=E4=BC=98=E5=85=88=E5=B1=95=E7=A4=BA=E6=9C=80?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/query.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/query.js b/apps/query.js index 7a208cd..b2456a4 100644 --- a/apps/query.js +++ b/apps/query.js @@ -394,16 +394,18 @@ export class query extends plugin { ) .then(async resp => { const res = resp.data.data; - const content = await res.map(item => { - const { pn, pa, zn, lu, pu, pq, aa, hl } = item; - const template = `标题:${pn}\n${pa}\n期刊:${zn}\n发布日期距今:${lu}\n链接1:${pu}\n链接2:${pq}\n\n 大致描述:${hl - .join("\n") - .replace(/<\/?font[^>]*>/g, "")}`; - return { - message: [segment.image(aa), template], - nickname: this.e.sender.card || this.e.user_id, - user_id: this.e.user_id, - }; + const content = res + .sort((a, b) => b.luSort - a.luSort) + .map(item => { + const { pn, pa, zn, lu, pu, pq, aa, hl } = item; + const template = `标题:${pn}\n${pa}\n期刊:${zn}\n发布日期距今:${lu}\n链接1:${pu}\n链接2:${pq}\n\n 大致描述:${hl + .join("\n") + .replace(/<\/?font[^>]*>/g, "")}`; + return { + message: [segment.image(aa), template], + nickname: this.e.sender.card || this.e.user_id, + user_id: this.e.user_id, + }; }); e.reply(await Bot.makeForwardMsg(content)); });