Files
openclaw-market/scripts/seed-mock-data.sh
2026-03-16 08:52:44 +08:00

41 lines
942 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/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 ""