Commit d0ba2f73 authored by Joe's avatar Joe

fix bug

parent 0bd78a73
This diff is collapsed.
...@@ -739,8 +739,14 @@ router.get('/report', function (req, res) { ...@@ -739,8 +739,14 @@ router.get('/report', function (req, res) {
async.parallel({ async.parallel({
entertainTotal: function (callback) { entertainTotal: function (callback) {
var sql = `SELECT count(*) from battle_history where type = 'entertain' and start_time >= $1 and start_time < $2;`
var sql = {
text: `SELECT count(*) from battle_history where type = 'entertain' and start_time >= $1 and start_time < $2;`,
values: time_args
}
console.log(sql) console.log(sql)
client.query(sql, function (err, result) { client.query(sql, function (err, result) {
done() done()
if (err) { if (err) {
...@@ -1070,7 +1076,6 @@ router.post('/voteStatus', function (req, res) { ...@@ -1070,7 +1076,6 @@ router.post('/voteStatus', function (req, res) {
}); });
}); });
router.post('/submitVote', function (req, res) { router.post('/submitVote', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -1344,7 +1349,6 @@ router.get('/votes', function (req, res) { ...@@ -1344,7 +1349,6 @@ router.get('/votes', function (req, res) {
}); });
}); });
router.get('/vote', function (req, res) { router.get('/vote', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -1420,7 +1424,6 @@ router.get('/vote', function (req, res) { ...@@ -1420,7 +1424,6 @@ router.get('/vote', function (req, res) {
}); });
}); });
router.get('/deckinfo', function (req, res) { router.get('/deckinfo', function (req, res) {
var name = req.query.name var name = req.query.name
var version = req.query.version var version = req.query.version
...@@ -1491,8 +1494,6 @@ router.get('/deckinfo', function (req, res) { ...@@ -1491,8 +1494,6 @@ router.get('/deckinfo', function (req, res) {
}); });
}); });
var file = require("./file.js"); var file = require("./file.js");
router.post('/upload', file.upload); router.post('/upload', file.upload);
...@@ -1697,7 +1698,6 @@ router.get('/deckdata/:id', function (req, res) { ...@@ -1697,7 +1698,6 @@ router.get('/deckdata/:id', function (req, res) {
}) })
//卡组范例提交 //卡组范例提交
router.post('/deckdemo', function (req, res) { router.post('/deckdemo', function (req, res) {
let author = req.body.user; let author = req.body.user;
...@@ -2232,7 +2232,6 @@ router.get('/ads', function (req, res) { ...@@ -2232,7 +2232,6 @@ router.get('/ads', function (req, res) {
}); });
}); });
router.post('/adSwitchChange', function (req, res) { router.post('/adSwitchChange', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2269,8 +2268,6 @@ router.post('/adSwitchChange', function (req, res) { ...@@ -2269,8 +2268,6 @@ router.post('/adSwitchChange', function (req, res) {
}); });
}); });
router.get('/label', function (req, res) { router.get('/label', function (req, res) {
pool.connect(function (err, client, done) { pool.connect(function (err, client, done) {
...@@ -2301,7 +2298,6 @@ router.get('/label', function (req, res) { ...@@ -2301,7 +2298,6 @@ router.get('/label', function (req, res) {
}); });
router.post('/label', function (req, res) { router.post('/label', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2339,8 +2335,6 @@ router.post('/label', function (req, res) { ...@@ -2339,8 +2335,6 @@ router.post('/label', function (req, res) {
}); });
}); });
router.post('/activity', function (req, res) { router.post('/activity', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2389,7 +2383,6 @@ router.post('/activity', function (req, res) { ...@@ -2389,7 +2383,6 @@ router.post('/activity', function (req, res) {
}); });
}); });
router.post('/adsStatus', function (req, res) { router.post('/adsStatus', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2428,7 +2421,6 @@ router.post('/adsStatus', function (req, res) { ...@@ -2428,7 +2421,6 @@ router.post('/adsStatus', function (req, res) {
}); });
}); });
router.get('/getAd', function (req, res) { router.get('/getAd', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2514,7 +2506,6 @@ router.get('/getAd', function (req, res) { ...@@ -2514,7 +2506,6 @@ router.get('/getAd', function (req, res) {
}); });
}); });
router.post('/adClick', function (req, res) { router.post('/adClick', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2557,7 +2548,6 @@ router.post('/adClick', function (req, res) { ...@@ -2557,7 +2548,6 @@ router.post('/adClick', function (req, res) {
}); });
}); });
router.post('/adImpl', function (req, res) { router.post('/adImpl', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2599,8 +2589,6 @@ router.post('/adImpl', function (req, res) { ...@@ -2599,8 +2589,6 @@ router.post('/adImpl', function (req, res) {
}); });
}); });
router.get('/firstwin', function (req, res) { router.get('/firstwin', function (req, res) {
// to run a query we can acquire a client from the pool, // to run a query we can acquire a client from the pool,
// run a query on the client, and then return the client to the pool // run a query on the client, and then return the client to the pool
...@@ -2663,10 +2651,6 @@ router.get('/firstwin', function (req, res) { ...@@ -2663,10 +2651,6 @@ router.get('/firstwin', function (req, res) {
}); });
}); });
createUser = function (username, ep, epEventName) { createUser = function (username, ep, epEventName) {
pool.connect(function (err, client, done) { pool.connect(function (err, client, done) {
let sql = { let sql = {
...@@ -2705,4 +2689,4 @@ var getStringValueByMysticalNumber = function (lang, offset, number) { ...@@ -2705,4 +2689,4 @@ var getStringValueByMysticalNumber = function (lang, offset, number) {
return "" return ""
} }
module.exports = router module.exports = router
\ No newline at end of file
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