refactor(backend): 重构动物相关 API 接口
- 更新了动物数据结构和相关类型定义 - 优化了动物列表、详情、创建、更新和删除接口 - 新增了更新动物状态接口 - 移除了与认领记录相关的接口 -调整了 API 响应结构
This commit is contained in:
60
check_table_structure.js
Normal file
60
check_table_structure.js
Normal file
@@ -0,0 +1,60 @@
|
||||
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);
|
||||
|
||||
// 检查animals表结构
|
||||
connection.query('DESCRIBE animals', (error, results) => {
|
||||
if (error) {
|
||||
console.error('查询animals表结构失败: ' + error.stack);
|
||||
connection.end();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('\n=== animals表结构 ===');
|
||||
console.table(results);
|
||||
|
||||
// 检查merchants表结构
|
||||
connection.query('DESCRIBE merchants', (error, results) => {
|
||||
if (error) {
|
||||
console.error('查询merchants表结构失败: ' + error.stack);
|
||||
connection.end();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('\n=== merchants表结构 ===');
|
||||
console.table(results);
|
||||
|
||||
// 检查users表结构
|
||||
connection.query('DESCRIBE users', (error, results) => {
|
||||
if (error) {
|
||||
console.error('查询users表结构失败: ' + error.stack);
|
||||
connection.end();
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('\n=== users表结构 ===');
|
||||
console.table(results);
|
||||
|
||||
connection.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user