diff --git a/database/db.js b/database/db.js index 9803c02..d300872 100644 --- a/database/db.js +++ b/database/db.js @@ -767,11 +767,11 @@ db.getHotBookmarksSearch = function(params) { if (params.dateCreate) { var d = new Date(); d.setDate(d.getDate() - parseInt(params.dateCreate)); - sql += " AND `created_at` >= '" + d.getTime() + "'" + sql += " AND `date` >= '" + d.format("yyyyMMdd") + "'" } else if (params.dateCreateBegin && params.dateCreateEnd) { - var dateCreateBegin = new Date(params.dateCreateBegin + "T00:00:00"); - var dateCreateEnd = new Date(params.dateCreateEnd + "T23:59:59"); - sql += " AND `created_at` >= '" + dateCreateBegin.getTime() + "' AND `created_at` <= '" + dateCreateEnd.getTime() + "' " + var dateCreateBegin = new Date(params.dateCreateBegin).format("yyyyMMdd"); + var dateCreateEnd = new Date(params.dateCreateEnd).format("yyyyMMdd"); + sql += " AND `date` >= '" + dateCreateBegin + "' AND `date` <= '" + dateCreateEnd + "' " } if (params.dateClick) { var d = new Date(); diff --git a/public/scripts/controllers/hot-controller.js b/public/scripts/controllers/hot-controller.js index 424aed3..31d4a0c 100644 --- a/public/scripts/controllers/hot-controller.js +++ b/public/scripts/controllers/hot-controller.js @@ -103,9 +103,9 @@ app.controller('hotCtr', ['$scope', '$state', '$stateParams', '$filter', '$windo pubSubService.publish('TagCtr.showBookmarkInfo', bookmark); } - $scope.loadCardData = function() { + $scope.loadHotBookmarks = function() { if (!$scope.loadBusy && !$scope.random) { - console.log('loadCardData.........') + console.log('begin loadHotBookmarks.........') var menusScope = $('div[ng-controller="menuCtr"]').scope(); var login = (menusScope && menusScope.login) || false; if (login) { diff --git a/public/scripts/directives/js-init-directive.js b/public/scripts/directives/js-init-directive.js index 5dadca1..ab0955e 100644 --- a/public/scripts/directives/js-init-directive.js +++ b/public/scripts/directives/js-init-directive.js @@ -12,6 +12,22 @@ function date(date, settings) { return year + '-' + month + '-' + day; }; +Date.prototype.format = function(fmt) { //author: meizz + var o = { + "M+": this.getMonth() + 1, //月份 + "d+": this.getDate(), //日 + "h+": this.getHours(), //小时 + "m+": this.getMinutes(), //分 + "s+": this.getSeconds(), //秒 + "q+": Math.floor((this.getMonth() + 3) / 3), //季度 + "S": this.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in o) + if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); + return fmt; +} + app.directive('jsDataCreateInit', function($compile) { return { restrict: 'A', diff --git a/public/views/hot.html b/public/views/hot.html index 58a1f29..6a750b2 100644 --- a/public/views/hot.html +++ b/public/views/hot.html @@ -1,5 +1,6 @@ -