#!/bin/bash # 一键生成模拟数据脚本 # 使用方法: bash scripts/seed-mock-data.sh set -e echo "🦀 OpenClaw Market 模拟数据生成器" echo "==================================" echo "" # 检查环境变量 if [ -z "$DATABASE_URL" ]; then echo "❌ 错误: DATABASE_URL 环境变量未设置" exit 1 fi if [ -z "$REDIS_URL" ]; then echo "⚠️ 警告: REDIS_URL 环境变量未设置,Redis 同步可能会失败" fi # 步骤 1: 清理旧数据 echo "📦 步骤 1/3: 清理旧数据..." npx tsx scripts/clear-mock-data.ts echo "" # 步骤 2: 生成新数据 echo "📦 步骤 2/3: 生成模拟数据..." npx tsx scripts/generate-mock-data.ts echo "" # 步骤 3: 同步 Redis echo "📦 步骤 3/3: 同步 Redis 统计..." npx tsx scripts/sync-redis-stats.ts echo "" echo "==================================" echo "✨ 全部完成!现在可以启动开发服务器查看效果:" echo " pnpm dev" echo ""