72 lines
12 KiB
Go
72 lines
12 KiB
Go
package database
|
|
|
|
import (
|
|
"log"
|
|
|
|
"gotest/internal/model"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func seedGameData(db *gorm.DB) error {
|
|
var count int64
|
|
db.Model(&model.Game{}).Count(&count)
|
|
if count > 0 {
|
|
log.Println("检测到已有游戏数据,跳过初始化")
|
|
return nil
|
|
}
|
|
|
|
categories := []model.GameCategory{
|
|
{Name: "Action Adventure", Icon: "action", Sort: 1},
|
|
{Name: "RPG", Icon: "rpg", Sort: 2},
|
|
{Name: "Strategy & Simulation", Icon: "strategy", Sort: 3},
|
|
{Name: "Casual & Puzzle", Icon: "casual", Sort: 4},
|
|
{Name: "Sports & Racing", Icon: "sports", Sort: 5},
|
|
{Name: "Shooter & Combat", Icon: "shooter", Sort: 6},
|
|
}
|
|
for i := range categories {
|
|
if err := db.Create(&categories[i]).Error; err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
games := []model.Game{
|
|
// Action Adventure
|
|
{Name: "Shadow Epoch: Awakening", Description: "Open-world action adventure epic. Explore a vast fantasy continent, battle ancient dragons, and uncover the secrets of lost civilizations. Fluid combat system, stunning visuals, and over 100 hours of main storyline await you.", CategoryID: 1, CategoryName: "Action Adventure", Developer: "Phoenix Studio", Publisher: "Nexus Games", Rating: 4.9, Plays: 890000, Downloads: 560000, Size: "45.2 GB", Version: "v2.1.0", ReleaseDate: "2026-03-15", Platform: "PC / PS5 / Xbox", Tags: `["Open World","Dragons","Epic"]`, Features: `["Seamless Open World","Real-time Combat System","Dynamic Weather","Multiple Endings"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Ninja Blade: Shadow Step", Description: "Hardcore action game blending ninjutsu and assassination. Set in Japan's Warring States period, play as the last shadow ninja and eliminate enemies with speed and skill. Pixel-perfect controls and satisfying combo system.", CategoryID: 1, CategoryName: "Action Adventure", Developer: "Shadow Forge", Publisher: "Nexus Games", Rating: 4.7, Plays: 450000, Downloads: 280000, Size: "18.5 GB", Version: "v1.3.2", ReleaseDate: "2026-01-20", Platform: "PC / Switch", Tags: `["Ninjutsu","Hardcore","Combos"]`, Features: `["Precision Parry System","Ninjutsu Skill Tree","No-UI Immersion Mode","Speedrun Leaderboard"]`, IsHot: true, Sort: 2, Status: 1},
|
|
{Name: "Deep Sea Mystery", Description: "Underwater exploration survival game. Gather resources, build bases, and discover ancient ruins in a mysterious deep-sea world. Beware of the colossal creatures lurking in the darkness.", CategoryID: 1, CategoryName: "Action Adventure", Developer: "Abyss Team", Publisher: "Ocean Interactive", Rating: 4.5, Plays: 320000, Downloads: 190000, Size: "22.0 GB", Version: "v1.0.5", ReleaseDate: "2026-05-01", Platform: "PC / PS5", Tags: `["Survival","Underwater","Exploration"]`, Features: `["Deep-sea Ecosystem","Base Building","Multiplayer Co-op"]`, IsNew: true, Sort: 3, Status: 1},
|
|
|
|
// RPG
|
|
{Name: "Stellar Chronicles", Description: "Sci-fi MMORPG epic. Embark on an intergalactic adventure, choose your race and class, and write stellar history alongside millions of players. Highly customizable skill builds and gear systems.", CategoryID: 2, CategoryName: "RPG", Developer: "Galaxy Works", Publisher: "Nexus Games", Rating: 4.8, Plays: 1200000, Downloads: 890000, Size: "80.0 GB", Version: "v5.0.1", ReleaseDate: "2025-11-10", Platform: "PC / Mobile", Tags: `["MMORPG","Sci-Fi","Multiplayer"]`, Features: `["6 Races, 12 Classes","Starfleet Battles","Player Economy System","Cross-server PvP"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Phantom Spirits: Rebirth", Description: "Classic Japanese RPG revival. Hand-drawn art style, deeply moving storyline, and a revamped turn-based combat system. Collect 200+ phantom spirit companions and build your ultimate team.", CategoryID: 2, CategoryName: "RPG", Developer: "Dreamlight", Publisher: "Square Nexus", Rating: 4.7, Plays: 670000, Downloads: 450000, Size: "12.8 GB", Version: "v3.2.0", ReleaseDate: "2026-02-28", Platform: "PC / Switch / Mobile", Tags: `["JRPG","Turn-based","Collection"]`, Features: `["200+ Spirit Collection","Hand-drawn Animation","Branching Storylines","Pet Raising"]`, Sort: 2, Status: 1},
|
|
{Name: "Immortal Cultivation Records", Description: "Chinese fantasy open-world RPG. Progress from mortal to immortal, experiencing the complete cultivation system. Soar on swords, refine pills and artifacts, and transcend tribulations to ascend. Immerse yourself in the beauty of Eastern fantasy.", CategoryID: 2, CategoryName: "RPG", Developer: "Cloud Sea Studio", Publisher: "Immortal Realm Interactive", Rating: 4.6, Plays: 980000, Downloads: 720000, Size: "35.0 GB", Version: "v2.0.0", ReleaseDate: "2026-04-01", Platform: "PC / Mobile", Tags: `["Xianxia","Open World","Chinese Fantasy"]`, Features: `["Cultivation Realm System","Sword Flying","Pill & Artifact Refinement","Sect Warfare"]`, IsNew: true, IsHot: true, Sort: 3, Status: 1},
|
|
|
|
// Strategy & Simulation
|
|
{Name: "Empire Dawn: Rise of Civilizations", Description: "4X strategy epic. Lead your nation from the Stone Age through interstellar civilization across ten thousand years of history. Diplomacy, warfare, technology, and culture — multiple paths to victory. Supports up to 12-player multiplayer.", CategoryID: 3, CategoryName: "Strategy & Simulation", Developer: "Strategy Labs", Publisher: "Nexus Games", Rating: 4.8, Plays: 560000, Downloads: 340000, Size: "28.0 GB", Version: "v4.1.0", ReleaseDate: "2026-01-05", Platform: "PC / Mac", Tags: `["4X","Civilization","Strategy"]`, Features: `["10,000-Year Civilization Evolution","12-Player Multiplayer","Random Map Generation","Tech Tree System"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Stellar Pioneers", Description: "Space colonization simulation. Build your interstellar empire, develop planetary resources, research technologies, and interact or compete with alien civilizations. Sandbox-style freeform gameplay.", CategoryID: 3, CategoryName: "Strategy & Simulation", Developer: "Cosmic Dev", Publisher: "Space Games", Rating: 4.5, Plays: 380000, Downloads: 210000, Size: "15.0 GB", Version: "v1.5.0", ReleaseDate: "2026-03-20", Platform: "PC", Tags: `["Simulation","Space","Management"]`, Features: `["Planet Colonization","Technology Research","Diplomacy System","Sandbox Mode"]`, Sort: 2, Status: 1},
|
|
{Name: "Farm Story: Four Seasons", Description: "Cozy farming simulation. Plant crops, raise animals, fish, mine, and make friends. Beautiful scenery across four seasons in a heartwarming village life. Supports 4-player cooperative multiplayer.", CategoryID: 3, CategoryName: "Strategy & Simulation", Developer: "Green Valley", Publisher: "Harvest Games", Rating: 4.7, Plays: 720000, Downloads: 520000, Size: "8.5 GB", Version: "v2.3.0", ReleaseDate: "2026-02-14", Platform: "PC / Switch / Mobile", Tags: `["Farming","Cozy","Multiplayer"]`, Features: `["Four-Season Farm Management","4-Player Co-op","Villager Socializing","Festival Events"]`, IsHot: true, Sort: 3, Status: 1},
|
|
|
|
// Casual & Puzzle
|
|
{Name: "Block Crusher: Infinite", Description: "Classic match-3 gameplay fully reimagined. Hundreds of meticulously designed levels, abundant power-ups and obstacles, weekly limited-time events. Easy to pick up, hard to put down.", CategoryID: 4, CategoryName: "Casual & Puzzle", Developer: "Fun Factory", Publisher: "Casual Games", Rating: 4.6, Plays: 3500000, Downloads: 2800000, Size: "320 MB", Version: "v8.0.0", ReleaseDate: "2026-04-15", Platform: "Mobile / PC", Tags: `["Match-3","Casual","Limited-time Events"]`, Features: `["500+ Levels","Weekly Events","Social Leaderboards","Offline Play"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Mind Master", Description: "Creative brain teaser collection. 1000+ brain-bending puzzles that test your lateral thinking and creativity. Every level has an unexpected solution that will leave you thrilled.", CategoryID: 4, CategoryName: "Casual & Puzzle", Developer: "Brain Box", Publisher: "Puzzle Games", Rating: 4.4, Plays: 1800000, Downloads: 1200000, Size: "150 MB", Version: "v3.0.0", ReleaseDate: "2026-05-10", Platform: "Mobile", Tags: `["Puzzle","Brain Teaser","Creative"]`, Features: `["1000+ Puzzles","Daily Challenge","Hint System","Achievement Collection"]`, IsNew: true, Sort: 2, Status: 1},
|
|
{Name: "Note Jump", Description: "Music rhythm game. Jump to the beat and feel the perfect fusion of music and gameplay. 100+ licensed popular tracks with multiple difficulty levels to choose from.", CategoryID: 4, CategoryName: "Casual & Puzzle", Developer: "Rhythm Works", Publisher: "Music Games", Rating: 4.5, Plays: 920000, Downloads: 680000, Size: "680 MB", Version: "v2.1.0", ReleaseDate: "2026-03-01", Platform: "Mobile / PC", Tags: `["Music","Rhythm","Reflexes"]`, Features: `["100+ Licensed Tracks","Multiple Difficulties","Custom Charts","Global Rankings"]`, Sort: 3, Status: 1},
|
|
|
|
// Sports & Racing
|
|
{Name: "Speed Blitz: Neon City", Description: "Cyberpunk-style racing game. Race through neon-lit futuristic streets, customize your supercar, and push your limits on extreme tracks. Supports 16-player online racing.", CategoryID: 5, CategoryName: "Sports & Racing", Developer: "Turbo Studio", Publisher: "Racing Games", Rating: 4.7, Plays: 680000, Downloads: 430000, Size: "55.0 GB", Version: "v2.0.0", ReleaseDate: "2026-04-20", Platform: "PC / PS5 / Xbox", Tags: `["Racing","Cyberpunk","Customization"]`, Features: `["16-Player Online","Vehicle Customization","Open City","Dynamic Weather"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Green Turf Legend 2026", Description: "Next-generation football simulation. Official player licensing and motion-captured animations down to every detail. All-new tactical system and deep manager mode. Official esports tournament game.", CategoryID: 5, CategoryName: "Sports & Racing", Developer: "Sports Pro", Publisher: "Champion Games", Rating: 4.6, Plays: 1100000, Downloads: 820000, Size: "65.0 GB", Version: "v2026.1", ReleaseDate: "2026-01-01", Platform: "PC / PS5 / Xbox / Switch", Tags: `["Football","Simulation","Esports"]`, Features: `["Official Player Licensing","Manager Mode","Online Matches","UT Card System"]`, Sort: 2, Status: 1},
|
|
|
|
// Shooter & Combat
|
|
{Name: "Tactical Vanguard: Zero Hour", Description: "5v5 tactical FPS combat. Precise gunplay, rich tactical equipment, and fair competitive play with no pay-to-win. Ranked matches, casual games, and zombie mode — everything you could want.", CategoryID: 6, CategoryName: "Shooter & Combat", Developer: "Tactical Ops", Publisher: "Nexus Games", Rating: 4.8, Plays: 2500000, Downloads: 1800000, Size: "40.0 GB", Version: "v6.0", ReleaseDate: "2025-12-01", Platform: "PC / Console", Tags: `["FPS","5v5","Esports"]`, Features: `["Precise Gunplay","Tactical Equipment System","Ranked Competitive","Zombie Mode"]`, IsHot: true, Sort: 1, Status: 1},
|
|
{Name: "Stellar Frame: Expedition", Description: "PvE cooperative shooter RPG. Play as a star soldier in customizable warframes, wielding superpowers and advanced weapons to complete epic missions with your team. 50+ warframes available.", CategoryID: 6, CategoryName: "Shooter & Combat", Developer: "Digital Forge", Publisher: "Space Games", Rating: 4.7, Plays: 1300000, Downloads: 950000, Size: "50.0 GB", Version: "v3.5.0", ReleaseDate: "2026-02-10", Platform: "PC / PS5 / Xbox", Tags: `["PvE","Warframes","Co-op"]`, Features: `["50+ Customizable Warframes","4-Player Co-op","Open World Missions","Free to Play"]`, IsHot: true, Sort: 2, Status: 1},
|
|
{Name: "Wild Survival: Battle Royale", Description: "100-player battle royale. Parachute in, scavenge gear, survive the shrinking zone, and be the last one standing. Multiple maps and modes with realistic ballistics. The ultimate tactical competition experience.", CategoryID: 6, CategoryName: "Shooter & Combat", Developer: "Battle Royal", Publisher: "Nexus Games", Rating: 4.6, Plays: 3200000, Downloads: 2500000, Size: "35.0 GB", Version: "v12.0", ReleaseDate: "2026-03-01", Platform: "PC / Mobile / Console", Tags: `["Battle Royale","100 Players","Tactical"]`, Features: `["100-Player Battles","Multi-map Modes","Realistic Ballistics","Free to Play"]`, IsNew: true, IsHot: true, Sort: 3, Status: 1},
|
|
}
|
|
for i := range games {
|
|
if err := db.Create(&games[i]).Error; err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
log.Printf("游戏数据初始化完成(%d 分类 + %d 游戏)", len(categories), len(games))
|
|
return nil
|
|
}
|