#!/bin/bash echo "=== 读取订单数据 ===" cat /www/huishou/server/data/orders.json echo "" echo "=== 修复订单时间格式 ===" docker exec huishou-backend-1 node -e " const fs = require('fs'); const orders = JSON.parse(fs.readFileSync('/app/server/data/orders.json', 'utf-8')); orders.forEach(o => { if (o.createTime && o.createTime.includes('T')) { const date = new Date(o.createTime); o.createTime = \`\${date.getFullYear()}-\${String(date.getMonth() + 1).padStart(2, '0')}-\${String(date.getDate()).padStart(2, '0')} \${String(date.getHours()).padStart(2, '0')}:\${String(date.getMinutes()).padStart(2, '0')}\`; } }); fs.writeFileSync('/app/server/data/orders.json', JSON.stringify(orders, null, 2)); console.log('时间格式修复完成'); " echo "" echo "=== 验证修复结果 ===" cat /www/huishou/server/data/orders.json | head -100 echo "" echo "=== 重启后端容器 ===" cd /www/huishou && docker-compose restart backend echo "" echo "=== 等待5秒后测试API ===" sleep 5 echo "" echo "=== 测试订单列表API ===" curl -s http://127.0.0.1:4000/api/orders