refactor(backend): 优化API文档、认证路由和分页查询,统一响应格式并添加字段验证

This commit is contained in:
2025-09-23 18:38:37 +08:00
parent 00cf840e6f
commit 6d76281c6b
35 changed files with 2027 additions and 535 deletions

53
backend/simple_verify.js Normal file
View File

@@ -0,0 +1,53 @@
const mysql = require('mysql2');
const connection = mysql.createConnection({
host: 'nj-cdb-3pwh2kz1.sql.tencentcdb.com',
port: 20784,
user: 'jiebanke',
password: 'aiot741$12346',
database: 'niumall'
});
console.log('正在连接数据库...');
connection.connect((err) => {
if (err) {
console.error('连接失败:', err.message);
return;
}
console.log('连接成功,查询数据...');
// 查询供应商数量
connection.query('SELECT COUNT(*) as count FROM suppliers', (err, results) => {
if (err) {
console.error('查询供应商失败:', err.message);
connection.end();
return;
}
console.log('供应商总数:', results[0].count);
// 查询司机数量
connection.query('SELECT COUNT(*) as count FROM drivers', (err, results) => {
if (err) {
console.error('查询司机失败:', err.message);
connection.end();
return;
}
console.log('司机总数:', results[0].count);
// 查询订单数量
connection.query('SELECT COUNT(*) as count FROM orders', (err, results) => {
if (err) {
console.error('查询订单失败:', err.message);
connection.end();
return;
}
console.log('订单总数:', results[0].count);
connection.end();
console.log('验证完成');
});
});
});
});