特性:支持在后台配置结婚离婚冷静期规则,并优化冷却时间文本提示;修复全局的离婚公告事件对象接收名称不匹配问题
This commit is contained in:
@@ -442,7 +442,9 @@ class MarriageService
|
||||
$cooldownEnds = $lastDivorce->divorced_at?->addDays($cooldownDays);
|
||||
|
||||
if ($cooldownEnds && $cooldownEnds->isFuture()) {
|
||||
$remaining = now()->diffInDays($cooldownEnds, false);
|
||||
// 取两者的完全相差天数,如果有部分不够一天的则向上取整为 1 天(例:还剩 2小时 = 1天)
|
||||
$diffInHours = now()->diffInHours($cooldownEnds);
|
||||
$remaining = max(1, (int) ceil($diffInHours / 24));
|
||||
|
||||
return "您还在离婚冷静期,还需 {$remaining} 天后才能再次结婚。";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('sysparam')->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();
|
||||
}
|
||||
};
|
||||
@@ -167,10 +167,13 @@
|
||||
<button x-on:click="doPropose()"
|
||||
:disabled="sending || !selectedRing || rings.length === 0 || !canAfford"
|
||||
style="flex:1; padding:10px 0; border-radius:8px; font-size:13px; font-weight:bold; border:none; transition:all .2s;"
|
||||
:style="(sending || !selectedRing || rings.length === 0 || !canAfford) ?
|
||||
{ background: '#f1f5f9', color: '#94a3b8', cursor: 'not-allowed', boxShadow: 'none' } :
|
||||
{ background: 'linear-gradient(135deg,#be185d,#f43f5e,#ec4899)', color: '#fff',
|
||||
cursor: 'pointer', boxShadow: '0 4px 12px rgba(244,63,94,0.3)' }">
|
||||
:style="(sending || !selectedRing || rings.length === 0 || !canAfford) ? { background: '#f1f5f9',
|
||||
color: '#94a3b8', cursor: 'not-allowed', boxShadow: 'none' } : {
|
||||
background: 'linear-gradient(135deg,#be185d,#f43f5e,#ec4899)',
|
||||
color: '#fff',
|
||||
cursor: 'pointer',
|
||||
boxShadow: '0 4px 12px rgba(244,63,94,0.3)'
|
||||
}">
|
||||
<span x-text="sending ? '💌 发送中…' : '💍 确认求婚'"></span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -982,11 +985,11 @@
|
||||
});
|
||||
window.addEventListener('chat:marriage-divorced', (e) => {
|
||||
const {
|
||||
user_name,
|
||||
partner_name
|
||||
user_username,
|
||||
partner_username
|
||||
} = e.detail;
|
||||
if (typeof appendSystemMessage === 'function') {
|
||||
appendSystemMessage(`💔 ${user_name} 与 ${partner_name} 解除了婚姻关系。`);
|
||||
appendSystemMessage(`💔 ${user_username} 与 ${partner_username} 解除了婚姻关系。`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user