Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-arena-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-arena-api
Commits
dc0bb400
Commit
dc0bb400
authored
Jan 31, 2019
by
IamI
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dp change history
parent
e2c65dc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
routes/api.js
routes/api.js
+18
-3
No files found.
routes/api.js
View file @
dc0bb400
...
...
@@ -99,22 +99,37 @@ var schedule = require('node-schedule');
var
j
=
schedule
.
scheduleJob
(
'
30 30 0 1 * *
'
,
function
()
{
console
.
log
(
'
The scheduleJob run on first day of every month!
'
,
moment
().
format
(
'
YYYY-MM-DD HH:mm
'
));
/*
pool.connect(function (err, client, done) {
if (err) {
return console.error('error fetching client from pool', err);
}
var
sql
=
`update user_info set pt = (pt - (pt - 1000) * 0.4 )
where pt > 1000`
let
sql = `update user_info set pt = (pt - (pt - 1000) * 0.4 )
where pt > 1000`
;
client.query(sql, function (err, result) {
done
()
done()
;
if (err) {
return console.error('error running monthly scheduleJob', err);
}
console.log(result)
});
})
*/
let
time
=
moment
().
subtract
(
1
,
'
month
'
);
let
season
=
time
.
format
(
'
YYYY-MM
'
);
let
higher_limit
=
time
.
format
(
'
YYYY-MM-01 00:00:01
'
);
let
lower_limit
=
moment
().
subtract
(
1
,
'
day
'
).
format
(
'
YYYY-MM-DD 23:59:59
'
);
let
base
=
1000
;
pool
.
query
(
'
select monthly_user_historical_record($1::text, $2, $3::boolean, true)
'
,
[
season
,
base
,
false
],
(
err
,
result
)
=>
{
if
(
err
)
return
console
.
error
(
'
error running monthly scheduleJob
'
,
err
);
else
pool
.
query
(
'
select collect_win_lose_rate($1, $2)
'
,
[
lower_limit
,
higher_limit
],
(
err
,
result
)
=>
{
if
(
err
)
console
.
error
(
'
error running monthly scheduleJob
'
,
err
);
});
});
});
var
Filter
=
require
(
'
bad-words-chinese
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment