更新一下获取热门书签的问题

This commit is contained in:
luchenqun 2017-03-21 10:19:09 +08:00
parent 3d39cf95c4
commit 2a3fad3dcf
4 changed files with 25 additions and 8 deletions

View File

@ -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();

View File

@ -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) {

View File

@ -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',

View File

@ -1,5 +1,6 @@
<div class="ui segment js-hot-card" style="min-height:150px;">
<div class="ui five stackable cards" infinite-scroll='loadCardData()' infinite-scroll-immediate-check="false">
<!-- 高度至少要设置1000元素少时才能触发滚动条事件 -->
<div class="ui segment js-hot-card" style="min-height:1000px;">
<div class="ui five stackable cards" infinite-scroll='loadHotBookmarks()' infinite-scroll-immediate-check="false">
<div class="card" ng-repeat="bookmark in bookmarks">
<div class="content" style="max-height:70px;cursor:pointer" ng-click="jumpToUrl(bookmark.url)">
<div class="description bookmarkTitle" title="{{bookmark.title}}">