parent
2a09950573
commit
c373e4b62c
@ -1,14 +0,0 @@
|
|||||||
const pool = require('../db');
|
|
||||||
|
|
||||||
async function getRanking(req, res) {
|
|
||||||
try {
|
|
||||||
const connection = await pool.getConnection();
|
|
||||||
const [ranking] = await connection.query('SELECT student_name, student_id, score, call_count FROM students ORDER BY score DESC');
|
|
||||||
connection.release();
|
|
||||||
res.send({ ranking });
|
|
||||||
} catch (error) {
|
|
||||||
res.status(500).send({ error: '无法获取排名' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { getRanking };
|
|
Loading…
Reference in new issue