33 lines
1005 B
JavaScript
33 lines
1005 B
JavaScript
const axios = require('axios')
|
|
|
|
async function testEpidemicAPI() {
|
|
try {
|
|
console.log('测试防疫记录API...')
|
|
|
|
// 测试获取列表
|
|
const response = await axios.get('http://localhost:5352/api/epidemic-record/list?page=1&pageSize=5')
|
|
|
|
console.log('API响应状态:', response.status)
|
|
console.log('API响应数据:', JSON.stringify(response.data, null, 2))
|
|
|
|
if (response.data.code === 200) {
|
|
console.log('✅ API调用成功')
|
|
console.log('记录数量:', response.data.data.list.length)
|
|
if (response.data.data.list.length > 0) {
|
|
console.log('第一条记录:', response.data.data.list[0])
|
|
}
|
|
} else {
|
|
console.log('❌ API返回错误:', response.data.message)
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('❌ API调用失败:', error.message)
|
|
if (error.response) {
|
|
console.error('响应状态:', error.response.status)
|
|
console.error('响应数据:', error.response.data)
|
|
}
|
|
}
|
|
}
|
|
|
|
testEpidemicAPI()
|