Commit 4a50172a authored by Joe's avatar Joe

fix sql bug

parent d3fda0f1
......@@ -126,7 +126,7 @@ var j = schedule.scheduleJob('30 30 0 1 * *', function () {
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) => {
pool.query('select q($1, $2)', [lower_limit, higher_limit], (err, result) => {
if (err) console.error('error running monthly scheduleJob', err);
});
});
......@@ -248,10 +248,10 @@ router.post('/score', function (req, res) {
paramB['athletic_draw'] = 1
}
var queryFirsrWinSql = `select count(*) from battle_history where type ='athletic' and ( (usernameA = '${winner}' AND userscorea > userscoreb ) OR (usernameB = '${winner}' AND userscoreb > userscorea) ) and start_time > '${today}' `
var queryFirsrWinSql = `select count(*) from battle_history where type ='athletic' and ( (usernameA = ? AND userscorea > userscoreb ) OR (usernameB = ? AND userscoreb > userscorea) ) and start_time > ? `
console.log(queryFirsrWinSql)
client.query(queryFirsrWinSql, function (err, result) {
client.query(queryFirsrWinSql,[winner, winner, today], function (err, result) {
done()
var total = 0;
if (!err) {
......
......@@ -12,16 +12,17 @@ console.log(isLess3Min)
var sametime = start == end
console.log(sametime)
// var url = 'https://mycard.moe/ygopro/api/score'
// var url = 'https://api.mycard.moe/ygopro/arena/score'
var url = 'http://localhost:3000/api/score'
console.log( moment().format())
// var url = 'http://localhost:3000/api/user?username=Joe1991'
// console.log( moment().format())
superagent
.post(url)
.send({
accesskey: "XnvGjNG8jttfjYWhtqtgRfWBtyEwjMaF",
usernameA: "Joe1991",
usernameB: "zh99998",
usernameB: "Joe1991gtest",
userscoreA: 3,
userscoreB: 2,
start: moment().format(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment