Files
jiebanke/db_verify.js
ylweng 8e5295b572 refactor(backend): 重构动物相关 API 接口
- 更新了动物数据结构和相关类型定义
- 优化了动物列表、详情、创建、更新和删除接口
- 新增了更新动物状态接口
- 移除了与认领记录相关的接口
-调整了 API 响应结构
2025-08-31 00:45:46 +08:00

65 lines
1.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const mysql = require('mysql2');
// 数据库配置
const dbConfig = {
host: '129.211.213.226',
port: 9527,
user: 'root',
password: 'aiotAiot123!',
database: 'jiebandata'
};
// 创建连接
const connection = mysql.createConnection(dbConfig);
// 连接数据库
connection.connect((err) => {
if (err) {
console.error('数据库连接失败: ' + err.stack);
return;
}
console.log('数据库连接成功连接ID: ' + connection.threadId);
// 查询管理员表结构
connection.query('DESCRIBE admins', (error, results) => {
if (error) {
console.error('查询管理员表结构失败: ' + error.stack);
connection.end();
return;
}
console.log('\n=== 管理员表结构 ===');
console.table(results.map(row => ({
字段: row.Field,
类型: row.Type,
: row.Null,
: row.Key,
默认值: row.Default,
额外: row.Extra
})));
// 查询管理员数据
connection.query('SELECT * FROM admins', (error, results) => {
if (error) {
console.error('查询管理员数据失败: ' + error.stack);
connection.end();
return;
}
console.log('\n=== 管理员数据 ===');
console.table(results.map(row => ({
ID: row.id,
用户名: row.username,
邮箱: row.email,
昵称: row.nickname,
角色: row.role,
状态: row.status,
创建时间: row.created_at,
最后登录: row.last_login
})));
console.log('\n✅ 数据库验证完成');
connection.end();
});
});
});