From 671b01efd00f5a8237525a55238f9567a4bac38a Mon Sep 17 00:00:00 2001 From: luchenqun Date: Wed, 22 Feb 2017 13:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=80=E4=B8=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/db.js | 22 +++++++++++----------- public/views/home.html | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/database/db.js b/database/db.js index fcf53fa..15dbeff 100644 --- a/database/db.js +++ b/database/db.js @@ -12,19 +12,19 @@ var client = {} function handleDisconnect() { client = mysql.createConnection(dbConfig); - client.connect(function(err) { // The server is either down - if (err) { // or restarting (takes a while sometimes). + client.connect(function(err) { + if (err) { console.log('error when connecting to db:', err); - setTimeout(handleDisconnect, 2000); // We introduce a delay before attempting to reconnect, - } // to avoid a hot loop, and to allow our node script to - }); // process asynchronous requests in the meantime. - // If you're also serving http, display a 503 error. + setTimeout(handleDisconnect, 2000); + } + }); + client.on('error', function(err) { console.log('db error', err); - if (err.code === 'PROTOCOL_CONNECTION_LOST') { // Connection to the MySQL server is usually - handleDisconnect(); // lost due to either server restart, or a - } else { // connnection idle timeout (the wait_timeout - throw err; // server variable configures this) + if (err.code === 'PROTOCOL_CONNECTION_LOST') { + handleDisconnect(); + } else { + throw err; } }); } @@ -415,7 +415,7 @@ db.getBookmarksTable = function(params) { if (user_id) { sql += " AND `user_id` = '" + user_id + "'"; if (params.showStyle == 'card') { - sql += " ORDER BY created_at DESC"; + sql += " ORDER BY bookmarks.created_at DESC"; } else { sql += " ORDER BY click_count DESC"; } diff --git a/public/views/home.html b/public/views/home.html index 6537d71..6f1c6e5 100644 --- a/public/views/home.html +++ b/public/views/home.html @@ -18,7 +18,7 @@

5、可以导入Chrome的书签导出文件,暂时做在设置里面。(已完成)

6、书签可以作为公有或者私有,公有可供所有人搜索。(暂时可以通过用户名进行搜索,待优化)

7、可以收藏别人的书签。(未完成)

-

7、可以将书签导出来,然后导入到浏览器。(未完成)

+

8、可以将书签导出来,然后导入到浏览器。(未完成)

联系方式

微信跟扣扣:530485521,记得备注加:书签。

开发备忘(非开发人员请无视)