File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ module.exports = ({ whitelist = [] }) =>
4
4
ctx . session = { } ;
5
5
}
6
6
ctx . session . user = {
7
- login : "lilyzhaoyilu" ,
8
- // login: "YanFaFa",
7
+ // login: "lilyzhaoyilu",
8
+ login : "YanFaFa" ,
9
9
// login: "shuo0314",
10
10
// login: "azl397985856",
11
11
avatar_url : "https://avatars.githubusercontent.com/u/12479470?v=4" ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ const { owner, repo } = require("../config/index");
6
6
7
7
const solutions = require ( "../static/solution/solutions.json" ) ;
8
8
const mySolutions = require ( "../static/my/solutions.json" ) ;
9
+ const { get } = require ( "http" ) ;
9
10
10
11
const octokit = new Octokit ( { auth : process . env . issueToken } ) ;
11
12
function getAllPages ( i , issue_number ) {
@@ -46,6 +47,9 @@ async function run(d) {
46
47
onTime : getDay ( new Date ( comment . created_at ) . getTime ( ) ) <= d ,
47
48
} ;
48
49
} ) ;
50
+ mySolutions [ "_meta_" ] = {
51
+ lastUpdateTime = new Date ( ) . getTime ( )
52
+ }
49
53
fs . writeFileSync (
50
54
path . resolve ( __dirname , "../static/my/solutions.json" ) ,
51
55
JSON . stringify ( mySolutions )
@@ -55,9 +59,17 @@ async function run(d) {
55
59
const MS_PER_HOUR = 1 * 60 * 60 * 1000 ;
56
60
const TODAY = getDay ( new Date ( ) . getTime ( ) - MS_PER_HOUR ) ; // 获取今天‘的题目。 为了照顾一些人, 我们凌晨一点统计昨天的,而不是当天的。
57
61
62
+ // 仅更新当天的
63
+ if ( getDay ( TODAT ) - getDay ( mySolutions [ "__meta__" ] . lastUpdateTime ) < 1 ) {
64
+ run ( TODAY )
65
+ } else {
66
+ // 更新历史所有的,每天仅全量更新一次
58
67
// 1. 记录打卡数据
59
68
// 2. 修正之前的数据错误
60
69
// 3. 登记补卡信息
61
70
for ( let d = 1 ; d <= TODAY ; d ++ ) {
62
71
run ( d ) ;
63
72
}
73
+ }
74
+
75
+
You can’t perform that action at this time.
0 commit comments