Files
chatroom/database/seeders/ShopItemSeeder.php

62 lines
3.6 KiB
PHP
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.
<?php
/**
* 文件功能:商店初始商品数据填充器
* 初始化9种商品4种单次特效卡 + 4种周卡 + 改名卡
*
* @package Database\Seeders
*/
namespace Database\Seeders;
use App\Models\ShopItem;
use Illuminate\Database\Seeder;
class ShopItemSeeder extends Seeder
{
/**
* 填充商店商品初始数据
*/
public function run(): void
{
$items = [
// ── 单次特效卡立即播放一次888金币────────────────
['name' => '烟花单次卡', 'slug' => 'once_fireworks', 'icon' => '🎆',
'description' => '购买即刻在聊天室绽放一场烟花(仅自己可见),喜庆氛围拉满!',
'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 1],
['name' => '下雨单次卡', 'slug' => 'once_rain', 'icon' => '🌧',
'description' => '立刻召唤一场滂沱大雨,感受诗意雨天(仅自己可见)。',
'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 2],
['name' => '雷电单次卡', 'slug' => 'once_lightning', 'icon' => '⚡',
'description' => '电闪雷鸣,瞬间震撼全场!立即触发雷电特效(仅自己可见)。',
'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 3],
['name' => '下雪单次卡', 'slug' => 'once_snow', 'icon' => '❄️',
'description' => '银装素裹,漫天飞雪!立即触发下雪特效(仅自己可见)。',
'price' => 888, 'type' => 'instant', 'duration_days' => null, 'sort_order' => 4],
// ── 周卡登录自动播放7天8888金币──────────────────
['name' => '烟花周卡', 'slug' => 'week_fireworks', 'icon' => '🎆',
'description' => '连续7天每次进入聊天室自动绽放烟花同时只能激活一种周卡。',
'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 11],
['name' => '下雨周卡', 'slug' => 'week_rain', 'icon' => '🌧',
'description' => '连续7天每次进入聊天室自动下雨。同时只能激活一种周卡。',
'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 12],
['name' => '雷电周卡', 'slug' => 'week_lightning', 'icon' => '⚡',
'description' => '连续7天每次进入聊天室自动触发雷电特效。同时只能激活一种周卡。',
'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 13],
['name' => '下雪周卡', 'slug' => 'week_snow', 'icon' => '❄️',
'description' => '连续7天每次进入聊天室自动下雪。同时只能激活一种周卡。',
'price' => 8888, 'type' => 'duration', 'duration_days' => 7, 'sort_order' => 14],
// ── 改名卡一次性5000金币────────────────────────
['name' => '改名卡', 'slug' => 'rename_card', 'icon' => '🎭',
'description' => '使用后可修改一次昵称旧名保留30天黑名单不可被他人注册。注意历史聊天记录中的旧名不会更改。',
'price' => 5000, 'type' => 'one_time', 'duration_days' => null, 'sort_order' => 20],
];
foreach ($items as $item) {
ShopItem::firstOrCreate(['slug' => $item['slug']], $item + ['is_active' => true]);
}
}
}