From 0fe9bae311118a22931abe16f39b604f8d7bb3a3 Mon Sep 17 00:00:00 2001 From: luchenqun Date: Mon, 21 May 2018 09:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=AA=E5=9B=BE=E6=94=BE=E5=9C=A8=E5=87=8C?= =?UTF-8?q?=E6=99=A82=E7=82=B9=E5=88=B05=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/routes/api.js b/routes/api.js index e0adeb6..05804c9 100644 --- a/routes/api.js +++ b/routes/api.js @@ -1147,12 +1147,11 @@ api.getSnapByTimer = function() { console.log('getSnapByTimer...........'); var timeout = 30000 setInterval(function() { - var today = new Date().getDate(); - var hours = new Date().getHours(); - if(hours >= 6 && hours <= 23){ - return; - } - db.getBookmarkWaitSnap(today) + var date = new Date(); + var today = date.getDate(); + var hours = date.getHours(); + if (hours >=2 && hours <= 5) { + db.getBookmarkWaitSnap(today) .then((bookmarks) => { if (bookmarks.length == 1) { var id = bookmarks[0].id; @@ -1194,6 +1193,8 @@ api.getSnapByTimer = function() { } }) .catch((err) => console.log('getBookmarkWaitSnap err', err)); + } + }, timeout + 1000); }