Commit d133e90f authored by ganjingcun's avatar ganjingcun

ads

parent 04531254
...@@ -1807,7 +1807,7 @@ router.get('/getAd', function (req, res) { ...@@ -1807,7 +1807,7 @@ router.get('/getAd', function (req, res) {
var total = rows[0].count - 0 var total = rows[0].count - 0
//返回随机的一个 //返回随机的一个
// SELECT myid FROM mytable OFFSET floor(random()*N) LIMIT 1; // SELECT myid FROM mytable OFFSET floor(random()*N) LIMIT 1;
var sql2 = `SELECT * from ads OFFSET floor(random() * ${total}) LIMIT 1 ` var sql2 = `SELECT * from ads where status='t' OFFSET floor(random() * ${total}) LIMIT 1 `
console.log(sql2) console.log(sql2)
client.query(sql2, function (err, result) { client.query(sql2, function (err, result) {
done() done()
......
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