package database import ( "log" "gotest/internal/model" "gorm.io/gorm" ) // seedAppData 初始化应用数据(3 套应用网站共用) func seedAppData(db *gorm.DB) error { var count int64 db.Model(&model.App{}).Count(&count) if count > 0 { log.Println("检测到已有应用数据,跳过初始化") return nil } // 应用分类 categories := []model.AppCategory{ {Name: "Social & Communication", Icon: "social", Sort: 1}, {Name: "Productivity", Icon: "productivity", Sort: 2}, {Name: "Entertainment", Icon: "entertainment", Sort: 3}, {Name: "Lifestyle", Icon: "lifestyle", Sort: 4}, {Name: "Education", Icon: "education", Sort: 5}, {Name: "Tools & Development", Icon: "tools", Sort: 6}, } for i := range categories { if err := db.Create(&categories[i]).Error; err != nil { return err } } // 应用数据 apps := []model.App{ // Social & Communication {Name: "CloudChat Messenger", Description: "Cross-platform instant messaging app supporting text, voice, and video calls with end-to-end encryption for privacy protection. Group chats support up to 500 members, unlimited file transfers, and permanent multi-device message sync.", CategoryID: 1, CategoryName: "Social & Communication", Developer: "CloudCom Inc.", Rating: 4.8, Reviews: 1280000, Downloads: 56000000, Size: "85 MB", Version: "v8.2.1", UpdateDate: "2026-06-20", Platform: "iOS / Android / PC / Mac", Price: "Free", Tags: `["Instant Messaging","Encryption","Video Calls"]`, Features: `["End-to-End Encryption","500-Person Group Chat","Multi-Device Sync","File Transfer"]`, IsFeatured: true, Sort: 1, Status: 1}, {Name: "PulseCircle Social", Description: "Interest-based social platform to find like-minded friends. AI-powered recommendation algorithm matches interest circles with voice rooms, live streaming, and feed sharing. Making social connections more meaningful.", CategoryID: 1, CategoryName: "Social & Communication", Developer: "Circle Tech", Rating: 4.5, Reviews: 680000, Downloads: 23000000, Size: "120 MB", Version: "v5.6.0", UpdateDate: "2026-07-01", Platform: "iOS / Android", Price: "Free", Tags: `["Interest Social","Voice Rooms","Live Streaming"]`, Features: `["AI Interest Matching","Voice Chat Rooms","Live Interaction","Feed Square"]`, IsNew: true, Sort: 2, Status: 1}, {Name: "MailMaster Pro", Description: "Professional email management tool that aggregates multiple email accounts. Smart categorization, calendar event extraction, and AI draft writing boost email productivity by 300%.", CategoryID: 1, CategoryName: "Social & Communication", Developer: "MailPro Studio", Rating: 4.6, Reviews: 320000, Downloads: 8500000, Size: "45 MB", Version: "v3.4.2", UpdateDate: "2026-05-15", Platform: "iOS / Android / PC / Mac", Price: "Free", Tags: `["Email Management","AI Assistant","Productivity"]`, Features: `["Multi-Account Aggregation","AI Smart Categorization","Auto Calendar Extraction","AI Draft Writing"]`, Sort: 3, Status: 1}, // Productivity {Name: "Notion Notes Pro", Description: "All-in-one workspace combining notes, documents, databases, kanban boards, and calendars. Real-time team collaboration with 50+ content block types and an open API ecosystem.", CategoryID: 2, CategoryName: "Productivity", Developer: "Notion Labs", Rating: 4.9, Reviews: 2100000, Downloads: 45000000, Size: "65 MB", Version: "v10.0.0", UpdateDate: "2026-06-28", Platform: "All Platforms", Price: "Free", Tags: `["Notes","Collaboration","Databases"]`, Features: `["50+ Content Blocks","Real-Time Collaboration","Database Views","Open API"]`, IsFeatured: true, Sort: 1, Status: 1}, {Name: "FeiXiang Project", Description: "Agile project management tool supporting Scrum/Kanban dual modes. Gantt charts, burndown charts, timesheet tracking, and auto-generated reports for more efficient team delivery.", CategoryID: 2, CategoryName: "Productivity", Developer: "FeiXiang Team", Rating: 4.7, Reviews: 890000, Downloads: 15000000, Size: "78 MB", Version: "v6.1.0", UpdateDate: "2026-07-05", Platform: "iOS / Android / PC / Mac", Price: "Free", Tags: `["Project Management","Agile","Collaboration"]`, Features: `["Scrum/Kanban","Gantt Charts","Timesheet Tracking","Auto Reports"]`, IsNew: true, Sort: 2, Status: 1}, {Name: "SnapScan Pro", Description: "Mobile document scanner — take a photo and get a document. AI auto-crop and deskew, OCR text recognition in 50+ languages, PDF/JPEG export, and e-signatures. Your portable office tool.", CategoryID: 2, CategoryName: "Productivity", Developer: "ScanPro", Rating: 4.6, Reviews: 560000, Downloads: 12000000, Size: "38 MB", Version: "v4.2.0", UpdateDate: "2026-04-20", Platform: "iOS / Android", Price: "Free", Tags: `["Scanner","OCR","PDF"]`, Features: `["AI Auto-Crop","50+ Language OCR","E-Signatures","Cloud Sync"]`, Sort: 3, Status: 1}, // Entertainment {Name: "CloudTunes Music", Description: "High-quality music streaming with lossless/Hi-Res audio. AI personalized recommendations, lyric translations, music community, and podcast content. 50M+ track library waiting for you to explore.", CategoryID: 3, CategoryName: "Entertainment", Developer: "CloudMusic", Rating: 4.8, Reviews: 3200000, Downloads: 89000000, Size: "95 MB", Version: "v9.0.0", UpdateDate: "2026-06-15", Platform: "All Platforms", Price: "Free", Tags: `["Music","Lossless","Recommendations"]`, Features: `["Lossless/Hi-Res Audio","AI Personalized Recommendations","50M+ Track Library","Podcast Content"]`, IsFeatured: true, IsNew: true, Sort: 1, Status: 1}, {Name: "CinemaCast Video", Description: "Short-form + long-form video fusion platform. 4K ultra-HD playback, smart skip, danmaku interaction, and creator incentive programs. Massive quality content updated daily.", CategoryID: 3, CategoryName: "Entertainment", Developer: "JiYing Media", Rating: 4.5, Reviews: 1800000, Downloads: 67000000, Size: "110 MB", Version: "v7.3.0", UpdateDate: "2026-07-02", Platform: "iOS / Android / PC", Price: "Free", Tags: `["Video","4K","Danmaku"]`, Features: `["4K Ultra-HD Playback","Smart Skip","Danmaku Interaction","Creator Incentives"]`, Sort: 2, Status: 1}, {Name: "PodNest", Description: "Premium podcast aggregation platform with millions of free shows. Sleep timer, variable speed playback, smart downloads, and offline listening — the perfect companion for your commute.", CategoryID: 3, CategoryName: "Entertainment", Developer: "Podcast Space", Rating: 4.7, Reviews: 420000, Downloads: 9800000, Size: "52 MB", Version: "v3.0.5", UpdateDate: "2026-05-30", Platform: "iOS / Android", Price: "Free", Tags: `["Podcasts","Audio","Offline"]`, Features: `["Millions of Podcasts","Sleep Timer","Smart Download","Offline Listening"]`, Sort: 3, Status: 1}, // Lifestyle {Name: "LifeHub+", Description: "One-stop lifestyle service platform covering food delivery, dining, hotels, flights, movie tickets, ride-hailing, and grocery shopping. Available in 2800+ cities with millions of daily deals.", CategoryID: 4, CategoryName: "Lifestyle", Developer: "LifeHub", Rating: 4.6, Reviews: 5600000, Downloads: 120000000, Size: "180 MB", Version: "v12.5.0", UpdateDate: "2026-07-08", Platform: "iOS / Android", Price: "Free", Tags: `["Delivery","Lifestyle","Deals"]`, Features: `["2800+ City Coverage","Food Delivery & Dining","Hotels & Flights","Millions of Daily Deals"]`, IsFeatured: true, Sort: 1, Status: 1}, {Name: "HealthBuddy", Description: "AI health management app tracking exercise, sleep, diet, and heart rate. AI health reports, personalized workout plans, medication reminders, and online consultations — your personal health manager.", CategoryID: 4, CategoryName: "Lifestyle", Developer: "HealthPlus", Rating: 4.5, Reviews: 780000, Downloads: 18000000, Size: "88 MB", Version: "v5.0.0", UpdateDate: "2026-06-10", Platform: "iOS / Android", Price: "Free", Tags: `["Health","Fitness","AI"]`, Features: `["AI Health Reports","Personalized Workout Plans","Medication Reminders","Online Consultations"]`, Sort: 2, Status: 1}, {Name: "TravelHive", Description: "Smart travel planning assistant that generates itineraries with AI in one tap. Attraction tickets, hotel bookings, local dining, real-time translation, and offline maps — travel made simple.", CategoryID: 4, CategoryName: "Lifestyle", Developer: "TravelHive", Rating: 4.7, Reviews: 950000, Downloads: 25000000, Size: "130 MB", Version: "v4.8.0", UpdateDate: "2026-07-03", Platform: "iOS / Android", Price: "Free", Tags: `["Travel","AI Planning","Translation"]`, Features: `["AI Itinerary Planning","Ticket Booking","Real-Time Translation","Offline Maps"]`, IsNew: true, Sort: 3, Status: 1}, // Education {Name: "LingoQuest", Description: "Gamified language learning app covering 40+ languages. Level-based progression, AI speaking practice, and personalized review curves. Learn a new language in just 15 minutes a day.", CategoryID: 5, CategoryName: "Education", Developer: "LingoQuest Inc.", Rating: 4.8, Reviews: 2800000, Downloads: 78000000, Size: "70 MB", Version: "v6.5.0", UpdateDate: "2026-06-25", Platform: "iOS / Android / PC", Price: "Free", Tags: `["Language Learning","Gamified","Speaking"]`, Features: `["40+ Languages","Level-Based Learning","AI Speaking Practice","Personalized Review"]`, IsFeatured: true, Sort: 1, Status: 1}, {Name: "KnowledgeHub", Description: "Premium knowledge community platform. Join circles in your fields of interest. Industry expert insights, in-depth columns, paid courses, and Q&A interactions — keep learning and growing.", CategoryID: 5, CategoryName: "Education", Developer: "KnowledgeHub", Rating: 4.6, Reviews: 650000, Downloads: 14000000, Size: "58 MB", Version: "v5.2.0", UpdateDate: "2026-05-18", Platform: "iOS / Android / PC", Price: "Free", Tags: `["Knowledge Community","Courses","Q&A"]`, Features: `["Industry Circles","In-Depth Columns","Paid Courses","Q&A Interactions"]`, Sort: 2, Status: 1}, {Name: "MathMaster AI", Description: "AI math solver — snap a photo and get the solution. Covers elementary through university math with detailed step-by-step explanations, knowledge point mapping, and similar problem recommendations.", CategoryID: 5, CategoryName: "Education", Developer: "MathMaster", Rating: 4.5, Reviews: 890000, Downloads: 22000000, Size: "62 MB", Version: "v3.8.0", UpdateDate: "2026-06-12", Platform: "iOS / Android", Price: "Free", Tags: `["Math","AI Solver","Education"]`, Features: `["Photo Math Solver","Step-by-Step Explanations","Knowledge Mapping","Similar Problems"]`, IsNew: true, Sort: 3, Status: 1}, // Tools & Development {Name: "DevBox Code Editor", Description: "Professional mobile code editor with syntax highlighting for 80+ programming languages. Git integration, SSH terminal, AI code completion, and regex testing — code anywhere, anytime.", CategoryID: 6, CategoryName: "Tools & Development", Developer: "DevBox Studio", Rating: 4.7, Reviews: 560000, Downloads: 6500000, Size: "92 MB", Version: "v4.0.0", UpdateDate: "2026-07-06", Platform: "iOS / Android / PC", Price: "Free", Tags: `["Code Editor","Git","SSH"]`, Features: `["80+ Language Highlighting","Git Integration","SSH Terminal","AI Code Completion"]`, IsFeatured: true, Sort: 1, Status: 1}, {Name: "APIMaster Pro", Description: "Professional API debugging tool supporting REST/GraphQL/WebSocket. Environment variable management, batch testing, performance stress testing, and automated test scripts — essential for frontend-backend collaboration.", CategoryID: 6, CategoryName: "Tools & Development", Developer: "APIMaster", Rating: 4.6, Reviews: 340000, Downloads: 4200000, Size: "48 MB", Version: "v2.5.0", UpdateDate: "2026-06-08", Platform: "iOS / Android / PC / Mac", Price: "Free", Tags: `["API","Debugging","Testing"]`, Features: `["REST/GraphQL/WebSocket","Environment Variables","Stress Testing","Automation Scripts"]`, Sort: 2, Status: 1}, {Name: "FileMaster X", Description: "All-in-one file management tool with 100+ format preview support. ZIP/RAR/7Z extraction, PDF merge and split, batch image processing, and cloud drive aggregation — the ultimate mobile file manager.", CategoryID: 6, CategoryName: "Tools & Development", Developer: "FileMasterX", Rating: 4.5, Reviews: 720000, Downloads: 15000000, Size: "55 MB", Version: "v6.0.0", UpdateDate: "2026-05-25", Platform: "iOS / Android", Price: "Free", Tags: `["File Manager","Extraction","PDF"]`, Features: `["100+ Format Preview","Multi-Format Extraction","PDF Processing","Cloud Drive Aggregation"]`, Sort: 3, Status: 1}, } for i := range apps { if err := db.Create(&apps[i]).Error; err != nil { return err } } log.Printf("应用数据初始化完成(%d 分类 + %d 应用)", len(categories), len(apps)) return nil }