diff --git a/database/migrations/2026_03_01_181247_add_divorce_cooldown_to_sysparam.php b/database/migrations/2026_03_01_181247_add_divorce_cooldown_to_sysparam.php deleted file mode 100644 index 9088ed2..0000000 --- a/database/migrations/2026_03_01_181247_add_divorce_cooldown_to_sysparam.php +++ /dev/null @@ -1,40 +0,0 @@ -insertOrIgnore([ - [ - 'alias' => 'divorce_mutual_cooldown', - 'guidetxt' => '协议离婚冷静期(天)', - 'body' => '70' - ], - [ - 'alias' => 'divorce_forced_cooldown', - 'guidetxt' => '强制离婚冷静期(天)', - 'body' => '70' - ], - [ - 'alias' => 'divorce_auto_cooldown', - 'guidetxt' => '系统强制离婚冷静期(天)', - 'body' => '70' - ], - ]); - } - - public function down(): void - { - DB::table('sysparam')->whereIn('alias', [ - 'divorce_mutual_cooldown', - 'divorce_forced_cooldown', - 'divorce_auto_cooldown' - ])->delete(); - } -}; diff --git a/database/migrations/2026_03_01_181922_add_divorce_cooldown_to_marriage_configs.php b/database/migrations/2026_03_01_181922_add_divorce_cooldown_to_marriage_configs.php new file mode 100644 index 0000000..61667b6 --- /dev/null +++ b/database/migrations/2026_03_01_181922_add_divorce_cooldown_to_marriage_configs.php @@ -0,0 +1,62 @@ +insertOrIgnore([ + [ + 'group' => '时间规则', + 'key' => 'divorce_mutual_cooldown', + 'value' => 70, + 'label' => '协议离婚冷静期(天)', + 'description' => '协议离婚成功后,多少天内不能再次结婚 (支持设置为 0)', + 'min' => 0, + 'max' => 365, + 'created_at' => now(), + 'updated_at' => now(), + ], + [ + 'group' => '时间规则', + 'key' => 'divorce_auto_cooldown', + 'value' => 70, + 'label' => '系统强制离婚冷静期(天)', + 'description' => '单方面申请协议离婚但对方不管,导致超时后系统强制离婚的冷静期', + 'min' => 0, + 'max' => 365, + 'created_at' => now(), + 'updated_at' => now(), + ], + ]); + + // 由于离婚有 mutual, auto, forced 等,我们同时添加 forced 参数的插入以防遗漏 + DB::table('marriage_configs')->insertOrIgnore([ + [ + 'group' => '时间规则', + 'key' => 'divorce_forced_cooldown', + 'value' => 70, + 'label' => '单方强制离婚冷静期(天)', + 'description' => '通过单方面强制解除契约功能导致的离婚冷静期', + 'min' => 0, + 'max' => 365, + 'created_at' => now(), + 'updated_at' => now(), + ] + ]); + } + + public function down(): void + { + DB::table('marriage_configs')->whereIn('key', [ + 'divorce_mutual_cooldown', + 'divorce_auto_cooldown', + 'divorce_forced_cooldown', + ])->delete(); + } +};