You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
975 B

const http = require('http');
// 测试客服获取聊天列表API
const managerId = '22'; // 从日志中看到的managerId
const options = {
hostname: 'localhost',
port: 3003,
path: `/api/conversations/manager/${managerId}`,
method: 'GET'
};
console.log(`正在测试客服聊天列表API: http://localhost:3003/api/conversations/manager/${managerId}`);
const req = http.request(options, (res) => {
console.log(`状态码: ${res.statusCode}`);
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
try {
const response = JSON.parse(data);
console.log('响应数据:', JSON.stringify(response, null, 2));
console.log('测试完成。检查是否成功获取聊天列表。');
} catch (e) {
console.log('响应内容:', data);
console.log('解析错误:', e.message);
}
});
});
req.on('error', (e) => {
console.error(`请求错误: ${e.message}`);
});
req.end();