@@ -185,6 +185,9 @@ router.post('/score', function (req, res) {
...
@@ -185,6 +185,9 @@ router.post('/score', function (req, res) {
returnres.status(404).send('username can not be null')
returnres.status(404).send('username can not be null')
}
}
usernameA=usernameA.replace(/'/g,"");
usernameB=usernameB.replace(/'/g,"");
pool.connect(function(err,client,done){
pool.connect(function(err,client,done){
if(err){
if(err){
console.error('error fetching client from pool',err);
console.error('error fetching client from pool',err);
...
@@ -249,10 +252,10 @@ router.post('/score', function (req, res) {
...
@@ -249,10 +252,10 @@ router.post('/score', function (req, res) {
paramB['athletic_draw']=1
paramB['athletic_draw']=1
}
}
varqueryFirsrWinSql=`select count(*) from battle_history where type ='athletic' and ( (usernameA = ? AND userscorea > userscoreb ) OR (usernameB = ? AND userscoreb > userscorea) ) and start_time > ? `
varqueryFirsrWinSql=`select count(*) from battle_history where type ='athletic' and ( (usernameA= '${winner}' AND userscorea > userscoreb ) OR (usernameB= '${winner}' AND userscoreb > userscorea) ) and start_time > '${today}' `