更新一下代码
This commit is contained in:
parent
a0285cf340
commit
2f9b6ddd64
|
|
@ -1037,9 +1037,13 @@ api.getFaviconByTimer = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
api.getHotBookmarksByTimer = function() {
|
api.getHotBookmarksByTimer = function() {
|
||||||
console.log('getHotBookmarks...........');
|
|
||||||
var timeout = 1000 * 60 * 10; // 10分钟更新一遍
|
var timeout = 1000 * 60 * 10; // 10分钟更新一遍
|
||||||
var busy = false;
|
var busy = false;
|
||||||
|
var dayIndex = 0;
|
||||||
|
var date = new Date();
|
||||||
|
|
||||||
|
console.log('getHotBookmarks...........', date.format("yyyy-MM-dd hh:mm:ss"));
|
||||||
|
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
if (busy) {
|
if (busy) {
|
||||||
console.log('getHotBookmarks is busy')
|
console.log('getHotBookmarks is busy')
|
||||||
|
|
@ -1047,7 +1051,7 @@ api.getHotBookmarksByTimer = function() {
|
||||||
}
|
}
|
||||||
busy = true;
|
busy = true;
|
||||||
console.log('begin getHotBookmarks...');
|
console.log('begin getHotBookmarks...');
|
||||||
var today = new Date();
|
date.setTime(date.getTime() + dayIndex * 24 * 60 * 60 * 1000);
|
||||||
var requireData = {
|
var requireData = {
|
||||||
idfa: "d4995f8a0c9b2ad9182369016e376278",
|
idfa: "d4995f8a0c9b2ad9182369016e376278",
|
||||||
os: "ios",
|
os: "ios",
|
||||||
|
|
@ -1058,7 +1062,7 @@ api.getHotBookmarksByTimer = function() {
|
||||||
pageSize: 1000,
|
pageSize: 1000,
|
||||||
sort: 'desc',
|
sort: 'desc',
|
||||||
renderType: 0,
|
renderType: 0,
|
||||||
date: CurentDate(0),
|
date: curentDate(dayIndex, "yyyy年M月d日"),
|
||||||
}
|
}
|
||||||
var url = "https://api.shouqu.me/api_service/api/v1/daily/dailyMark";
|
var url = "https://api.shouqu.me/api_service/api/v1/daily/dailyMark";
|
||||||
var alterRex = "/mmbiz.qpic.cn|images.jianshu.io|zhimg.com/g";
|
var alterRex = "/mmbiz.qpic.cn|images.jianshu.io|zhimg.com/g";
|
||||||
|
|
@ -1080,11 +1084,11 @@ api.getHotBookmarksByTimer = function() {
|
||||||
data.list.forEach((b) => {
|
data.list.forEach((b) => {
|
||||||
var bookmark = {};
|
var bookmark = {};
|
||||||
bookmark.id = b.articleId;
|
bookmark.id = b.articleId;
|
||||||
bookmark.date = parseInt(today.format('yyyyMMdd'));
|
bookmark.date = parseInt(date.format('yyyyMMdd'));
|
||||||
bookmark.title = b.title;
|
bookmark.title = b.title;
|
||||||
bookmark.url = b.url;
|
bookmark.url = b.url;
|
||||||
bookmark.fav_count = b.favCount;
|
bookmark.fav_count = b.favCount || 0;
|
||||||
bookmark.created_by = b.sourceName;
|
bookmark.created_by = b.sourceName || '泥巴';
|
||||||
bookmark.created_at = b.updatetime > b.createtime ? b.createtime : b.updatetime;
|
bookmark.created_at = b.updatetime > b.createtime ? b.createtime : b.updatetime;
|
||||||
bookmark.last_click = b.updatetime < b.createtime ? b.createtime : b.updatetime;
|
bookmark.last_click = b.updatetime < b.createtime ? b.createtime : b.updatetime;
|
||||||
if (b.imageList.length >= 1) {
|
if (b.imageList.length >= 1) {
|
||||||
|
|
@ -1141,16 +1145,16 @@ function copyFile(sourceFile, destFile) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function CurentDate(i) {
|
function curentDate(i, f) {
|
||||||
if (i == undefined) {
|
if (i == undefined) {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
if (f == undefined) {
|
||||||
|
f = 'yyyyMMddhhmmss'
|
||||||
|
}
|
||||||
var now = new Date();
|
var now = new Date();
|
||||||
now.setTime(now.getTime() + i * 24 * 60 * 60 * 1000);
|
now.setTime(now.getTime() + i * 24 * 60 * 60 * 1000);
|
||||||
var year = now.getFullYear(); //年
|
var clock = now.format(f);
|
||||||
var month = now.getMonth() + 1; //月
|
|
||||||
var day = now.getDate(); //日
|
|
||||||
var clock = year + "年" + month + "月" + day + "日";
|
|
||||||
return (clock);
|
return (clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue