fix: 修复后台求婚记录列表未显示已成功和已离婚记录的问题

This commit is contained in:
2026-03-12 12:33:28 +08:00
parent 909d578547
commit d827c8a1df
5 changed files with 367 additions and 2 deletions

View File

@@ -90,7 +90,6 @@ class MarriageManagerController extends Controller
public function proposals(Request $request): View
{
$proposals = Marriage::with(['user:id,username', 'partner:id,username', 'ringItem:id,name,icon'])
->whereIn('status', ['pending', 'expired', 'rejected'])
->orderByDesc('proposed_at')
->paginate(20)
->withQueryString();

View File

@@ -45,9 +45,11 @@
'pending' => 'bg-amber-100 text-amber-700',
'rejected' => 'bg-red-100 text-red-600',
'expired' => 'bg-gray-100 text-gray-500',
'married' => 'bg-emerald-100 text-emerald-700',
'divorced' => 'bg-purple-100 text-purple-700',
default => 'bg-gray-100 text-gray-600',
} }}">
{{ ['pending' => '⏳ 等待中', 'rejected' => '❌ 已拒绝', 'expired' => '⏰ 已过期'][$p->status] ?? $p->status }}
{{ ['pending' => '⏳ 等待中', 'rejected' => '❌ 已拒绝', 'expired' => '⏰ 已过期', 'married' => '✅ 已结婚', 'divorced' => '💔 已离婚'][$p->status] ?? $p->status }}
</span>
</td>
<td class="px-4 py-3 text-xs text-gray-500">{{ $p->proposed_at?->format('Y-m-d H:i') }}</td>

345
test-render-auth.html Normal file
View File

@@ -0,0 +1,345 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="A3jgj4el3Z9EeYrcBnQhuRUBMWQxfmjlJjGG8fby">
<title>后台管理 - 流星</title>
<link rel="preload" as="style" href="http://localhost/build/assets/app-Bti5LOEg.css" /><link rel="modulepreload" as="script" href="http://localhost/build/assets/app-CjXcQpaB.js" /><link rel="stylesheet" href="http://localhost/build/assets/app-Bti5LOEg.css" /><script type="module" src="http://localhost/build/assets/app-CjXcQpaB.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
</head>
<body class="bg-gray-100 flex h-screen text-gray-800">
<!-- 左侧侧边栏 -->
<aside class="w-64 bg-slate-900 text-white flex flex-col">
<div class="p-6 text-center border-b border-white/10">
<h2 class="text-2xl font-extrabold tracking-widest uppercase">Admin</h2>
<p class="text-xs text-slate-400 mt-2">控制台</p>
</div>
<nav class="flex-1 px-4 py-6 space-y-2 overflow-y-auto">
<a href="http://localhost/admin"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📊 仪表盘
</a>
<a href="http://localhost/admin/currency-stats"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📈 积分流水统计
</a>
<a href="http://localhost/admin/users"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
👥 用户管理
</a>
<div class="border-t border-white/10 my-2"></div>
<a href="http://localhost/admin/my-duty-logs"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📝 我的履职记录
</a>
<a href="http://localhost/admin/appointments"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🎖️ 任命管理
</a>
<div class="border-t border-white/10 my-2"></div>
<p class="px-4 text-xs text-slate-500 uppercase tracking-widest mb-1">
站长功能</p>
<a href="http://localhost/admin/system"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
⚙️ 聊天室参数
</a>
<a href="http://localhost/admin/rooms"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🏠 房间管理
</a>
<a href="http://localhost/admin/autoact"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🎲 随机事件
</a>
<a href="http://localhost/admin/vip"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
👑 VIP 会员等级
</a>
<a href="http://localhost/admin/shop"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🛒 商店管理
</a>
<a href="http://localhost/admin/marriages"
class="block px-4 py-3 rounded-md transition bg-indigo-600 font-bold">
💒 婚姻管理
</a>
<a href="http://localhost/admin/holiday-events"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🎊 节日福利
</a>
<a href="http://localhost/admin/game-configs"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🎮 游戏管理
</a>
<a href="http://localhost/admin/fishing"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🎣 钓鱼事件
</a>
<a href="http://localhost/admin/departments"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🏛️ 部门管理
</a>
<a href="http://localhost/admin/positions"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📋 职务管理
</a>
<div class="border-t border-white/10 my-2"></div>
<p class="px-4 text-xs text-slate-500 uppercase tracking-widest mb-1">系统配置</p>
<a href="http://localhost/admin/smtp"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📧 邮件 SMTP 配置
</a>
<a href="http://localhost/admin/ai-providers"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🤖 AI 厂商配置
</a>
<a href="http://localhost/admin/ops"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🛠️ 运维工具
</a>
<a href="http://localhost/admin/changelogs"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
📋 开发日志
</a>
<a href="http://localhost/admin/feedback"
class="flex items-center justify-between px-4 py-3 rounded-md transition hover:bg-white/10">
<span>💬 用户反馈</span>
<span
class="bg-orange-500 text-white text-xs px-1.5 py-0.5 rounded-full font-bold">1</span>
</a>
<a href="http://localhost/admin/forbidden-usernames"
class="block px-4 py-3 rounded-md transition hover:bg-white/10">
🚫 禁用用户名
</a>
</nav>
<div class="p-4 border-t border-white/10">
<a href="http://localhost/rooms"
class="block w-full text-center px-4 py-2 bg-slate-800 hover:bg-slate-700 rounded transition text-sm">
返回前台大厅
</a>
</div>
</aside>
<!-- 右侧主体内容 -->
<main class="flex-1 flex flex-col h-full overflow-hidden relative">
<!-- 顶栏 -->
<header class="bg-white shadow relative z-20 flex items-center justify-between px-6 py-4">
<h1 class="text-xl font-bold text-gray-700">求婚记录</h1>
<div class="flex items-center space-x-4">
<span class="text-sm font-medium">当前操作人: <span
class="text-indigo-600">lkddi</span></span>
</div>
</header>
<!-- 内容滚动区 -->
<div class="flex-1 overflow-y-auto p-6 relative z-10">
<div class="flex items-center justify-between mb-5">
<h2 class="text-xl font-bold text-gray-800">💌 求婚记录</h2>
<a href="http://localhost/admin/marriages" class="text-sm text-indigo-600 hover:underline">← 返回总览</a>
</div>
<div class="bg-white rounded-xl shadow-sm border overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead class="bg-gray-50 text-xs uppercase text-gray-600">
<tr>
<th class="px-4 py-3 text-left">ID</th>
<th class="px-4 py-3 text-left">发起方</th>
<th class="px-4 py-3 text-left">目标</th>
<th class="px-4 py-3 text-left">戒指</th>
<th class="px-4 py-3 text-center">状态</th>
<th class="px-4 py-3 text-left">求婚时间</th>
<th class="px-4 py-3 text-left">过期时间</th>
<th class="px-4 py-3 text-center">操作</th>
</tr>
</thead>
<tbody class="divide-y">
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-gray-400 font-mono text-xs">3</td>
<td class="px-4 py-3 font-bold">lkddi</td>
<td class="px-4 py-3 font-bold">测试2</td>
<td class="px-4 py-3"></td>
<td class="px-4 py-3 text-center">
<span
class="px-2 py-0.5 rounded-full text-xs font-bold
bg-red-100 text-red-600">
❌ 已拒绝
</span>
</td>
<td class="px-4 py-3 text-xs text-gray-500">2026-03-01 18:29</td>
<td
class="px-4 py-3 text-xs text-red-400">
2026-03-03 18:29
</td>
<td class="px-4 py-3 text-center">
<span class="text-gray-300 text-xs"></span>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-4 py-3 text-gray-400 font-mono text-xs">2</td>
<td class="px-4 py-3 font-bold">lkddi</td>
<td class="px-4 py-3 font-bold">测试2</td>
<td class="px-4 py-3"></td>
<td class="px-4 py-3 text-center">
<span
class="px-2 py-0.5 rounded-full text-xs font-bold
bg-red-100 text-red-600">
❌ 已拒绝
</span>
</td>
<td class="px-4 py-3 text-xs text-gray-500">2026-03-01 18:28</td>
<td
class="px-4 py-3 text-xs text-red-400">
2026-03-03 18:28
</td>
<td class="px-4 py-3 text-center">
<span class="text-gray-300 text-xs"></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</main>
<div id="admin-dialog-overlay"
style="display:none; position:fixed; inset:0; background:rgba(15,23,42,.55);
backdrop-filter:blur(3px); z-index:99999; align-items:center; justify-content:center;">
<div id="admin-dialog-box"
style="background:#fff; border-radius:16px; box-shadow:0 24px 64px rgba(0,0,0,.22);
min-width:320px; max-width:480px; width:90%; padding:32px 32px 24px; text-align:center;
animation:admin-dialog-pop .25s cubic-bezier(.175,.885,.32,1.275);">
<div id="admin-dialog-icon" style="font-size:36px; margin-bottom:10px;"></div>
<div id="admin-dialog-title" style="font-size:16px; font-weight:800; color:#1e293b; margin-bottom:8px;">
</div>
<div id="admin-dialog-msg" style="font-size:14px; color:#475569; line-height:1.6; margin-bottom:20px;">
</div>
<div id="admin-dialog-btns" style="display:flex; gap:10px; justify-content:center;"></div>
</div>
</div>
<style>
@keyframes admin-dialog-pop {
0% {
opacity: 0;
transform: scale(.8);
}
70% {
transform: scale(1.03);
}
100% {
opacity: 1;
transform: scale(1);
}
}
</style>
<script>
/**
* 后台全局弹窗组件。
*
* 提供 alert / confirm 两种模式,替换原生 alert/confirm。
*/
window.adminDialog = (function() {
const overlay = document.getElementById('admin-dialog-overlay');
const box = document.getElementById('admin-dialog-box');
const elIcon = document.getElementById('admin-dialog-icon');
const elTitle = document.getElementById('admin-dialog-title');
const elMsg = document.getElementById('admin-dialog-msg');
const elBtns = document.getElementById('admin-dialog-btns');
/** 关闭弹窗 */
function close() {
overlay.style.display = 'none';
}
/** 点击遮罩层关闭 */
overlay.addEventListener('click', function(e) {
if (e.target === overlay) close();
});
/**
* 创建按钮元素
*
* @param {string} label 按钮文字
* @param {string} color 按钮背景色
* @param {Function} onClick 点击回调
*/
function makeBtn(label, color, onClick) {
const btn = document.createElement('button');
btn.textContent = label;
btn.style.cssText = `padding:9px 24px; border-radius:8px; border:none; cursor:pointer;
font-size:14px; font-weight:700; color:#fff; background:${color};
transition:opacity .15s; box-shadow:0 3px 10px rgba(0,0,0,.12);`;
btn.onmouseover = () => btn.style.opacity = '.82';
btn.onmouseout = () => btn.style.opacity = '1';
btn.addEventListener('click', () => {
close();
if (onClick) onClick();
});
return btn;
}
/**
* 弹出提示框(仅「确定」按钮)
*
* @param {string} message 消息内容(支持 HTML
* @param {string} title 标题
* @param {string} icon 图标 Emoji
* @param {Function} onOk 确定回调
*/
function alert(message, title = '提示', icon = '', onOk = null) {
elIcon.textContent = icon;
elTitle.textContent = title;
elMsg.innerHTML = message;
elBtns.innerHTML = '';
elBtns.appendChild(makeBtn('确定', '#4f46e5', onOk));
overlay.style.display = 'flex';
}
/**
* 弹出确认框(「确定」+「取消」按钮)
*
* @param {string} message 消息内容
* @param {string} title 标题
* @param {Function} onConfirm 确认回调
* @param {string} icon 图标 Emoji
*/
function confirm(message, title = '确认操作', onConfirm = null, icon = '⚠️') {
elIcon.textContent = icon;
elTitle.textContent = title;
elMsg.innerHTML = message;
elBtns.innerHTML = '';
const confirmBtn = makeBtn('确定', '#4f46e5', onConfirm);
const cancelBtn = makeBtn('取消', '#94a3b8', null);
elBtns.appendChild(confirmBtn);
elBtns.appendChild(cancelBtn);
overlay.style.display = 'flex';
}
return {
alert,
confirm,
close
};
})();
</script>
</body>
</html>

12
test-render.html Normal file
View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='http://localhost'" />
<title>Redirecting to http://localhost</title>
</head>
<body>
Redirecting to <a href="http://localhost">http://localhost</a>.
</body>
</html>

7
test_proposals.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
$proposals = \App\Models\Marriage::with(['user:id,username', 'partner:id,username', 'ringItem:id,name,icon'])
->whereIn('status', ['pending', 'expired', 'rejected'])
->orderByDesc('proposed_at')
->paginate(20);
echo view('admin.marriages.proposals', compact('proposals'))->render();