From cbe4ad4e9154c63d1a6e05d6fdc23582dfe949b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B05BEE13=2E=E5=8D=A2=E9=83=B4=E7=BE=A4?= Date: Tue, 1 Jun 2021 09:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/api.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/controller/api.js b/src/controller/api.js index b01ad62..ee87989 100644 --- a/src/controller/api.js +++ b/src/controller/api.js @@ -456,11 +456,7 @@ module.exports = class extends Base { type = "folder"; let dl = node.children("dl").first(); let dts = dl.children(); - let ls = dts.toArray().map(function (ele) { - if (ele.name !== "dt") - return null; - return parseNode($(ele)); - }); + let ls = dts.toArray().map(function (ele) { return ele.name !== "dt" ? null : parseNode($(ele)); }); children = ls.filter(function (item) { return item !== null; }); case "a": // site @@ -521,8 +517,7 @@ module.exports = class extends Base { let bookmarks = []; const file = this.file("file"); - let now = new Date().getTime(); - let fileName = 'uploadbookmark-' + this.ctx.state.user.username + '-' + now + '.html'; + let fileName = 'uploadbookmark-' + this.ctx.state.user.username + '-' + think.datetime(new Date(), "YYYYMMDDHHmmss") + '.html'; if (file) { const filePath = path.join(think.ROOT_PATH, `runtime/upload/${fileName}`); await fs.ensureDir(path.dirname(filePath)); @@ -580,6 +575,7 @@ module.exports = class extends Base {

` let time = (date) => parseInt(new Date(date).getTime() / 1000); // 日期转时间 + let now = new Date(); let left = `