2026-03-01 14:56:47 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 文件功能:婚姻系统初始数据 Seeder
|
|
|
|
|
|
*
|
|
|
|
|
|
* 写入以下默认数据:
|
|
|
|
|
|
* 1. marriage_configs — 约30条可配置参数(亲密度/魅力/离婚/时间规则)
|
|
|
|
|
|
* 2. wedding_tiers — 5个婚礼档位
|
|
|
|
|
|
* 3. shop_items — 3种戒指道具(ring_silver/ring_gold/ring_diamond)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author ChatRoom Laravel
|
|
|
|
|
|
*
|
|
|
|
|
|
* @version 1.0.0
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
|
|
|
|
class MarriageSystemSeeder extends Seeder
|
|
|
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 写入婚姻系统初始配置数据。
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function run(): void
|
|
|
|
|
|
{
|
|
|
|
|
|
$now = Carbon::now();
|
|
|
|
|
|
|
|
|
|
|
|
// ── 1. marriage_configs ──────────────────────────────────────
|
|
|
|
|
|
$configs = [
|
|
|
|
|
|
// 【亲密度加分规则】
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_daily_time', 'value' => 10, 'label' => '每日时间奖励', 'description' => '每天00:00给所有婚姻对各加的亲密度', 'min' => 1, 'max' => 100],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_online_per_min', 'value' => 1, 'label' => '同时在线(每分钟)', 'description' => '双方同时在线每分钟增加的亲密度', 'min' => 0, 'max' => 10],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_online_daily_cap', 'value' => 120, 'label' => '同时在线每日上限', 'description' => '每日因同时在线最多可得亲密度(约2小时)', 'min' => 0, 'max' => 1440],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_recv_flower', 'value' => 2, 'label' => '收到伴侣送花(每朵)', 'description' => '收到伴侣送花时每朵花增加的亲密度', 'min' => 0, 'max' => 20],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_recv_flower_cap', 'value' => 40, 'label' => '收花每日上限', 'description' => '每日因收花最多可得亲密度', 'min' => 0, 'max' => 500],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_send_flower', 'value' => 1, 'label' => '向伴侣送花(每朵)', 'description' => '向伴侣送花时每朵花增加的亲密度(送方)', 'min' => 0, 'max' => 10],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_send_flower_cap', 'value' => 20, 'label' => '送花每日上限', 'description' => '每日因送花最多可得亲密度', 'min' => 0, 'max' => 200],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_private_chat', 'value' => 1, 'label' => '私聊加分', 'description' => '每2条私信获得1亲密度', 'min' => 0, 'max' => 10],
|
|
|
|
|
|
['group' => '亲密度加分', 'key' => 'intimacy_private_chat_cap', 'value' => 10, 'label' => '私聊每日上限', 'description' => '每日因私聊最多可得亲密度', 'min' => 0, 'max' => 100],
|
|
|
|
|
|
|
|
|
|
|
|
// 【戒指魅力加成与初始亲密度】
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_silver_charm', 'value' => 50, 'label' => '银戒指魅力加成', 'description' => '双方各获得的魅力值(结婚时一次性)', 'min' => 0, 'max' => 9999],
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_gold_charm', 'value' => 150, 'label' => '金戒指魅力加成', 'description' => '双方各获得的魅力值(结婚时一次性)', 'min' => 0, 'max' => 9999],
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_diamond_charm', 'value' => 500, 'label' => '钻戒魅力加成', 'description' => '双方各获得的魅力值(结婚时一次性)', 'min' => 0, 'max' => 99999],
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_silver_intimacy', 'value' => 10, 'label' => '银戒指初始亲密度', 'description' => '结婚时一次性赠予的亲密度(银戒)', 'min' => 0, 'max' => 500],
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_gold_intimacy', 'value' => 30, 'label' => '金戒指初始亲密度', 'description' => '结婚时一次性赠予的亲密度(金戒)', 'min' => 0, 'max' => 500],
|
|
|
|
|
|
['group' => '戒指参数', 'key' => 'ring_diamond_intimacy', 'value' => 80, 'label' => '钻戒初始亲密度', 'description' => '结婚时一次性赠予的亲密度(钻戒)', 'min' => 0, 'max' => 1000],
|
|
|
|
|
|
|
|
|
|
|
|
// 【婚姻等级阈值】
|
|
|
|
|
|
['group' => '婚姻等级', 'key' => 'level2_threshold', 'value' => 200, 'label' => '等级2(恩爱夫妻)阈值', 'description' => '达到此亲密度后升至等级2', 'min' => 1, 'max' => 9999],
|
|
|
|
|
|
['group' => '婚姻等级', 'key' => 'level3_threshold', 'value' => 600, 'label' => '等级3(情深意重)阈值', 'description' => '达到此亲密度后升至等级3', 'min' => 1, 'max' => 9999],
|
|
|
|
|
|
['group' => '婚姻等级', 'key' => 'level4_threshold', 'value' => 1500, 'label' => '等级4(白头偕老)阈值', 'description' => '达到此亲密度后升至等级4', 'min' => 1, 'max' => 99999],
|
|
|
|
|
|
|
|
|
|
|
|
// 【离婚惩罚】
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_mutual_charm', 'value' => 100, 'label' => '协议离婚魅力惩罚', 'description' => '双方各扣减魅力(填正数,系统取负)', 'min' => 0, 'max' => 9999],
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_forced_charm', 'value' => 300, 'label' => '强制离婚魅力惩罚', 'description' => '强制方扣减魅力', 'min' => 0, 'max' => 9999],
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_auto_charm', 'value' => 150, 'label' => '超时自动离婚惩罚', 'description' => '发起方扣减魅力(72h无响应自动解除)', 'min' => 0, 'max' => 9999],
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_mutual_cooldown', 'value' => 70, 'label' => '协议离婚冷静期(天)', 'description' => '协议离婚后多少天内不可再次结婚', 'min' => 0, 'max' => 365],
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_forced_cooldown', 'value' => 90, 'label' => '强制离婚冷静期(天)', 'description' => '强制方多少天内不可再次结婚', 'min' => 0, 'max' => 365],
|
|
|
|
|
|
['group' => '离婚惩罚', 'key' => 'divorce_auto_cooldown', 'value' => 30, 'label' => '超时自动离婚冷静期', 'description' => '发起方多少天内不可再次结婚', 'min' => 0, 'max' => 365],
|
2026-03-01 18:27:19 +08:00
|
|
|
|
['group' => '离婚惩罚', 'key' => 'forced_divorce_limit_days', 'value' => 60, 'label' => '强制离婚间隔(天)', 'description' => '多少天内只能使用强制离婚1次', 'min' => 0, 'max' => 365],
|
2026-03-01 14:56:47 +08:00
|
|
|
|
|
|
|
|
|
|
// 【时间规则】
|
|
|
|
|
|
['group' => '时间规则', 'key' => 'proposal_expire_hours', 'value' => 48, 'label' => '求婚有效期(小时)', 'description' => '超时后戒指消失、求婚作废', 'min' => 1, 'max' => 168],
|
|
|
|
|
|
['group' => '时间规则', 'key' => 'divorce_request_timeout', 'value' => 72, 'label' => '离婚申请等待时长(小时)', 'description' => '协议离婚后对方多久不响应则自动升级为强制', 'min' => 1, 'max' => 168],
|
|
|
|
|
|
['group' => '时间规则', 'key' => 'envelope_expire_hours', 'value' => 24, 'label' => '婚礼红包有效期(小时)', 'description' => '超时未领取的红包自动消失(不退还)', 'min' => 1, 'max' => 72],
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($configs as &$row) {
|
|
|
|
|
|
$row['created_at'] = $now;
|
|
|
|
|
|
$row['updated_at'] = $now;
|
|
|
|
|
|
}
|
|
|
|
|
|
unset($row);
|
|
|
|
|
|
|
|
|
|
|
|
DB::table('marriage_configs')->upsert($configs, ['key'], ['value', 'label', 'description', 'min', 'max', 'updated_at']);
|
|
|
|
|
|
|
|
|
|
|
|
// ── 2. wedding_tiers ─────────────────────────────────────────
|
|
|
|
|
|
$tiers = [
|
|
|
|
|
|
['tier' => 1, 'name' => '小小祝福', 'icon' => '⭐', 'amount' => 5888, 'description' => '小小心意,愿新人幸福美满!', 'is_active' => true],
|
|
|
|
|
|
['tier' => 2, 'name' => '甜蜜相拥', 'icon' => '⭐⭐', 'amount' => 28888, 'description' => '诚意满满,共享甜蜜时光!', 'is_active' => true],
|
|
|
|
|
|
['tier' => 3, 'name' => '盛世婚礼', 'icon' => '⭐⭐⭐', 'amount' => 68888, 'description' => '盛世婚宴,全场同贺!', 'is_active' => true],
|
|
|
|
|
|
['tier' => 4, 'name' => '豪华盛典', 'icon' => '⭐⭐⭐⭐', 'amount' => 128888, 'description' => '贵族婚礼,普天同庆,豪气冲天!', 'is_active' => true],
|
|
|
|
|
|
['tier' => 5, 'name' => '传世佳话', 'icon' => '⭐⭐⭐⭐⭐', 'amount' => 288888, 'description' => '传说级婚礼,流芳百世,共见证!', 'is_active' => true],
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($tiers as &$t) {
|
|
|
|
|
|
$t['created_at'] = $now;
|
|
|
|
|
|
$t['updated_at'] = $now;
|
|
|
|
|
|
}
|
|
|
|
|
|
unset($t);
|
|
|
|
|
|
|
|
|
|
|
|
DB::table('wedding_tiers')->upsert($tiers, ['tier'], ['name', 'icon', 'amount', 'description', 'is_active', 'updated_at']);
|
|
|
|
|
|
|
|
|
|
|
|
// ── 3. shop_items — 三种戒指 ─────────────────────────────────
|
|
|
|
|
|
// 先查询 shop_items 的当前最大 sort_order
|
|
|
|
|
|
$maxSort = DB::table('shop_items')->max('sort_order') ?? 0;
|
|
|
|
|
|
|
|
|
|
|
|
$rings = [
|
|
|
|
|
|
[
|
|
|
|
|
|
'name' => '银戒指',
|
|
|
|
|
|
'slug' => 'ring_silver',
|
|
|
|
|
|
'icon' => '💍',
|
|
|
|
|
|
'description' => '用银戒指求婚,表达心意。结婚时双方各获 +50 魅力,初始亲密度 +10。',
|
|
|
|
|
|
'price' => 3888,
|
|
|
|
|
|
'type' => 'ring',
|
|
|
|
|
|
'duration_days' => null,
|
|
|
|
|
|
'is_active' => true,
|
|
|
|
|
|
'sort_order' => $maxSort + 1,
|
|
|
|
|
|
],
|
|
|
|
|
|
[
|
|
|
|
|
|
'name' => '金戒指',
|
|
|
|
|
|
'slug' => 'ring_gold',
|
|
|
|
|
|
'icon' => '💎',
|
|
|
|
|
|
'description' => '用金戒指求婚,彰显诚意。结婚时双方各获 +150 魅力,初始亲密度 +30。',
|
|
|
|
|
|
'price' => 12888,
|
|
|
|
|
|
'type' => 'ring',
|
|
|
|
|
|
'duration_days' => null,
|
|
|
|
|
|
'is_active' => true,
|
|
|
|
|
|
'sort_order' => $maxSort + 2,
|
|
|
|
|
|
],
|
|
|
|
|
|
[
|
|
|
|
|
|
'name' => '钻戒',
|
|
|
|
|
|
'slug' => 'ring_diamond',
|
|
|
|
|
|
'icon' => '👑',
|
|
|
|
|
|
'description' => '顶级钻戒,永结同心!结婚时双方各获 +500 魅力,初始亲密度 +80。',
|
|
|
|
|
|
'price' => 38888,
|
|
|
|
|
|
'type' => 'ring',
|
|
|
|
|
|
'duration_days' => null,
|
|
|
|
|
|
'is_active' => true,
|
|
|
|
|
|
'sort_order' => $maxSort + 3,
|
|
|
|
|
|
],
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($rings as &$r) {
|
|
|
|
|
|
$r['created_at'] = $now;
|
|
|
|
|
|
$r['updated_at'] = $now;
|
|
|
|
|
|
}
|
|
|
|
|
|
unset($r);
|
|
|
|
|
|
|
|
|
|
|
|
DB::table('shop_items')->upsert($rings, ['slug'], [
|
|
|
|
|
|
'name', 'icon', 'description', 'price', 'type', 'duration_days', 'is_active', 'sort_order', 'updated_at',
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
$this->command->info('✅ 婚姻系统初始数据写入完成:'.count($configs).' 条配置 + 5 个婚礼档位 + 3 种戒指');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|