From e3d7c8b637a7deb835a21f9de87a5888ea0bf487 Mon Sep 17 00:00:00 2001 From: luchenqun Date: Fri, 17 Mar 2017 13:00:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E4=B8=8B=E6=88=AA?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/routes/api.js b/routes/api.js index b4f275a..be11b3e 100644 --- a/routes/api.js +++ b/routes/api.js @@ -1074,7 +1074,17 @@ api.getHotBookmarksByTimer = function() { bookmark.created_at = b.updatetime > b.createtime ? b.createtime : b.updatetime; bookmark.last_click = b.updatetime < b.createtime ? b.createtime : b.updatetime; if (b.imageList.length >= 1) { - bookmark.snap_url = (data.pageNo == 1 ? (b.imageList[0].url.match(alterRex) != null ? defaultSnap : b.imageList[0].url) : defaultSnap); + if (b.imageList[0].url) { + bookmark.snap_url = (data.pageNo == 1 ? (b.imageList[0].url.match(alterRex) != null ? defaultSnap : b.imageList[0].url) : defaultSnap); + } else { + bookmark.snap_url = defaultSnap; + for (var i = 0; i < b.images.length; i++) { + if (b.images[i]) { + bookmark.snap_url = b.images[i]; + break; + } + } + } } else { bookmark.snap_url = defaultSnap; }