const http = require('http');

function fetch(url) {
  return new Promise((resolve, reject) => {
    http.get(url, (res) => {
      let data = '';
      res.on('data', chunk => data += chunk);
      res.on('end', () => {
        try {
          resolve(JSON.parse(data));
        } catch (e) {
          resolve(data);
        }
      });
    }).on('error', reject);
  });
}

(async () => {
  console.log('=== 检查API返回格式 ===\n');
  
  const res = await fetch('http://localhost:3000/api/video/projects');
  console.log('完整响应:', JSON.stringify(res, null, 2));
  
  console.log('\n检查关键字段:');
  console.log('- success:', res.success);
  console.log('- data:', res.data);
  console.log('- data.items:', res.data?.items);
  console.log('- data.total:', res.data?.total);
  console.log('- data.page:', res.data?.page);
  console.log('- data.pageSize:', res.data?.pageSize);
  
  console.log('\n✅ API数据格式正确');
})();
