变更:求婚及离婚弹窗在有效期内重新刷新必现,并移除全局提示框的点击背景蒙层关闭功能强制操作

This commit is contained in:
2026-03-01 18:08:50 +08:00
parent 5bcbf74dfc
commit d7c6e0e7a8
3 changed files with 61 additions and 8 deletions

View File

@@ -198,6 +198,43 @@ class ChatController extends Controller
// 8. 好友上线通知:向此房间内在线的好友推送慧慧话
$this->notifyFriendsOnline($id, $user->username);
// 9. 检查是否有未处理的求婚
$pendingProposal = \App\Models\Marriage::with(['user', 'ringItem'])
->where('partner_id', $user->id)
->where('status', 'pending')
->first();
$pendingProposalData = null;
if ($pendingProposal) {
$pendingProposalData = [
'marriage_id' => $pendingProposal->id,
'proposer_name' => $pendingProposal->user?->username ?? '',
'ring_name' => $pendingProposal->ringItem?->name ?? '',
'ring_icon' => $pendingProposal->ringItem?->icon ?? '',
'expires_at' => $pendingProposal->expires_at?->diffForHumans() ?? '',
];
}
// 10. 检查是否有未处理的协议离婚请求(对方发起的)
$pendingDivorce = \App\Models\Marriage::with(['user', 'partner'])
->where('status', 'married')
->where('divorce_type', 'mutual')
->whereNotNull('divorcer_id')
->where('divorcer_id', '!=', $user->id)
->where(function($q) use ($user) {
$q->where('user_id', $user->id)->orWhere('partner_id', $user->id);
})
->first();
$pendingDivorceData = null;
if ($pendingDivorce) {
$initiator = $pendingDivorce->user_id === $pendingDivorce->divorcer_id ? $pendingDivorce->user : $pendingDivorce->partner;
$pendingDivorceData = [
'marriage_id' => $pendingDivorce->id,
'initiator_name' => $initiator?->username ?? '',
];
}
// 渲染主聊天框架视图
return view('chat.frame', [
'room' => $room,
@@ -205,6 +242,8 @@ class ChatController extends Controller
'weekEffect' => $this->shopService->getActiveWeekEffect($user),
'newbieEffect' => $newbieEffect,
'historyMessages' => $historyMessages,
'pendingProposal' => $pendingProposalData,
'pendingDivorce' => $pendingDivorceData,
]);
}