v1.1.0: AI回复max_tokens调优 + 商品编辑(标题/价格/描述) + API密钥掩码

- ai_reply_engine.py: 意图识别max_tokens=100, 回复生成max_tokens=2048
  (deepseek-v4-flash推理模型思考吃光token导致回复为空)
- 商品管理弹窗新增标题/价格/描述编辑, 写入本地item_info
  (闲鱼网页版不支持改真实商品, 界面已注明)
- GET ai-reply-settings密钥掩码 sk-4****27QK, PUT含****保留原值
- 新增自定义Dockerfile固化max_tokens补丁
- 新增.gitignore排除.env/data/logs/db, 仓库不含密钥
This commit is contained in:
jinghui committed 2026-10-22 12:07:09 +08:00
commit 198ccd3976
63 files changed
+46452

No files matched your search

+227
View File
@@ -0,0 +1,227 @@
/* ================================
【账号管理菜单】相关样式
================================ */
.status-toggle {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}
.status-toggle input {
opacity: 0;
width: 0;
height: 0;
}
.status-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}
.status-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .status-slider {
background-color: #10b981;
}
input:checked + .status-slider:before {
transform: translateX(26px);
}
.status-badge {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.25rem 0.5rem;
border-radius: 12px;
font-size: 0.875rem;
font-weight: 500;
min-width: 2rem;
height: 1.5rem;
}
.status-badge.enabled {
background: #dcfce7;
color: #166534;
border: 1px solid #bbf7d0;
}
.status-badge.disabled {
background: #fef2f2;
color: #991b1b;
border: 1px solid #fecaca;
}
.account-row.disabled {
opacity: 0.6;
background-color: #f9fafb;
}
.account-row.disabled .cookie-value {
background-color: #f3f4f6;
}
/* 关键词管理界面的状态提示 */
.account-badge .badge.bg-warning {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.7; }
100% { opacity: 1; }
}
.disabled-account-notice {
background: #fef3c7;
border: 1px solid #f59e0b;
border-radius: 8px;
padding: 0.75rem;
margin-bottom: 1rem;
color: #92400e;
}
.disabled-account-notice .bi {
color: #f59e0b;
}
/* 扫码登录按钮特殊样式 */
.qr-login-btn {
background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
border: none;
box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.qr-login-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
}
.qr-login-btn:active {
transform: translateY(0);
}
.qr-login-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
transition: left 0.5s;
}
.qr-login-btn:hover::before {
left: 100%;
}
/* 二维码容器样式 */
.qr-code-wrapper {
border: 3px solid #28a745;
box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
transition: all 0.3s ease;
}
.qr-code-wrapper:hover {
box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}
/* 步骤指引样式 */
.step-item {
text-align: center;
}
.step-number {
font-weight: bold;
font-size: 14px;
box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}
/* 手动输入按钮样式 */
.manual-input-btn {
transition: all 0.3s ease;
}
.manual-input-btn:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
}
/* 等待提示样式 */
.bg-light-warning {
background-color: #fff3cd !important;
}
.qr-loading-tip {
animation: pulse-warning 2s infinite;
}
@keyframes pulse-warning {
0% {
opacity: 0.8;
}
50% {
opacity: 1;
}
100% {
opacity: 0.8;
}
}
/* 响应式设计 */
@media (max-width: 768px) {
.status-toggle {
width: 40px;
height: 20px;
}
.status-slider:before {
height: 14px;
width: 14px;
left: 3px;
bottom: 3px;
}
input:checked + .status-slider:before {
transform: translateX(20px);
}
.qr-login-btn, .manual-input-btn {
margin-bottom: 10px;
font-size: 0.9rem;
}
.step-item {
margin-bottom: 15px;
}
.step-number {
width: 25px !important;
height: 25px !important;
font-size: 12px;
}
}
+405
View File
@@ -0,0 +1,405 @@
/* ================================
管理员功能样式 - 用户管理和数据管理
================================ */
/* 用户管理样式 */
.user-card {
transition: transform 0.2s ease, box-shadow 0.2s ease;
border: 1px solid var(--border-color);
border-radius: 12px;
}
.user-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
.user-card .card-body {
padding: 1.25rem;
}
.user-card .badge {
font-size: 0.75rem;
padding: 0.375rem 0.75rem;
}
/* 数据管理样式 */
.table-container {
max-height: 600px;
overflow-y: auto;
border: 1px solid var(--border-color);
border-radius: 8px;
}
.table th {
position: sticky;
top: 0;
background: var(--dark-color);
color: white;
z-index: 10;
border: none;
font-weight: 600;
font-size: 0.875rem;
padding: 0.75rem;
}
.table td {
padding: 0.75rem;
font-size: 0.875rem;
border-bottom: 1px solid var(--border-color);
vertical-align: middle;
}
.table tbody tr:hover {
background-color: rgba(79, 70, 229, 0.05);
}
/* 数据统计卡片 */
.data-stats {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
color: white;
border: none;
}
.data-stats .card-body {
padding: 0.75rem;
}
/* 表格状态样式 */
#loadingTable,
#noTableSelected,
#noTableData {
padding: 3rem 1rem;
}
#loadingTable .spinner-border {
width: 3rem;
height: 3rem;
border-width: 0.3em;
}
#noTableSelected i,
#noTableData i {
font-size: 4rem;
color: var(--secondary-color);
opacity: 0.5;
}
/* 按钮组样式 */
.btn-group .btn {
border-radius: 0;
}
.btn-group .btn:first-child {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.btn-group .btn:last-child {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
/* 表格选择器样式 */
#tableSelect {
border: 2px solid var(--border-color);
border-radius: 8px;
padding: 0.75rem;
font-size: 0.875rem;
transition: border-color 0.2s ease;
}
#tableSelect:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}
/* 记录计数样式 */
#recordCount {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary-color);
}
/* 响应式调整 */
@media (max-width: 768px) {
.user-card {
margin-bottom: 1rem;
}
.table-container {
max-height: 400px;
}
.table th,
.table td {
padding: 0.5rem;
font-size: 0.8rem;
}
.btn-group {
flex-direction: column;
}
.btn-group .btn {
border-radius: 6px !important;
margin-bottom: 0.25rem;
}
}
/* 加载状态动画 */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.user-card,
.table-container {
animation: fadeIn 0.3s ease-out;
}
/* 表格滚动条样式 */
.table-container::-webkit-scrollbar {
width: 8px;
}
.table-container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb {
background: var(--secondary-color);
border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb:hover {
background: var(--primary-color);
}
/* 文本截断样式 */
.text-truncate-custom {
max-width: 200px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
/* 状态徽章样式 */
.status-badge {
font-size: 0.75rem;
padding: 0.25rem 0.5rem;
border-radius: 12px;
}
/* 工具提示样式增强 */
[title] {
cursor: help;
}
/* 空状态图标样式 */
.empty-state-icon {
font-size: 4rem;
color: var(--secondary-color);
opacity: 0.3;
margin-bottom: 1rem;
}
/* 操作按钮样式 */
.action-buttons .btn {
margin: 0 0.125rem;
padding: 0.375rem 0.75rem;
}
.action-buttons .btn-sm {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
/* ================================
系统使用手册样式
================================ */
.manual-wrapper {
display: flex;
min-height: 100%;
}
.manual-sidebar {
width: 220px;
flex-shrink: 0;
background: #fff;
border-right: 1px solid var(--border-color);
position: sticky;
top: 0;
height: 100%;
overflow-y: auto;
align-self: flex-start;
}
.manual-sidebar-header {
padding: 1rem 1.25rem;
font-weight: 700;
font-size: 0.95rem;
color: var(--dark-color);
border-bottom: 1px solid var(--border-color);
background: #f9fafb;
}
.manual-nav {
display: flex;
flex-direction: column;
padding: 0.5rem 0;
}
.manual-nav-link {
display: block;
padding: 0.6rem 1.25rem;
color: var(--secondary-color);
text-decoration: none;
font-size: 0.875rem;
border-left: 3px solid transparent;
transition: all 0.2s ease;
}
.manual-nav-link:hover {
color: var(--primary-color);
background: rgba(79, 70, 229, 0.04);
border-left-color: var(--primary-light);
}
.manual-nav-link.active {
color: var(--primary-color);
background: rgba(79, 70, 229, 0.06);
border-left-color: var(--primary-color);
font-weight: 600;
}
.manual-content {
flex: 1;
padding: 2rem 2.5rem;
}
.manual-section {
margin-bottom: 2.5rem;
padding-bottom: 2rem;
border-bottom: 1px solid #f0f0f0;
}
.manual-section:last-of-type {
border-bottom: none;
margin-bottom: 1rem;
}
.manual-section-title {
font-size: 1.35rem;
font-weight: 700;
color: var(--dark-color);
margin-bottom: 0.75rem;
padding-bottom: 0.5rem;
border-bottom: 2px solid var(--primary-color);
display: inline-block;
}
.manual-desc {
color: var(--secondary-color);
font-size: 0.95rem;
margin-bottom: 1.25rem;
line-height: 1.6;
}
.manual-section h4 {
font-size: 1rem;
font-weight: 600;
color: var(--dark-color);
margin-top: 1.25rem;
margin-bottom: 0.5rem;
}
.manual-section ul,
.manual-section ol {
padding-left: 1.5rem;
margin-bottom: 0.75rem;
}
.manual-section li {
font-size: 0.9rem;
line-height: 1.7;
color: #374151;
margin-bottom: 0.25rem;
}
.manual-section li strong {
color: var(--dark-color);
}
.manual-tip,
.manual-warn {
margin-top: 0.75rem;
padding: 0.75rem 1rem;
border-radius: 8px;
font-size: 0.85rem;
line-height: 1.5;
}
.manual-tip {
background: #ecfdf5;
border: 1px solid #a7f3d0;
color: #065f46;
}
.manual-warn {
background: #fef2f2;
border: 1px solid #fecaca;
color: #991b1b;
}
.manual-footer {
margin-top: 1rem;
padding-top: 1rem;
}
.manual-sidebar::-webkit-scrollbar {
width: 5px;
}
.manual-sidebar::-webkit-scrollbar-track {
background: transparent;
}
.manual-sidebar::-webkit-scrollbar-thumb {
background: #d1d5db;
border-radius: 3px;
}
@media (max-width: 992px) {
.manual-sidebar {
display: none;
}
.manual-content {
padding: 1.5rem;
}
}
/* 统计卡片渐变背景 */
.stats-card-primary {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}
.stats-card-info {
background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}
.stats-card-success {
background: linear-gradient(135deg, var(--success-color) 0%, #0d9488 100%);
}
.stats-card-warning {
background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
}
+13
View File
@@ -0,0 +1,13 @@
@import url('variables.css');
@import url('layout.css');
@import url('dashboard.css');
@import url('logs.css');
@import url('keywords.css');
@import url('accounts.css');
@import url('items.css');
@import url('notifications.css');
@import url('components.css');
@import url('admin.css');
+403
View File
@@ -0,0 +1,403 @@
/* ================================
通用卡片样式 - 适用于所有菜单的卡片
================================ */
.card {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 16px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
margin-bottom: 2rem;
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.card-header {
background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
color: white;
border: none;
border-radius: 16px 16px 0 0 !important;
font-weight: 600;
font-size: 1.1rem;
padding: 1.25rem 1.5rem;
}
.card-body {
padding: 1.5rem;
}
.btn {
border-radius: 10px;
font-weight: 500;
transition: all 0.3s ease;
padding: 0.5rem 1rem;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.btn-primary {
background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
border: none;
}
.btn-success {
background: linear-gradient(135deg, var(--success-color), #059669);
border: none;
}
.btn-danger {
background: linear-gradient(135deg, var(--danger-color), #dc2626);
border: none;
}
.btn-outline-primary {
border: 2px solid var(--primary-color);
color: var(--primary-color);
}
.btn-outline-primary:hover {
background: var(--primary-color);
border-color: var(--primary-color);
color: white;
}
.btn-outline-success {
border: 2px solid var(--success-color);
color: var(--success-color);
}
.btn-outline-success:hover {
background: var(--success-color);
border-color: var(--success-color);
color: white;
}
.btn-outline-info {
border: 2px solid #0dcaf0;
color: #0dcaf0;
}
.btn-outline-info:hover {
background: #0dcaf0;
border-color: #0dcaf0;
color: white;
}
.btn-outline-danger {
border: 2px solid var(--danger-color);
color: var(--danger-color);
}
.btn-outline-danger:hover {
background: var(--danger-color);
border-color: var(--danger-color);
color: white;
}
/* ================================
通用表格样式 - 适用于所有菜单的表格
================================ */
.table {
margin-bottom: 0;
background: transparent;
}
.table th {
border-top: none;
border-bottom: 2px solid var(--border-color);
font-weight: 600;
color: var(--dark-color);
background: rgba(79, 70, 229, 0.05);
padding: 1rem;
}
.table td {
padding: 1rem;
border-bottom: 1px solid var(--border-color);
vertical-align: middle;
}
.table tbody tr:hover {
background: rgba(79, 70, 229, 0.02);
}
.badge {
font-weight: 500;
padding: 5px 10px;
}
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.cookie-value {
font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
font-size: 0.85rem;
background: #f8fafc;
padding: 0.75rem;
border-radius: 8px;
border: 1px solid #e5e7eb;
word-break: break-all;
line-height: 1.4;
max-height: 120px;
overflow-y: auto;
white-space: pre-wrap;
}
.loading {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255,255,255,0.7);
display: flex;
align-items: center;
justify-content: center;
z-index: 9999;
}
.loading-spinner {
width: 3rem;
height: 3rem;
}
.keyword-editor {
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.modal-content {
border-radius: 10px;
border: none;
}
.modal-header {
border-bottom: 1px solid rgba(0,0,0,0.05);
}
.modal-footer {
border-top: 1px solid rgba(0,0,0,0.05);
}
.cookie-id {
font-weight: 600;
color: var(--primary-color);
font-size: 1rem;
}
.empty-state {
text-align: center;
padding: 3rem 2rem;
color: var(--secondary-color);
}
.empty-state i {
opacity: 0.5;
}
.form-control, .form-select {
border-radius: 10px;
border: 2px solid var(--border-color);
transition: all 0.3s ease;
padding: 0.75rem 1rem;
}
.form-control:focus, .form-select:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
transform: translateY(-1px);
}
.form-label {
font-weight: 600;
color: var(--dark-color);
margin-bottom: 0.5rem;
}
/* ================================
通用模态框样式 - 适用于所有菜单的模态框
================================ */
.modal-content {
border: none;
border-radius: 16px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
backdrop-filter: blur(10px);
}
.modal-header {
background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
color: white;
border: none;
border-radius: 16px 16px 0 0;
}
.toast-container {
position: fixed;
bottom: 20px;
right: 20px;
z-index: 9999;
}
.toast {
border: none;
border-radius: 12px;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
backdrop-filter: blur(10px);
}
.btn-group .btn {
margin-right: 0.25rem;
}
.btn-group .btn:last-child {
margin-right: 0;
}
@media (max-width: 768px) {
.container {
margin-top: 1rem;
padding: 0 1rem;
}
.card-body {
padding: 1rem;
}
.btn {
font-size: 0.875rem;
padding: 0.375rem 0.75rem;
}
.cookie-value {
font-size: 0.75rem;
max-height: 80px;
}
.btn-group {
flex-direction: column;
}
.btn-group .btn {
margin-right: 0;
margin-bottom: 0.25rem;
}
/* 移动端商品表格优化 */
#itemsTableBody .btn-group {
flex-direction: row;
}
#itemsTableBody .btn-group .btn {
padding: 0.2rem 0.4rem;
font-size: 0.75rem;
}
}
/* ================================
API参数提示样式
================================ */
.param-item {
display: flex;
align-items: center;
padding: 0.25rem 0;
}
.param-name {
background-color: #f8f9fa;
color: #495057;
padding: 0.2rem 0.4rem;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
font-weight: 500;
border: 1px solid #dee2e6;
cursor: pointer;
transition: all 0.2s ease;
min-width: 120px;
display: inline-block;
}
.param-name:hover {
background-color: #e9ecef;
border-color: #adb5bd;
transform: translateY(-1px);
}
#postParamsHelp,
#editPostParamsHelp {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 1rem;
}
#postParamsHelp .alert,
#editPostParamsHelp .alert {
margin-bottom: 0;
border-radius: 6px;
}
/* 参数项点击效果 */
.param-name:active {
transform: translateY(0);
background-color: #dee2e6;
}
/* ================================
API参数提示样式
================================ */
.param-item {
display: flex;
align-items: center;
padding: 0.25rem 0;
}
.param-name {
background-color: #f8f9fa;
color: #495057;
padding: 0.2rem 0.4rem;
border-radius: 4px;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
font-weight: 500;
border: 1px solid #dee2e6;
cursor: pointer;
transition: all 0.2s ease;
min-width: 120px;
display: inline-block;
}
.param-name:hover {
background-color: #e9ecef;
border-color: #adb5bd;
transform: translateY(-1px);
}
#postParamsHelp,
#editPostParamsHelp {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 8px;
padding: 1rem;
}
#postParamsHelp .alert,
#editPostParamsHelp .alert {
margin-bottom: 0;
border-radius: 6px;
}
/* 参数项点击效果 */
.param-name:active {
transform: translateY(0);
background-color: #dee2e6;
}
+68
View File
@@ -0,0 +1,68 @@
/* 仪表盘样式 */
.dashboard-stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
/* ================================
【仪表盘菜单】相关样式
================================ */
.stat-card {
background: white;
border-radius: 12px;
padding: 1.5rem;
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-color);
transition: all 0.3s ease;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
.stat-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
margin-bottom: 1rem;
}
.stat-icon.primary {
background: rgba(79, 70, 229, 0.1);
color: var(--primary-color);
}
.stat-icon.success {
background: rgba(16, 185, 129, 0.1);
color: var(--success-color);
}
.stat-icon.warning {
background: rgba(245, 158, 11, 0.1);
color: var(--warning-color);
}
.stat-icon.info {
background: rgba(59, 130, 246, 0.1);
color: #3b82f6;
}
.stat-number {
font-size: 2rem;
font-weight: 700;
color: var(--dark-color);
margin-bottom: 0.5rem;
}
.stat-label {
color: var(--secondary-color);
font-size: 0.875rem;
font-weight: 500;
}
+52
View File
@@ -0,0 +1,52 @@
/* ================================
【商品管理菜单】表格样式
================================ */
#itemsTableBody .btn-group {
white-space: nowrap;
}
#itemsTableBody .btn-group .btn {
padding: 0.25rem 0.5rem;
font-size: 0.875rem;
border-radius: 0.25rem;
}
#itemsTableBody .btn-group .btn:first-child {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
#itemsTableBody .btn-group .btn:last-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: 0;
}
#itemsTableBody .btn-group .btn i {
font-size: 0.875rem;
}
/* 表格操作列样式 */
.table td:last-child {
text-align: center;
vertical-align: middle;
padding: 0.5rem 0.25rem;
}
/* 表格文本截断优化 */
.table td {
vertical-align: middle;
}
.table td[title] {
cursor: help;
}
/* 商品表格特定优化 */
#itemsTableBody td:nth-child(4),
#itemsTableBody td:nth-child(5) {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
+403
View File
@@ -0,0 +1,403 @@
/* 关键词管理现代化样式 */
.keyword-container {
background: white;
border-radius: 16px;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: all 0.3s ease;
}
.keyword-header {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
color: white;
padding: 1.5rem 2rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.keyword-header h3 {
margin: 0;
font-weight: 600;
display: flex;
align-items: center;
}
.keyword-header .account-badge {
background: rgba(255, 255, 255, 0.2);
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.875rem;
font-weight: 500;
}
.keyword-input-area {
padding: 2rem;
background: #f8fafc;
border-bottom: 1px solid #e5e7eb;
}
.keyword-input-group {
display: grid;
grid-template-columns: 1fr 2fr 1fr auto;
gap: 1rem;
align-items: end;
}
.input-field {
position: relative;
}
.input-field label {
position: absolute;
top: -0.5rem;
left: 0.75rem;
background: #f8fafc;
padding: 0 0.5rem;
font-size: 0.75rem;
font-weight: 500;
color: #6b7280;
z-index: 1;
}
.input-field input, .input-field select {
width: 100%;
padding: 1rem 0.75rem 0.75rem;
border: 2px solid #e5e7eb;
border-radius: 12px;
font-size: 0.875rem;
transition: all 0.3s ease;
background: white;
}
.input-field input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.add-btn {
background: linear-gradient(135deg, #10b981 0%, #059669 100%);
color: white;
border: none;
border-radius: 12px;
padding: 1rem 1.5rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.add-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}
.add-btn:active {
transform: translateY(0);
}
/* ================================
【自动回复菜单】相关样式
================================ */
.keywords-list {
padding: 1.5rem 2rem 2rem;
max-height: 500px;
overflow-y: auto;
}
.keyword-item {
background: white;
border: 1px solid #e5e7eb;
border-radius: 12px;
margin-bottom: 1rem;
transition: all 0.3s ease;
overflow: hidden;
}
.keyword-item:hover {
border-color: #667eea;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
transform: translateY(-1px);
}
.keyword-item-header {
padding: 1rem 1.5rem;
background: #f8fafc;
border-bottom: 1px solid #e5e7eb;
display: flex;
align-items: center;
justify-content: space-between;
}
.keyword-tag {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.875rem;
font-weight: 500;
display: flex;
align-items: center;
gap: 0.5rem;
}
.keyword-actions {
display: flex;
gap: 0.5rem;
}
.action-btn {
width: 36px;
height: 36px;
border: none;
border-radius: 8px;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
}
.edit-btn {
background: #f3f4f6;
color: #6b7280;
}
.edit-btn:hover {
background: #e5e7eb;
color: #374151;
}
.edit-btn-disabled {
background: #f9fafb !important;
color: #9ca3af !important;
cursor: not-allowed !important;
}
.edit-btn-disabled:hover {
background: #f9fafb !important;
color: #9ca3af !important;
}
.delete-btn {
background: #fef2f2;
color: #ef4444;
}
.delete-btn:hover {
background: #fee2e2;
color: #dc2626;
}
.keyword-content {
padding: 1.5rem;
}
.reply-text {
color: #374151;
line-height: 1.6;
margin: 0;
font-size: 0.875rem;
}
.empty-state {
text-align: center;
padding: 4rem 2rem;
color: #6b7280;
}
.empty-state i {
font-size: 4rem;
margin-bottom: 1rem;
opacity: 0.5;
}
.empty-state h3 {
margin: 0 0 0.5rem;
color: #374151;
}
.empty-state p {
margin: 0 0 2rem;
font-size: 0.875rem;
}
.quick-add-btn {
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
color: white;
border: none;
border-radius: 12px;
padding: 0.75rem 1.5rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
}
.quick-add-btn:hover {
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}
/* 账号选择器现代化 */
.account-selector {
background: white;
border-radius: 16px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
padding: 2rem;
margin-bottom: 2rem;
}
.selector-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
}
.selector-icon {
width: 48px;
height: 48px;
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 1.25rem;
}
.selector-title {
margin: 0;
color: #1f2937;
font-weight: 600;
}
.selector-subtitle {
margin: 0;
color: #6b7280;
font-size: 0.875rem;
}
.account-select-wrapper {
position: relative;
}
.account-select {
width: 100%;
padding: 1rem 1.25rem;
border: 2px solid #e5e7eb;
border-radius: 12px;
font-size: 1rem;
background: white;
cursor: pointer;
transition: all 0.3s ease;
}
.account-select:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
/* ================================
【自动回复菜单】图片关键词样式
================================ */
.btn-image {
background: linear-gradient(135deg, #28a745, #20c997) !important;
border: none !important;
margin-left: 10px;
}
.btn-image:hover {
background: linear-gradient(135deg, #218838, #1ea085) !important;
transform: translateY(-1px);
}
.keyword-input-group {
display: flex;
gap: 15px;
align-items: end;
flex-wrap: wrap;
}
.keyword-input-group .add-btn {
white-space: nowrap;
min-width: auto;
}
.image-preview {
margin-top: 10px;
}
.preview-container {
padding: 10px;
border: 2px dashed #ddd;
border-radius: 8px;
text-align: center;
background-color: #f8f9fa;
}
.keyword-type-badge {
display: inline-block;
padding: 2px 8px;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 500;
margin-left: 8px;
}
.keyword-type-text {
background-color: #e3f2fd;
color: #1976d2;
}
.keyword-type-image {
background-color: #f3e5f5;
color: #7b1fa2;
}
/* 关键词列表中的图片预览 */
.keyword-image-preview {
max-width: 60px;
max-height: 60px;
border-radius: 4px;
border: 1px solid #ddd;
cursor: pointer;
}
.keyword-image-preview:hover {
border-color: #007bff;
transform: scale(1.05);
transition: all 0.2s ease;
}
/* 响应式调整 */
@media (max-width: 768px) {
.keyword-input-group {
grid-template-columns: 1fr;
gap: 1rem;
}
.keyword-item-header {
flex-direction: column;
align-items: flex-start;
gap: 1rem;
}
.keyword-actions {
align-self: flex-end;
}
.keyword-input-group {
flex-direction: column;
align-items: stretch;
}
.keyword-input-group .add-btn {
margin-left: 0;
margin-top: 10px;
}
}
+202
View File
@@ -0,0 +1,202 @@
/* ================================
通用布局 - 侧边栏和导航
================================ */
.sidebar {
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 250px;
background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
color: white;
z-index: 1000;
transition: all 0.3s ease;
box-shadow: 2px 0 10px rgba(0,0,0,0.1);
display: flex;
flex-direction: column;
overflow: hidden;
}
.sidebar-header {
padding: 1.5rem 1rem;
border-bottom: 1px solid rgba(255,255,255,0.1);
flex-shrink: 0;
}
.sidebar-brand {
font-size: 1.25rem;
font-weight: 700;
color: white;
text-decoration: none;
display: flex;
align-items: center;
}
.sidebar-nav {
padding: 1rem 0;
flex: 1;
overflow-y: auto;
overflow-x: hidden;
}
/* 侧边栏滚动条样式 */
.sidebar-nav::-webkit-scrollbar {
width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
background: rgba(255, 255, 255, 0.1);
border-radius: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.3);
border-radius: 3px;
transition: background 0.3s ease;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
background: rgba(255, 255, 255, 0.5);
}
/* Firefox滚动条样式 */
.sidebar-nav {
scrollbar-width: thin;
scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}
.nav-item {
margin: 0.25rem 0;
}
.nav-link {
display: flex;
align-items: center;
padding: 0.75rem 1.5rem;
color: rgba(255,255,255,0.8);
text-decoration: none;
transition: all 0.3s ease;
border-left: 3px solid transparent;
}
.nav-link:hover {
color: white;
background: rgba(255,255,255,0.1);
border-left-color: rgba(255,255,255,0.5);
}
.nav-link.active {
color: white;
background: rgba(255,255,255,0.15);
border-left-color: white;
}
.nav-link i {
margin-right: 0.75rem;
width: 20px;
text-align: center;
}
.nav-divider {
padding: 0.5rem 1rem;
border-top: 1px solid rgba(255,255,255,0.1);
margin-top: 0.5rem;
}
.nav-divider small {
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.5px;
}
/* 主内容区域 */
.main-content {
margin-left: 250px;
height: 100vh;
background: #f8fafc;
display: flex;
flex-direction: column;
}
.content-header {
background: white;
padding: 1.5rem 2rem;
border-bottom: 1px solid var(--border-color);
box-shadow: var(--shadow-sm);
flex-shrink: 0;
}
.content-body {
padding: 2rem;
}
/* 响应式设计 */
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
}
.sidebar.show {
transform: translateX(0);
}
.main-content {
margin-left: 0;
}
.mobile-toggle {
display: block !important;
}
}
.mobile-toggle {
display: none;
position: fixed;
top: 1rem;
left: 1rem;
z-index: 1001;
background: var(--primary-color);
color: white;
border: none;
border-radius: 8px;
padding: 0.5rem;
box-shadow: var(--shadow-md);
}
/* 内容区域样式 */
.content-section {
display: none;
}
.content-section.active {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
}
.content-section.active .content-body {
flex: 1;
min-height: 0;
overflow: auto;
}
/* 全局底部信息 */
.global-footer {
flex-shrink: 0;
text-align: center;
padding: 0.75rem 2rem;
background: none;
border-top: 1px solid var(--border-color);
font-size: 0.8rem;
color: var(--secondary-color);
}
.global-footer a {
color: var(--primary-color);
text-decoration: none;
}
.global-footer a:hover {
text-decoration: underline;
}
+147
View File
@@ -0,0 +1,147 @@
/* ================================
【日志管理菜单】相关样式
================================ */
.log-container {
height: 70vh;
overflow-y: auto;
background-color: #1e1e1e;
color: #d4d4d4;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 12px;
line-height: 1.2;
padding: 8px;
border-radius: 4px;
}
.log-entry {
margin-bottom: 0px;
padding: 1px 0;
word-wrap: break-word;
white-space: pre-wrap;
line-height: 1.2;
}
.log-entry.DEBUG {
color: #9cdcfe;
}
.log-entry.INFO {
color: #4ec9b0;
}
.log-entry.WARNING {
color: #dcdcaa;
}
.log-entry.ERROR {
color: #f48771;
}
.log-entry.CRITICAL {
color: #ff6b6b;
font-weight: bold;
}
.log-timestamp {
color: #808080;
}
.log-level {
font-weight: bold;
margin: 0 5px;
}
.log-source {
color: #569cd6;
}
.log-message {
color: inherit;
}
.log-container::-webkit-scrollbar {
width: 8px;
}
.log-container::-webkit-scrollbar-track {
background: #2d2d30;
}
.log-container::-webkit-scrollbar-thumb {
background: #464647;
border-radius: 4px;
}
.log-container::-webkit-scrollbar-thumb:hover {
background: #5a5a5c;
}
/* 日志过滤标签样式 */
.filter-badge {
cursor: pointer;
transition: all 0.2s;
margin-right: 0.5rem;
margin-bottom: 0.25rem;
}
.filter-badge:hover {
transform: scale(1.05);
}
.filter-badge.active {
box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}
/* 自动刷新指示器 */
.auto-refresh-indicator {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
/* 日志行悬停效果 */
.log-entry:hover {
background: rgba(255,255,255,0.05);
}
/* 商品搜索相关样式 */
.item-card {
transition: transform 0.2s;
border: none;
border-radius: 15px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.item-card:hover {
transform: translateY(-2px);
}
.item-image {
width: 100%;
height: 200px;
object-fit: cover;
border-radius: 10px;
}
.price {
color: #e74c3c;
font-weight: bold;
font-size: 1.2em;
}
.seller-name {
color: #6c757d;
font-size: 0.9em;
}
.want-count {
margin-top: 10px;
}
.want-count .badge {
font-size: 0.8em;
}
+83
View File
@@ -0,0 +1,83 @@
/* ================================
【通知渠道菜单】卡片样式
================================ */
.channel-type-card {
cursor: pointer;
transition: all 0.3s ease;
border: 2px solid transparent;
min-height: 180px; /* 设置最小高度,让卡片更紧凑 */
}
.channel-type-card .card-body {
padding: 1rem; /* 减少内边距 */
}
.channel-type-card .channel-icon {
transition: transform 0.3s ease;
margin-bottom: 0.75rem !important; /* 减少图标下方间距 */
}
.channel-type-card .channel-icon i {
font-size: 2.2rem !important; /* 减小图标大小 */
}
.channel-type-card .card-title {
font-size: 1.1rem; /* 减小标题字体 */
margin-bottom: 0.5rem;
}
.channel-type-card .card-text {
font-size: 0.85rem; /* 减小描述文字 */
margin-bottom: 0.75rem;
}
.channel-type-card .btn {
transition: all 0.3s ease;
font-size: 0.85rem; /* 减小按钮文字 */
padding: 0.375rem 0.75rem; /* 减小按钮内边距 */
}
.channel-type-card:hover {
transform: translateY(-3px); /* 减少悬停位移 */
box-shadow: 0 6px 20px rgba(0,0,0,0.12);
border-color: var(--bs-primary);
}
.channel-type-card:hover .channel-icon {
transform: scale(1.05); /* 减少悬停缩放 */
}
.channel-type-card:hover .btn {
transform: scale(1.02); /* 减少按钮悬停缩放 */
}
/* 响应式调整 */
@media (max-width: 768px) {
.channel-type-card {
margin-bottom: 10px;
min-height: 160px; /* 移动端稍微减小高度 */
}
.channel-type-card .card-body {
padding: 0.75rem; /* 移动端减少内边距 */
}
.channel-type-card .channel-icon i {
font-size: 2rem !important; /* 移动端图标更小 */
}
.channel-type-card .card-title {
font-size: 1rem; /* 移动端标题更小 */
}
.channel-type-card .card-text {
font-size: 0.8rem; /* 移动端描述文字更小 */
}
}
/* 大屏幕优化 */
@media (min-width: 1400px) {
.channel-type-card {
min-height: 200px; /* 大屏幕稍微增加高度 */
}
}
+26
View File
@@ -0,0 +1,26 @@
/* ================================
全局变量和基础样式
================================ */
:root {
--primary-color: #4f46e5;
--primary-hover: #4338ca;
--primary-light: #6366f1;
--secondary-color: #6b7280;
--success-color: #10b981;
--danger-color: #ef4444;
--warning-color: #f59e0b;
--light-color: #f9fafb;
--dark-color: #1f2937;
--border-color: #e5e7eb;
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
body {
font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f8fafc;
min-height: 100vh;
padding: 0;
margin: 0;
}
+556
View File
@@ -0,0 +1,556 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数据管理 - 闲鱼自动回复系统</title>
<link href="/static/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="/static/lib/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<style>
.admin-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1rem 0;
margin-bottom: 2rem;
}
.table-container {
max-height: 600px;
overflow-y: auto;
border: 1px solid #dee2e6;
border-radius: 0.375rem;
}
.table th {
position: sticky;
top: 0;
background: #f8f9fa;
z-index: 10;
}
.btn-delete {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
.table-info {
background: #e3f2fd;
border-left: 4px solid #2196f3;
padding: 1rem;
margin-bottom: 1rem;
}
.data-stats {
background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
color: white;
border: none;
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="/">
<i class="bi bi-robot"></i> 闲鱼自动回复系统
</a>
<div class="navbar-nav ms-auto">
<a class="nav-link" href="/">
<i class="bi bi-house"></i> 首页
</a>
<a class="nav-link" href="/user_management.html">
<i class="bi bi-people"></i> 用户管理
</a>
<a class="nav-link active" href="/data_management.html">
<i class="bi bi-database"></i> 数据管理
</a>
<a class="nav-link" href="/log_management.html">
<i class="bi bi-file-text"></i> 日志管理
</a>
<a class="nav-link" href="#" onclick="logout()">
<i class="bi bi-box-arrow-right"></i> 退出
</a>
</div>
</div>
</nav>
<!-- 管理员标题 -->
<div class="admin-header">
<div class="container">
<h1 class="mb-0">
<i class="bi bi-database"></i> 数据管理
</h1>
<p class="mb-0 mt-2">查看和管理数据库中的所有表数据</p>
</div>
</div>
<div class="container">
<!-- 表选择器 -->
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">
<i class="bi bi-table"></i> 数据表选择
</h5>
</div>
<div class="card-body">
<div class="row align-items-center">
<div class="col-md-6">
<label class="form-label">选择数据表</label>
<select class="form-select" id="tableSelect" onchange="loadTableData()">
<option value="">请选择数据表...</option>
<option value="users">users - 用户表</option>
<option value="cookies">cookies - Cookie账号表</option>
<option value="cookie_status">cookie_status - Cookie状态表</option>
<option value="keywords">keywords - 关键字表</option>
<option value="default_replies">default_replies - 默认回复表</option>
<option value="item_replay">item_replay - 指定商品回复表</option>
<option value="default_reply_records">default_reply_records - 默认回复记录表</option>
<option value="ai_reply_settings">ai_reply_settings - AI回复设置表</option>
<option value="ai_conversations">ai_conversations - AI对话历史表</option>
<option value="ai_item_cache">ai_item_cache - AI商品信息缓存表</option>
<option value="item_info">item_info - 商品信息表</option>
<option value="message_notifications">message_notifications - 消息通知表</option>
<option value="cards">cards - 卡券表</option>
<option value="delivery_rules">delivery_rules - 发货规则表</option>
<option value="notification_channels">notification_channels - 通知渠道表</option>
<option value="user_settings">user_settings - 用户设置表</option>
<option value="system_settings">system_settings - 系统设置表</option>
<option value="email_verifications">email_verifications - 邮箱验证表</option>
<option value="captcha_codes">captcha_codes - 验证码表</option>
<option value="orders">orders - 订单表</option>
</select>
</div>
<div class="col-md-3">
<label class="form-label">数据统计</label>
<div class="card data-stats">
<div class="card-body text-center py-2">
<h5 id="recordCount" class="mb-0">-</h5>
<small>条记录</small>
</div>
</div>
</div>
<div class="col-md-3">
<label class="form-label">&nbsp;</label>
<div class="d-grid">
<button class="btn btn-primary" onclick="refreshTableData()">
<i class="bi bi-arrow-clockwise"></i> 刷新数据
</button>
</div>
</div>
</div>
</div>
</div>
<!-- 表信息 -->
<div id="tableInfo" class="table-info" style="display: none;">
<h6 class="mb-2">
<i class="bi bi-info-circle"></i> 表信息
</h6>
<div class="row">
<div class="col-md-4">
<strong>表名:</strong> <span id="tableName">-</span>
</div>
<div class="col-md-4">
<strong>中文名:</strong> <span id="tableDescription">-</span>
</div>
<div class="col-md-4">
<strong>记录数:</strong> <span id="tableRecordCount">-</span>
</div>
</div>
</div>
<!-- 数据表格 -->
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="bi bi-table"></i> 数据内容
</h5>
<div class="d-flex gap-2">
<button class="btn btn-sm btn-outline-warning" onclick="confirmDeleteAll()" style="display: none;" id="deleteAllBtn">
<i class="bi bi-trash"></i> 清空表
</button>
</div>
</div>
<div class="card-body p-0">
<div id="loadingData" class="text-center py-4" style="display: none;">
<div class="spinner-border" role="status">
<span class="visually-hidden">加载中...</span>
</div>
<p class="mt-2">正在加载数据...</p>
</div>
<div id="noTableSelected" class="text-center py-4">
<i class="bi bi-table" style="font-size: 3rem; color: #ccc;"></i>
<p class="mt-2 text-muted">请选择要查看的数据表</p>
</div>
<div id="noData" class="text-center py-4" style="display: none;">
<i class="bi bi-inbox" style="font-size: 3rem; color: #ccc;"></i>
<p class="mt-2 text-muted">该表暂无数据</p>
</div>
<div id="tableContainer" class="table-container" style="display: none;">
<table class="table table-striped table-hover mb-0">
<thead id="tableHead"></thead>
<tbody id="tableBody"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- 删除确认模态框 -->
<div class="modal fade" id="deleteModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<i class="bi bi-exclamation-triangle text-warning"></i> 确认删除
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>您确定要删除这条记录吗?</p>
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle"></i>
<strong>警告:</strong>此操作不可恢复!
</div>
<div id="deleteRecordInfo" class="bg-light p-2 rounded">
<!-- 记录信息将在这里显示 -->
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-danger" onclick="confirmDelete()">
<i class="bi bi-trash"></i> 确认删除
</button>
</div>
</div>
</div>
</div>
<!-- 清空表确认模态框 -->
<div class="modal fade" id="deleteAllModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<i class="bi bi-exclamation-triangle text-danger"></i> 确认清空表
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>您确定要清空整个表的所有数据吗?</p>
<div class="alert alert-danger">
<i class="bi bi-exclamation-triangle"></i>
<strong>危险操作:</strong>这将删除表中的所有记录,此操作不可恢复!
</div>
<p>表名: <strong id="deleteAllTableName">-</strong></p>
<p>记录数: <strong id="deleteAllRecordCount">-</strong> 条</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-danger" onclick="confirmDeleteAll()">
<i class="bi bi-trash"></i> 确认清空
</button>
</div>
</div>
</div>
</div>
<script src="/static/lib/bootstrap/bootstrap.bundle.min.js"></script>
<script>
let currentTable = '';
let currentData = [];
let deleteModal = null;
let deleteAllModal = null;
let currentDeleteId = null;
// 表的中文描述
const tableDescriptions = {
'users': '用户表',
'cookies': 'Cookie账号表',
'cookie_status': 'Cookie状态表',
'keywords': '关键字表',
'item_replay': '指定商品回复表',
'default_replies': '默认回复表',
'default_reply_records': '默认回复记录表',
'ai_reply_settings': 'AI回复设置表',
'ai_conversations': 'AI对话历史表',
'ai_item_cache': 'AI商品信息缓存表',
'item_info': '商品信息表',
'message_notifications': '消息通知表',
'cards': '卡券表',
'delivery_rules': '发货规则表',
'notification_channels': '通知渠道表',
'user_settings': '用户设置表',
'system_settings': '系统设置表',
'email_verifications': '邮箱验证表',
'captcha_codes': '验证码表',
'orders': '订单表'
};
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 检查管理员权限
checkAdminPermission();
// 初始化模态框
deleteModal = new bootstrap.Modal(document.getElementById('deleteModal'));
deleteAllModal = new bootstrap.Modal(document.getElementById('deleteAllModal'));
});
// 检查管理员权限
function checkAdminPermission() {
const token = localStorage.getItem('auth_token');
if (!token) {
alert('请先登录');
window.location.href = '/login.html';
return;
}
// 验证token并检查是否为管理员
fetch('/verify', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
if (!data.authenticated) {
alert('登录已过期,请重新登录');
window.location.href = '/login.html';
return;
}
// 检查是否为管理员
if (data.username !== 'admin') {
alert('此功能仅限管理员使用');
window.location.href = '/';
return;
}
})
.catch(error => {
console.error('权限验证失败:', error);
alert('权限验证失败');
window.location.href = '/login.html';
});
}
// 加载表数据
function loadTableData() {
const tableSelect = document.getElementById('tableSelect');
const selectedTable = tableSelect.value;
if (!selectedTable) {
showNoTableSelected();
return;
}
currentTable = selectedTable;
showLoading();
const token = localStorage.getItem('auth_token');
fetch(`/admin/data/${selectedTable}`, {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
if (data.success) {
currentData = data.data;
displayTableData(data.data, data.columns);
updateTableInfo(selectedTable, data.data.length);
} else {
alert('加载数据失败: ' + data.message);
showNoData();
}
})
.catch(error => {
console.error('加载数据失败:', error);
alert('加载数据失败');
showNoData();
});
}
// 刷新表数据
function refreshTableData() {
if (currentTable) {
loadTableData();
}
}
// 显示表数据
function displayTableData(data, columns) {
const tableHead = document.getElementById('tableHead');
const tableBody = document.getElementById('tableBody');
// 清空表格
tableHead.innerHTML = '';
tableBody.innerHTML = '';
if (!data || data.length === 0) {
showNoData();
return;
}
// 创建表头
const headerRow = document.createElement('tr');
columns.forEach(column => {
const th = document.createElement('th');
th.textContent = column;
headerRow.appendChild(th);
});
// 添加操作列
const actionTh = document.createElement('th');
actionTh.textContent = '操作';
actionTh.style.width = '100px';
headerRow.appendChild(actionTh);
tableHead.appendChild(headerRow);
// 创建表格数据
data.forEach((row, index) => {
const tr = document.createElement('tr');
columns.forEach(column => {
const td = document.createElement('td');
let value = row[column];
// 处理特殊值
if (value === null || value === undefined) {
value = '-';
} else if (typeof value === 'string' && value.length > 50) {
value = value.substring(0, 50) + '...';
}
td.textContent = value;
tr.appendChild(td);
});
// 添加操作按钮
const actionTd = document.createElement('td');
const deleteBtn = document.createElement('button');
deleteBtn.className = 'btn btn-danger btn-delete';
deleteBtn.innerHTML = '<i class="bi bi-trash"></i>';
deleteBtn.onclick = () => deleteRecord(row, index);
actionTd.appendChild(deleteBtn);
tr.appendChild(actionTd);
tableBody.appendChild(tr);
});
showTableContainer();
updateRecordCount(data.length);
}
// 更新表信息
function updateTableInfo(tableName, recordCount) {
document.getElementById('tableName').textContent = tableName;
document.getElementById('tableDescription').textContent = tableDescriptions[tableName] || '未知表';
document.getElementById('tableRecordCount').textContent = recordCount;
document.getElementById('tableInfo').style.display = 'block';
// 显示/隐藏清空表按钮
const deleteAllBtn = document.getElementById('deleteAllBtn');
if (recordCount > 0) {
deleteAllBtn.style.display = 'inline-block';
} else {
deleteAllBtn.style.display = 'none';
}
}
// 更新记录数
function updateRecordCount(count) {
document.getElementById('recordCount').textContent = count;
}
// 显示状态函数
function showLoading() {
document.getElementById('loadingData').style.display = 'block';
document.getElementById('noTableSelected').style.display = 'none';
document.getElementById('noData').style.display = 'none';
document.getElementById('tableContainer').style.display = 'none';
document.getElementById('tableInfo').style.display = 'none';
}
function showNoTableSelected() {
document.getElementById('loadingData').style.display = 'none';
document.getElementById('noTableSelected').style.display = 'block';
document.getElementById('noData').style.display = 'none';
document.getElementById('tableContainer').style.display = 'none';
document.getElementById('tableInfo').style.display = 'none';
updateRecordCount('-');
}
function showNoData() {
document.getElementById('loadingData').style.display = 'none';
document.getElementById('noTableSelected').style.display = 'none';
document.getElementById('noData').style.display = 'block';
document.getElementById('tableContainer').style.display = 'none';
}
function showTableContainer() {
document.getElementById('loadingData').style.display = 'none';
document.getElementById('noTableSelected').style.display = 'none';
document.getElementById('noData').style.display = 'none';
document.getElementById('tableContainer').style.display = 'block';
}
// 删除记录
function deleteRecord(record, index) {
currentDeleteId = record.id || record.user_id || index;
// 显示记录信息
const deleteRecordInfo = document.getElementById('deleteRecordInfo');
deleteRecordInfo.innerHTML = '';
Object.keys(record).forEach(key => {
const div = document.createElement('div');
div.innerHTML = `<strong>${key}:</strong> ${record[key] || '-'}`;
deleteRecordInfo.appendChild(div);
});
deleteModal.show();
}
// 确认删除
function confirmDelete() {
if (!currentDeleteId || !currentTable) return;
const token = localStorage.getItem('auth_token');
fetch(`/admin/data/${currentTable}/${currentDeleteId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
deleteModal.hide();
if (data.success) {
alert('删除成功');
loadTableData(); // 重新加载数据
} else {
alert('删除失败: ' + data.message);
}
})
.catch(error => {
console.error('删除失败:', error);
alert('删除失败');
});
}
// 确认清空表
function confirmDeleteAll() {
if (!currentTable) return;
document.getElementById('deleteAllTableName').textContent = currentTable;
document.getElementById('deleteAllRecordCount').textContent = currentData.length;
deleteAllModal.show();
}
// 退出登录
function logout() {
localStorage.removeItem('auth_token');
window.location.href = '/login.html';
}
</script>
</body>
</html>
+4458
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+10915
View File
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).bootstrap=e()}(this,(function(){"use strict";const t=new Map,e={set(e,i,n){t.has(e)||t.set(e,new Map);const s=t.get(e);s.has(i)||0===s.size?s.set(i,n):console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(s.keys())[0]}.`)},get:(e,i)=>t.has(e)&&t.get(e).get(i)||null,remove(e,i){if(!t.has(e))return;const n=t.get(e);n.delete(i),0===n.size&&t.delete(e)}},i="transitionend",n=t=>(t&&window.CSS&&window.CSS.escape&&(t=t.replace(/#([^\s"#']+)/g,((t,e)=>`#${CSS.escape(e)}`))),t),s=t=>{t.dispatchEvent(new Event(i))},o=t=>!(!t||"object"!=typeof t)&&(void 0!==t.jquery&&(t=t[0]),void 0!==t.nodeType),r=t=>o(t)?t.jquery?t[0]:t:"string"==typeof t&&t.length>0?document.querySelector(n(t)):null,a=t=>{if(!o(t)||0===t.getClientRects().length)return!1;const e="visible"===getComputedStyle(t).getPropertyValue("visibility"),i=t.closest("details:not([open])");if(!i)return e;if(i!==t){const e=t.closest("summary");if(e&&e.parentNode!==i)return!1;if(null===e)return!1}return e},l=t=>!t||t.nodeType!==Node.ELEMENT_NODE||!!t.classList.contains("disabled")||(void 0!==t.disabled?t.disabled:t.hasAttribute("disabled")&&"false"!==t.getAttribute("disabled")),c=t=>{if(!document.documentElement.attachShadow)return null;if("function"==typeof t.getRootNode){const e=t.getRootNode();return e instanceof ShadowRoot?e:null}return t instanceof ShadowRoot?t:t.parentNode?c(t.parentNode):null},h=()=>{},d=t=>{t.offsetHeight},u=()=>window.jQuery&&!document.body.hasAttribute("data-bs-no-jquery")?window.jQuery:null,f=[],p=()=>"rtl"===document.documentElement.dir,m=t=>{var e;e=()=>{const e=u();if(e){const i=t.NAME,n=e.fn[i];e.fn[i]=t.jQueryInterface,e.fn[i].Constructor=t,e.fn[i].noConflict=()=>(e.fn[i]=n,t.jQueryInterface)}},"loading"===document.readyState?(f.length||document.addEventListener("DOMContentLoaded",(()=>{for(const t of f)t()})),f.push(e)):e()},g=(t,e=[],i=t)=>"function"==typeof t?t(...e):i,_=(t,e,n=!0)=>{if(!n)return void g(t);const o=(t=>{if(!t)return 0;let{transitionDuration:e,transitionDelay:i}=window.getComputedStyle(t);const n=Number.parseFloat(e),s=Number.parseFloat(i);return n||s?(e=e.split(",")[0],i=i.split(",")[0],1e3*(Number.parseFloat(e)+Number.parseFloat(i))):0})(e)+5;let r=!1;const a=({target:n})=>{n===e&&(r=!0,e.removeEventListener(i,a),g(t))};e.addEventListener(i,a),setTimeout((()=>{r||s(e)}),o)},b=(t,e,i,n)=>{const s=t.length;let o=t.indexOf(e);return-1===o?!i&&n?t[s-1]:t[0]:(o+=i?1:-1,n&&(o=(o+s)%s),t[Math.max(0,Math.min(o,s-1))])},v=/[^.]*(?=\..*)\.|.*/,y=/\..*/,w=/::\d+$/,A={};let E=1;const T={mouseenter:"mouseover",mouseleave:"mouseout"},C=new Set(["click","dblclick","mouseup","mousedown","contextmenu","mousewheel","DOMMouseScroll","mouseover","mouseout","mousemove","selectstart","selectend","keydown","keypress","keyup","orientationchange","touchstart","touchmove","touchend","touchcancel","pointerdown","pointermove","pointerup","pointerleave","pointercancel","gesturestart","gesturechange","gestureend","focus","blur","change","reset","select","submit","focusin","focusout","load","unload","beforeunload","resize","move","DOMContentLoaded","readystatechange","error","abort","scroll"]);function O(t,e){return e&&`${e}::${E++}`||t.uidEvent||E++}function x(t){const e=O(t);return t.uidEvent=e,A[e]=A[e]||{},A[e]}function k(t,e,i=null){return Object.values(t).find((t=>t.callable===e&&t.delegationSelector===i))}function L(t,e,i){const n="string"==typeof e,s=n?i:e||i;let o=I(t);return C.has(o)||(o=t),[n,s,o]}function S(t,e,i,n,s){if("string"!=typeof e||!t)return;let[o,r,a]=L(e,i,n);if(e in T){const t=t=>function(e){if(!e.relatedTarget||e.relatedTarget!==e.delegateTarget&&!e.delegateTarget.contains(e.relatedTarget))return t.call(this,e)};r=t(r)}const l=x(t),c=l[a]||(l[a]={}),h=k(c,r,o?i:null);if(h)return void(h.oneOff=h.oneOff&&s);const d=O(r,e.replace(v,"")),u=o?function(t,e,i){return function n(s){const o=t.querySelectorAll(e);for(let{target:r}=s;r&&r!==this;r=r.parentNode)for(const a of o)if(a===r)return P(s,{delegateTarget:r}),n.oneOff&&N.off(t,s.type,e,i),i.apply(r,[s])}}(t,i,r):function(t,e){return function i(n){return P(n,{delegateTarget:t}),i.oneOff&&N.off(t,n.type,e),e.apply(t,[n])}}(t,r);u.delegationSelector=o?i:null,u.callable=r,u.oneOff=s,u.uidEvent=d,c[d]=u,t.addEventListener(a,u,o)}function D(t,e,i,n,s){const o=k(e[i],n,s);o&&(t.removeEventListener(i,o,Boolean(s)),delete e[i][o.uidEvent])}function $(t,e,i,n){const s=e[i]||{};for(const[o,r]of Object.entries(s))o.includes(n)&&D(t,e,i,r.callable,r.delegationSelector)}function I(t){return t=t.replace(y,""),T[t]||t}const N={on(t,e,i,n){S(t,e,i,n,!1)},one(t,e,i,n){S(t,e,i,n,!0)},off(t,e,i,n){if("string"!=typeof e||!t)return;const[s,o,r]=L(e,i,n),a=r!==e,l=x(t),c=l[r]||{},h=e.startsWith(".");if(void 0===o){if(h)for(const i of Object.keys(l))$(t,l,i,e.slLine truncated
//# sourceMappingURL=bootstrap.bundle.min.js.map
+6
View File
@@ -0,0 +1,6 @@
@charset "UTF-8";/*!
* Bootstrap v5.3.2 (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/:root,[data-bs-theme=light]{--bs-blue:#0d6efd;--bs-indigo:#6610f2;--bs-purple:#6f42c1;--bs-pink:#d63384;--bs-red:#dc3545;--bs-orange:#fd7e14;--bs-yellow:#ffc107;--bs-green:#198754;--bs-teal:#20c997;--bs-cyan:#0dcaf0;--bs-black:#000;--bs-white:#fff;--bs-gray:#6c757d;--bs-gray-dark:#343a40;--bs-gray-100:#f8f9fa;--bs-gray-200:#e9ecef;--bs-gray-300:#dee2e6;--bs-gray-400:#ced4da;--bs-gray-500:#adb5bd;--bs-gray-600:#6c757d;--bs-gray-700:#495057;--bs-gray-800:#343a40;--bs-gray-900:#212529;--bs-primary:#0d6efd;--bs-secondary:#6c757d;--bs-success:#198754;--bs-info:#0dcaf0;--bs-warning:#ffc107;--bs-danger:#dc3545;--bs-light:#f8f9fa;--bs-dark:#212529;--bs-primary-rgb:13,110,253;--bs-secondary-rgb:108,117,125;--bs-success-rgb:25,135,84;--bs-info-rgb:13,202,240;--bs-warning-rgb:255,193,7;--bs-danger-rgb:220,53,69;--bs-light-rgb:248,249,250;--bs-dark-rgb:33,37,41;--bs-primary-text-emphasis:#052c65;--bs-secondary-text-emphasis:#2b2f32;--bs-success-text-emphasis:#0a3622;--bs-info-text-emphasis:#055160;--bs-warning-text-emphasis:#664d03;--bs-danger-text-emphasis:#58151c;--bs-light-text-emphasis:#495057;--bs-dark-text-emphasis:#495057;--bs-primary-bg-subtle:#cfe2ff;--bs-secondary-bg-subtle:#e2e3e5;--bs-success-bg-subtle:#d1e7dd;--bs-info-bg-subtle:#cff4fc;--bs-warning-bg-subtle:#fff3cd;--bs-danger-bg-subtle:#f8d7da;--bs-light-bg-subtle:#fcfcfd;--bs-dark-bg-subtle:#ced4da;--bs-primary-border-subtle:#9ec5fe;--bs-secondary-border-subtle:#c4c8cb;--bs-success-border-subtle:#a3cfbb;--bs-info-border-subtle:#9eeaf9;--bs-warning-border-subtle:#ffe69c;--bs-danger-border-subtle:#f1aeb5;--bs-light-border-subtle:#e9ecef;--bs-dark-border-subtle:#adb5bd;--bs-white-rgb:255,255,255;--bs-black-rgb:0,0,0;--bs-font-sans-serif:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--bs-font-monospace:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--bs-gradient:linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));--bs-body-font-family:var(--bs-font-sans-serif);--bs-body-font-size:1rem;--bs-body-font-weight:400;--bs-body-line-height:1.5;--bs-body-color:#212529;--bs-body-color-rgb:33,37,41;--bs-body-bg:#fff;--bs-body-bg-rgb:255,255,255;--bs-emphasis-color:#000;--bs-emphasis-color-rgb:0,0,0;--bs-secondary-color:rgba(33, 37, 41, 0.75);--bs-secondary-color-rgb:33,37,41;--bs-secondary-bg:#e9ecef;--bs-secondary-bg-rgb:233,236,239;--bs-tertiary-color:rgba(33, 37, 41, 0.5);--bs-tertiary-color-rgb:33,37,41;--bs-tertiary-bg:#f8f9fa;--bs-tertiary-bg-rgb:248,249,250;--bs-heading-color:inherit;--bs-link-color:#0d6efd;--bs-link-color-rgb:13,110,253;--bs-link-decoration:underline;--bs-link-hover-color:#0a58ca;--bs-link-hover-color-rgb:10,88,202;--bs-code-color:#d63384;--bs-highlight-color:#212529;--bs-highlight-bg:#fff3cd;--bs-border-width:1px;--bs-border-style:solid;--bs-border-color:#dee2e6;--bs-border-color-translucent:rgba(0, 0, 0, 0.175);--bs-border-radius:0.375rem;--bs-border-radius-sm:0.25rem;--bs-border-radius-lg:0.5rem;--bs-border-radius-xl:1rem;--bs-border-radius-xxl:2rem;--bs-border-radius-2xl:var(--bs-border-radius-xxl);--bs-border-radius-pill:50rem;--bs-box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15);--bs-box-shadow-sm:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);--bs-box-shadow-lg:0 1rem 3rem rgba(0, 0, 0, 0.175);--bs-box-shadow-inset:inset 0 1px 2px rgba(0, 0, 0, 0.075);--bs-focus-ring-width:0.25rem;--bs-focus-ring-opacity:0.25;--bs-focus-ring-color:rgba(13, 110, 253, 0.25);--bs-form-valid-color:#198754;--bs-form-valid-border-color:#198754;--bs-form-invalid-color:#dc3545;--bs-form-invalid-border-color:#dc3545}[data-bs-theme=dark]{color-scheme:dark;--bs-body-color:#dee2e6;--bs-body-color-rgb:222,226,230;--bs-body-bg:#212529;--bs-body-bg-rgb:33,37,41;--bs-emphasis-color:#fff;--bs-emphasis-color-rgb:255,255,255;--bs-secondary-color:rgba(222, 226, 230, 0.75);--bs-secondary-color-rgb:222,226,230;--bs-secondary-bg:#343a40;--bs-secondary-bg-rgb:52,58,64;--bs-tertiary-color:rgba(222, 226, 230, 0.5);--bs-tertiary-color-rgb:222,226,230;--bs-tertiary-bg:#2b3035;--bs-tertiary-bg-rgb:43,48,53;--bs-primary-text-emphasis:#6ea8fe;--bs-secondary-text-emphasis:#a7acb1;--bs-success-text-emphasis:#75b798;--bs-info-text-emphasis:#6edff6;--bs-warning-text-emphasis:#ffda6a;--bs-danger-text-emphasis:#ea868f;--bs-light-text-emphasis:#f8f9fa;--bs-dark-text-emphasis:#dee2e6;--bs-primary-bg-subtle:#031633;--bs-secondary-bg-subtle:#161719;--bs-success-bg-subtle:#051b11;--bs-info-bg-subtle:#032830;--bs-warning-bg-subtle:#332701;--bs-danger-bg-subtle:#2c0b0e;--bs-light-bg-subtle:#343a40;--bs-dark-bg-subtle:#1a1d20;--bs-primary-border-subtle:#084298;--bs-secondary-border-subtle:#41464b;--bs-success-border-subtle:#0f5132;--bs-info-border-subtle:#087990;--bs-warning-border-subtle:#997404;--bs-danger-border-subtle:#842029;--bs-light-border-subtle:#495057;--bs-dark-border-subtle:#343a40;--bs-heading-color:inherLine truncated
/*# sourceMappingURL=bootstrap.min.css.map */
+457
View File
@@ -0,0 +1,457 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>日志管理 - 闲鱼自动回复系统</title>
<link href="/static/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="/static/lib/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<style>
.admin-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1rem 0;
margin-bottom: 2rem;
}
.log-container {
background: #1e1e1e;
color: #f8f9fa;
font-family: 'Courier New', monospace;
font-size: 0.85rem;
max-height: 600px;
overflow-y: auto;
border-radius: 0.375rem;
}
.log-line {
padding: 0.25rem 0.5rem;
border-bottom: 1px solid #333;
white-space: pre-wrap;
word-break: break-all;
}
.log-line:hover {
background: #2d2d2d;
}
.log-info { color: #17a2b8; }
.log-warning { color: #ffc107; }
.log-error { color: #dc3545; }
.log-debug { color: #6c757d; }
.filter-badge {
cursor: pointer;
transition: all 0.2s;
}
.filter-badge:hover {
transform: scale(1.05);
}
.filter-badge.active {
box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}
.auto-refresh-indicator {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="/">
<i class="bi bi-robot"></i> 闲鱼自动回复系统
</a>
<div class="navbar-nav ms-auto">
<a class="nav-link" href="/">
<i class="bi bi-house"></i> 首页
</a>
<a class="nav-link" href="/user_management.html">
<i class="bi bi-people"></i> 用户管理
</a>
<a class="nav-link" href="/data_management.html">
<i class="bi bi-database"></i> 数据管理
</a>
<a class="nav-link active" href="/log_management.html">
<i class="bi bi-file-text"></i> 日志管理
</a>
<a class="nav-link" href="#" onclick="logout()">
<i class="bi bi-box-arrow-right"></i> 退出
</a>
</div>
</div>
</nav>
<!-- 管理员标题 -->
<div class="admin-header">
<div class="container">
<h1 class="mb-0">
<i class="bi bi-file-text"></i> 日志管理
</h1>
<p class="mb-0 mt-2">查看和监控系统运行日志</p>
</div>
</div>
<div class="container">
<!-- 控制面板 -->
<div class="card mb-4">
<div class="card-header">
<h5 class="mb-0">
<i class="bi bi-sliders"></i> 日志控制
</h5>
</div>
<div class="card-body">
<div class="row align-items-center">
<div class="col-md-3">
<label class="form-label">显示行数</label>
<select class="form-select" id="logLines" onchange="loadLogs()">
<option value="50">50行</option>
<option value="100" selected>100行</option>
<option value="200">200行</option>
<option value="500">500行</option>
<option value="1000">1000行</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">日志级别过滤</label>
<div class="d-flex gap-2 flex-wrap">
<span class="badge bg-secondary filter-badge active" data-level="" onclick="filterByLevel('')">
全部
</span>
<span class="badge bg-info filter-badge log-info" data-level="info" onclick="filterByLevel('info')">
INFO
</span>
<span class="badge bg-warning filter-badge log-warning" data-level="warning" onclick="filterByLevel('warning')">
WARNING
</span>
<span class="badge bg-danger filter-badge log-error" data-level="error" onclick="filterByLevel('error')">
ERROR
</span>
<span class="badge bg-secondary filter-badge log-debug" data-level="debug" onclick="filterByLevel('debug')">
DEBUG
</span>
</div>
</div>
<div class="col-md-3">
<label class="form-label">自动刷新</label>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="autoRefresh" onchange="toggleAutoRefresh()">
<label class="form-check-label" for="autoRefresh">
<span id="autoRefreshLabel">关闭</span>
<i id="autoRefreshIcon" class="bi bi-circle" style="display: none;"></i>
</label>
</div>
</div>
<div class="col-md-2">
<label class="form-label">&nbsp;</label>
<div class="d-grid">
<button class="btn btn-primary" onclick="loadLogs()">
<i class="bi bi-arrow-clockwise"></i> 刷新
</button>
</div>
</div>
</div>
</div>
</div>
<!-- 日志信息 -->
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="bi bi-info-circle"></i> 日志信息
</h5>
<small class="text-muted" id="lastUpdate">最后更新: -</small>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4">
<strong>日志文件:</strong>
<span id="logFile" class="text-muted">-</span>
</div>
<div class="col-md-4">
<strong>显示行数:</strong>
<span id="displayLines" class="text-muted">-</span>
</div>
<div class="col-md-4">
<strong>当前过滤:</strong>
<span id="currentFilter" class="text-muted">全部</span>
</div>
</div>
</div>
</div>
<!-- 日志内容 -->
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="bi bi-terminal"></i> 日志内容
</h5>
<div class="d-flex gap-2">
<button class="btn btn-sm btn-outline-secondary" onclick="scrollToTop()">
<i class="bi bi-arrow-up"></i> 顶部
</button>
<button class="btn btn-sm btn-outline-secondary" onclick="scrollToBottom()">
<i class="bi bi-arrow-down"></i> 底部
</button>
</div>
</div>
<div class="card-body p-0">
<div id="loadingLogs" class="text-center py-4">
<div class="spinner-border" role="status">
<span class="visually-hidden">加载中...</span>
</div>
<p class="mt-2">正在加载日志...</p>
</div>
<div id="logContainer" class="log-container" style="display: none;"></div>
<div id="noLogs" class="text-center py-4" style="display: none;">
<i class="bi bi-file-text" style="font-size: 3rem; color: #ccc;"></i>
<p class="mt-2 text-muted">暂无日志数据</p>
</div>
</div>
</div>
</div>
<script src="/static/lib/bootstrap/bootstrap.bundle.min.js"></script>
<script>
let autoRefreshInterval = null;
let currentLevel = '';
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 检查管理员权限
checkAdminPermission();
// 加载日志
loadLogs();
});
// 检查管理员权限
function checkAdminPermission() {
const token = localStorage.getItem('auth_token');
if (!token) {
alert('请先登录');
window.location.href = '/login.html';
return;
}
// 验证token并检查是否为管理员
fetch('/verify', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
if (!data.authenticated) {
alert('登录已过期,请重新登录');
window.location.href = '/login.html';
return;
}
// 检查是否为管理员
if (data.username !== 'admin') {
alert('此功能仅限管理员使用');
window.location.href = '/';
return;
}
})
.catch(error => {
console.error('权限验证失败:', error);
alert('权限验证失败');
window.location.href = '/login.html';
});
}
// 加载日志
function loadLogs() {
const token = localStorage.getItem('auth_token');
const lines = document.getElementById('logLines').value;
const level = currentLevel;
const loadingDiv = document.getElementById('loadingLogs');
const logContainer = document.getElementById('logContainer');
const noLogsDiv = document.getElementById('noLogs');
loadingDiv.style.display = 'block';
logContainer.style.display = 'none';
noLogsDiv.style.display = 'none';
let url = `/admin/logs?lines=${lines}`;
if (level) {
url += `&level=${level}`;
}
fetch(url, {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => {
console.log('API响应状态:', response.status);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response.json();
})
.then(data => {
console.log('API响应数据:', data);
loadingDiv.style.display = 'none';
if (data.success === false) {
console.error('API返回错误:', data.message);
noLogsDiv.innerHTML = `
<div class="text-center p-4 text-danger">
<i class="bi bi-exclamation-triangle fs-1"></i>
<p class="mt-2">加载日志失败</p>
<p class="small">${data.message || '未知错误'}</p>
</div>
`;
noLogsDiv.style.display = 'block';
return;
}
if (data.logs && data.logs.length > 0) {
console.log(`显示 ${data.logs.length} 条日志`);
displayLogs(data.logs);
updateLogInfo(data);
logContainer.style.display = 'block';
} else {
console.log('没有日志数据');
noLogsDiv.innerHTML = `
<div class="text-center p-4 text-muted">
<i class="bi bi-file-text fs-1"></i>
<p class="mt-2">暂无日志数据</p>
</div>
`;
noLogsDiv.style.display = 'block';
}
// 更新最后更新时间
document.getElementById('lastUpdate').textContent =
'最后更新: ' + new Date().toLocaleTimeString('zh-CN');
})
.catch(error => {
console.error('加载日志失败:', error);
loadingDiv.style.display = 'none';
noLogsDiv.innerHTML = `
<div class="text-center p-4 text-danger">
<i class="bi bi-exclamation-triangle fs-1"></i>
<p class="mt-2">加载日志失败</p>
<p class="small">${error.message}</p>
</div>
`;
noLogsDiv.style.display = 'block';
});
}
// 显示日志
function displayLogs(logs) {
const logContainer = document.getElementById('logContainer');
logContainer.innerHTML = '';
// 反转日志数组,让最新的日志显示在最上面
const reversedLogs = [...logs].reverse();
reversedLogs.forEach(log => {
const logLine = document.createElement('div');
logLine.className = 'log-line';
// 根据日志级别添加颜色类
if (/\|\s*INFO\s*\|/.test(log)) {
logLine.classList.add('log-info');
} else if (/\|\s*WARNING\s*\|/.test(log)) {
logLine.classList.add('log-warning');
} else if (/\|\s*ERROR\s*\|/.test(log)) {
logLine.classList.add('log-error');
} else if (/\|\s*DEBUG\s*\|/.test(log)) {
logLine.classList.add('log-debug');
}
logLine.textContent = log;
logContainer.appendChild(logLine);
});
// 自动滚动到顶部(显示最新日志)
scrollToTop();
}
// 更新日志信息
function updateLogInfo(data) {
document.getElementById('logFile').textContent = data.log_file || '-';
document.getElementById('displayLines').textContent = data.total_lines || '-';
}
// 按级别过滤
function filterByLevel(level) {
currentLevel = level;
// 更新过滤按钮状态
document.querySelectorAll('.filter-badge').forEach(badge => {
badge.classList.remove('active');
});
document.querySelector(`[data-level="${level}"]`).classList.add('active');
// 更新当前过滤显示
const filterText = level ? level.toUpperCase() : '全部';
document.getElementById('currentFilter').textContent = filterText;
// 重新加载日志
loadLogs();
}
// 切换自动刷新
function toggleAutoRefresh() {
const autoRefresh = document.getElementById('autoRefresh');
const label = document.getElementById('autoRefreshLabel');
const icon = document.getElementById('autoRefreshIcon');
if (autoRefresh.checked) {
// 开启自动刷新
autoRefreshInterval = setInterval(loadLogs, 5000); // 每5秒刷新
label.textContent = '开启 (5s)';
icon.style.display = 'inline';
icon.classList.add('auto-refresh-indicator');
} else {
// 关闭自动刷新
if (autoRefreshInterval) {
clearInterval(autoRefreshInterval);
autoRefreshInterval = null;
}
label.textContent = '关闭';
icon.style.display = 'none';
icon.classList.remove('auto-refresh-indicator');
}
}
// 滚动到顶部
function scrollToTop() {
const logContainer = document.getElementById('logContainer');
logContainer.scrollTop = 0;
}
// 滚动到底部
function scrollToBottom() {
const logContainer = document.getElementById('logContainer');
logContainer.scrollTop = logContainer.scrollHeight;
}
// 退出登录
function logout() {
// 清理自动刷新
if (autoRefreshInterval) {
clearInterval(autoRefreshInterval);
}
localStorage.removeItem('auth_token');
window.location.href = '/login.html';
}
// 页面卸载时清理定时器
window.addEventListener('beforeunload', function() {
if (autoRefreshInterval) {
clearInterval(autoRefreshInterval);
}
});
</script>
</body>
</html>
+673
View File
@@ -0,0 +1,673 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录 - 闲鱼自动回复管理系统</title>
<link rel="stylesheet" href="/static/lib/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="/static/lib/bootstrap-icons/bootstrap-icons.css">
<style>
:root {
--primary-color: #0d6efd;
--secondary-color: #6c757d;
--success-color: #198754;
--danger-color: #dc3545;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login-container {
background: white;
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
overflow: hidden;
width: 100%;
max-width: 400px;
}
.login-header {
background: var(--primary-color);
color: white;
padding: 30px;
text-align: center;
}
.login-header h2 {
margin: 0;
font-weight: 600;
}
.login-header p {
margin: 10px 0 0 0;
opacity: 0.9;
}
.login-body {
padding: 40px 30px;
}
.form-control {
border-radius: 10px;
border: 2px solid #e9ecef;
padding: 12px 15px;
font-size: 16px;
transition: all 0.3s ease;
}
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.btn-login {
background: var(--primary-color);
border: none;
border-radius: 10px;
padding: 12px;
font-size: 16px;
font-weight: 600;
width: 100%;
transition: all 0.3s ease;
}
.btn-login:hover {
background: #0b5ed7;
transform: translateY(-2px);
}
.input-group {
position: relative;
margin-bottom: 20px;
}
.input-group i {
position: absolute;
left: 15px;
top: 50%;
transform: translateY(-50%);
color: var(--secondary-color);
z-index: 10;
}
.input-group .form-control {
padding-left: 45px;
}
.alert {
border-radius: 10px;
border: none;
}
.loading {
display: none;
}
.loading.show {
display: inline-block;
}
</style>
</head>
<body>
<div class="login-container">
<div class="login-header">
<i class="bi bi-chat-dots-fill fs-1 mb-3"></i>
<h2>闲鱼自动回复</h2>
<p>管理系统登录</p>
</div>
<div class="login-body">
<!-- 登录方式选择 -->
<div class="login-tabs mb-4">
<div class="btn-group w-100" role="group">
<input type="radio" class="btn-check" name="loginType" id="usernameLogin" value="username" checked>
<label class="btn btn-outline-primary" for="usernameLogin">用户名/密码</label>
<input type="radio" class="btn-check" name="loginType" id="emailPasswordLogin" value="email-password">
<label class="btn btn-outline-primary" for="emailPasswordLogin">邮箱/密码</label>
<input type="radio" class="btn-check" name="loginType" id="emailCodeLogin" value="email-code">
<label class="btn btn-outline-primary" for="emailCodeLogin">邮箱/验证码</label>
</div>
</div>
<form id="loginForm">
<!-- 用户名/密码登录 -->
<div id="usernameLoginForm" class="login-form-section">
<div class="input-group">
<i class="bi bi-person-fill"></i>
<input type="text" class="form-control" id="username" placeholder="请输入用户名">
</div>
<div class="input-group">
<i class="bi bi-lock-fill"></i>
<input type="password" class="form-control" id="password" placeholder="请输入密码">
</div>
</div>
<!-- 邮箱/密码登录 -->
<div id="emailPasswordLoginForm" class="login-form-section" style="display: none;">
<div class="input-group">
<i class="bi bi-envelope-fill"></i>
<input type="email" class="form-control" id="emailForPassword" placeholder="请输入邮箱地址">
</div>
<div class="input-group">
<i class="bi bi-lock-fill"></i>
<input type="password" class="form-control" id="emailPassword" placeholder="请输入密码">
</div>
</div>
<!-- 邮箱/验证码登录 -->
<div id="emailCodeLoginForm" class="login-form-section" style="display: none;">
<div class="input-group">
<i class="bi bi-envelope-fill"></i>
<input type="email" class="form-control" id="emailForCode" placeholder="请输入邮箱地址">
</div>
<!-- 邮箱验证码 -->
<div class="input-group">
<input type="text" class="form-control" id="verificationCode" placeholder="输入6位验证码" maxlength="6">
<button type="button" class="btn btn-outline-secondary" id="sendCodeBtn" onclick="sendVerificationCode()" disabled>
发送验证码
</button>
</div>
<div class="form-text mb-3">
<span id="codeStatus">请先验证数字验证码</span>
</div>
</div>
<!-- 数字验证码(所有登录方式通用,默认隐藏,输错密码后显示) -->
<div class="mb-3" id="captchaSection" style="display: none;">
<label class="form-label">数字验证码</label>
<div class="row g-2">
<div class="col-7">
<input type="text" class="form-control" id="captchaCode" placeholder="输入4位数字验证码" maxlength="4" inputmode="numeric" pattern="\d*">
</div>
<div class="col-5">
<div class="captcha-container" style="position: relative;">
<img id="captchaImage" src="" alt="数字验证码"
style="width: 100%; height: 38px; border: 1px solid #ddd; border-radius: 5px; cursor: pointer;"
onclick="refreshCaptcha()">
<div id="captchaLoading" class="text-center" style="display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<div class="spinner-border spinner-border-sm" role="status"></div>
</div>
</div>
</div>
</div>
<div class="form-text">
<span id="captchaStatus">请输入4位数字验证码,点击图片可刷新</span>
</div>
</div>
<div id="errorAlert" class="alert alert-danger d-none" role="alert">
<i class="bi bi-exclamation-triangle-fill me-2"></i>
<span id="errorMessage"></span>
</div>
<button type="submit" class="btn btn-primary btn-login">
<span class="loading spinner-border spinner-border-sm me-2" role="status"></span>
<span id="loginText">登录</span>
</button>
</form>
<!-- 注册链接 -->
<div id="registerSection" class="text-center mt-3">
<span class="text-muted">还没有账号?</span>
<a href="/register.html" class="text-decoration-none">
<i class="bi bi-person-plus me-1"></i>立即注册
</a>
</div>
</div>
</div>
<script src="/static/lib/bootstrap/bootstrap.bundle.min.js"></script>
<script>
const loginForm = document.getElementById('loginForm');
const errorAlert = document.getElementById('errorAlert');
const errorMessage = document.getElementById('errorMessage');
const loading = document.querySelector('.loading');
const loginText = document.getElementById('loginText');
function showError(message) {
errorMessage.textContent = message;
errorAlert.classList.remove('d-none');
}
function hideError() {
errorAlert.classList.add('d-none');
}
function setLoading(isLoading) {
if (isLoading) {
loading.classList.add('show');
loginText.textContent = '登录中...';
loginForm.querySelector('button').disabled = true;
} else {
loading.classList.remove('show');
loginText.textContent = '登录';
loginForm.querySelector('button').disabled = false;
}
}
loginForm.addEventListener('submit', async (e) => {
e.preventDefault();
hideError();
setLoading(true);
const loginType = document.querySelector('input[name="loginType"]:checked').value;
let loginData = {};
try {
if (captchaRequired && !captchaVerified) {
showError('请先验证数字验证码');
return;
}
if (loginType === 'username') {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (!username || !password) {
showError('请输入用户名和密码');
return;
}
loginData = { username, password };
} else if (loginType === 'email-password') {
const email = document.getElementById('emailForPassword').value;
const password = document.getElementById('emailPassword').value;
if (!email || !password) {
showError('请输入邮箱和密码');
return;
}
if (!validateEmail(email)) {
showError('请输入有效的邮箱地址');
return;
}
loginData = { email, password };
} else if (loginType === 'email-code') {
const email = document.getElementById('emailForCode').value;
const verificationCode = document.getElementById('verificationCode').value;
if (!email) {
showError('请输入邮箱地址');
return;
}
if (!validateEmail(email)) {
showError('请输入有效的邮箱地址');
return;
}
if (!verificationCode || verificationCode.length !== 6) {
showError('请输入6位验证码');
return;
}
loginData = { email, verification_code: verificationCode };
}
const response = await fetch('/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(loginData)
});
const result = await response.json();
if (result.success) {
// 保存token到localStorage
localStorage.setItem('auth_token', result.token);
// 保存用户信息到localStorage
const userInfo = {
user_id: result.user_id,
username: result.username,
is_admin: result.is_admin
};
localStorage.setItem('user_info', JSON.stringify(userInfo));
// 检查是否有重定向URL
const redirectUrl = localStorage.getItem('redirectAfterLogin');
if (redirectUrl) {
// 清除重定向URL
localStorage.removeItem('redirectAfterLogin');
// 跳转到原来的页面
window.location.href = redirectUrl;
} else {
// 默认跳转到管理页面
window.location.href = '/admin';
}
} else {
showError(result.message);
showCaptcha();
}
} catch (error) {
showError('登录失败,请检查网络连接');
} finally {
setLoading(false);
}
});
// 检查是否已经登录
const token = localStorage.getItem('auth_token');
if (token) {
// 验证token是否有效
fetch('/verify', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(result => {
if (result.authenticated) {
window.location.href = '/admin';
}
})
.catch(() => {
// token无效,清除
localStorage.removeItem('auth_token');
});
}
// 登录方式切换相关变量
let captchaVerified = false;
let captchaRequired = false;
let countdownTimer = null;
let countdownSeconds = 0;
let sessionId = generateSessionId();
// 生成会话ID
function generateSessionId() {
return 'session_' + Math.random().toString(36).substr(2, 9) + '_' + Date.now();
}
// 登录方式切换
function switchLoginType() {
const loginType = document.querySelector('input[name="loginType"]:checked').value;
// 隐藏所有表单
document.querySelectorAll('.login-form-section').forEach(section => {
section.style.display = 'none';
});
// 显示对应表单
if (loginType === 'username') {
document.getElementById('usernameLoginForm').style.display = 'block';
} else if (loginType === 'email-password') {
document.getElementById('emailPasswordLoginForm').style.display = 'block';
} else if (loginType === 'email-code') {
document.getElementById('emailCodeLoginForm').style.display = 'block';
}
hideError();
}
// 显示验证码区域
function showCaptcha() {
const captchaSection = document.getElementById('captchaSection');
if (captchaSection.style.display === 'none') {
captchaSection.style.display = 'block';
captchaRequired = true;
loadCaptcha();
}
}
// 加载图形验证码
async function loadCaptcha() {
const captchaImage = document.getElementById('captchaImage');
const captchaLoading = document.getElementById('captchaLoading');
const captchaStatus = document.getElementById('captchaStatus');
captchaLoading.style.display = 'block';
captchaImage.style.display = 'none';
try {
const response = await fetch('/generate-captcha', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ session_id: sessionId })
});
const result = await response.json();
if (result.success) {
captchaImage.src = result.captcha_image;
captchaStatus.textContent = '请输入4位数字验证码,点击图片可刷新';
captchaVerified = false;
updateSendCodeButton();
} else {
captchaStatus.textContent = '数字验证码加载失败,请刷新页面重试';
}
} catch (error) {
console.error('加载数字验证码失败:', error);
captchaStatus.textContent = '数字验证码加载失败,请检查网络连接';
} finally {
captchaLoading.style.display = 'none';
captchaImage.style.display = 'block';
}
}
// 刷新图形验证码
function refreshCaptcha() {
loadCaptcha();
}
// 验证图形验证码
async function verifyCaptcha() {
const captchaCode = document.getElementById('captchaCode').value.trim();
const captchaStatus = document.getElementById('captchaStatus');
if (!captchaCode) {
captchaStatus.textContent = '请输入4位数字验证码';
captchaVerified = false;
updateSendCodeButton();
return;
}
if (!/^\d{4}$/.test(captchaCode)) {
captchaStatus.innerHTML = '<span style="color: red;">请输入4位数字验证码</span>';
captchaVerified = false;
return;
}
try {
const response = await fetch('/verify-captcha', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
session_id: sessionId,
captcha_code: captchaCode
})
});
const result = await response.json();
if (result.success) {
captchaStatus.innerHTML = '<span style="color: green;">✓ 数字验证码验证成功</span>';
captchaVerified = true;
} else {
captchaStatus.innerHTML = '<span style="color: red;">✗ 数字验证码错误,请重新输入</span>';
captchaVerified = false;
refreshCaptcha();
}
updateSendCodeButton();
} catch (error) {
console.error('验证数字验证码失败:', error);
captchaStatus.innerHTML = '<span style="color: red;">验证失败,请检查网络连接</span>';
captchaVerified = false;
updateSendCodeButton();
}
}
// 更新发送验证码按钮状态
function updateSendCodeButton() {
const sendCodeBtn = document.getElementById('sendCodeBtn');
const email = document.getElementById('emailForCode').value.trim();
const codeStatus = document.getElementById('codeStatus');
if (email && validateEmail(email)) {
sendCodeBtn.disabled = false;
if (captchaVerified) {
codeStatus.textContent = '数字验证码已验证,可以发送邮箱验证码';
} else {
codeStatus.textContent = '点击发送后将显示数字验证码';
}
} else {
sendCodeBtn.disabled = true;
if (!email) {
codeStatus.textContent = '请先输入邮箱地址';
} else if (!validateEmail(email)) {
codeStatus.textContent = '请输入有效的邮箱地址';
}
}
}
// 邮箱格式验证
function validateEmail(email) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
// 开始倒计时
function startCountdown() {
countdownSeconds = 60;
const sendCodeBtn = document.getElementById('sendCodeBtn');
const codeStatus = document.getElementById('codeStatus');
sendCodeBtn.disabled = true;
countdownTimer = setInterval(() => {
countdownSeconds--;
sendCodeBtn.textContent = `重新发送 (${countdownSeconds}s)`;
codeStatus.innerHTML = `<span class="countdown">验证码已发送,${countdownSeconds}秒后可重新发送</span>`;
if (countdownSeconds <= 0) {
clearInterval(countdownTimer);
sendCodeBtn.disabled = false;
sendCodeBtn.textContent = '发送验证码';
codeStatus.textContent = '可以重新发送验证码';
}
}, 1000);
}
// 发送邮箱验证码
async function sendVerificationCode() {
const email = document.getElementById('emailForCode').value.trim();
if (!email) {
showError('请先输入邮箱地址');
return;
}
if (!validateEmail(email)) {
showError('请输入有效的邮箱地址');
return;
}
if (!captchaVerified) {
showCaptcha();
return;
}
try {
const response = await fetch('/send-verification-code', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: email,
type: 'login',
session_id: sessionId
})
});
const result = await response.json();
if (result.success) {
startCountdown();
} else {
showError(result.message);
}
} catch (error) {
console.error('发送验证码失败:', error);
showError('发送验证码失败,请检查网络连接');
}
}
// 检查注册状态
async function checkRegistrationStatus() {
try {
const response = await fetch('/registration-status');
if (response.ok) {
const data = await response.json();
const registerSection = document.getElementById('registerSection');
if (registerSection) {
registerSection.style.display = data.enabled ? 'block' : 'none';
}
}
} catch (error) {
console.error('检查注册状态失败:', error);
// 出错时默认显示注册链接
}
}
// 事件监听器
document.addEventListener('DOMContentLoaded', function() {
// 检查注册状态
checkRegistrationStatus();
// 登录方式切换
document.querySelectorAll('input[name="loginType"]').forEach(radio => {
radio.addEventListener('change', switchLoginType);
});
// 数字验证码输入框事件
const captchaCodeInput = document.getElementById('captchaCode');
if (captchaCodeInput) {
captchaCodeInput.addEventListener('input', function() {
// 只允许数字输入
this.value = this.value.replace(/\D/g, '');
if (this.value.length === 4) {
verifyCaptcha();
} else {
captchaVerified = false;
updateSendCodeButton();
document.getElementById('captchaStatus').textContent = '请输入4位数字验证码';
}
});
}
// 邮箱输入框事件
const emailForCodeInput = document.getElementById('emailForCode');
if (emailForCodeInput) {
emailForCodeInput.addEventListener('input', updateSendCodeButton);
}
});
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

+576
View File
@@ -0,0 +1,576 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户注册 - 闲鱼自动回复系统</title>
<link rel="stylesheet" href="/static/lib/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="/static/lib/bootstrap-icons/bootstrap-icons.css">
<style>
body {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
}
.register-container {
background: white;
border-radius: 12px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
overflow: hidden;
max-width: 420px;
width: 100%;
max-height: 95vh;
overflow-y: auto;
}
.register-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1.2rem;
text-align: center;
}
.register-header h2 {
margin-bottom: 0.3rem;
font-size: 1.4rem;
}
.register-header p {
margin-bottom: 0;
font-size: 0.85rem;
}
.register-body {
padding: 1.2rem;
}
.form-control {
border-radius: 8px;
border: 1px solid #e9ecef;
padding: 8px 12px;
transition: all 0.3s ease;
font-size: 0.9rem;
}
.form-control:focus {
border-color: #667eea;
box-shadow: 0 0 0 0.15rem rgba(102, 126, 234, 0.2);
}
.btn-register {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border: none;
border-radius: 8px;
padding: 10px;
font-weight: 600;
transition: all 0.3s ease;
font-size: 0.9rem;
}
.btn-register:hover {
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.btn-code {
border-radius: 8px;
border: 1px solid #667eea;
color: #667eea;
font-weight: 600;
transition: all 0.3s ease;
padding: 8px 12px;
font-size: 0.85rem;
}
.btn-code:hover {
background: #667eea;
color: white;
}
.btn-code:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.login-link {
text-align: center;
margin-top: 0.8rem;
}
.login-link a {
color: #667eea;
text-decoration: none;
font-weight: 600;
font-size: 0.9rem;
}
.login-link a:hover {
text-decoration: underline;
}
.alert {
border-radius: 8px;
border: none;
padding: 0.6rem 1rem;
font-size: 0.85rem;
}
.input-group {
margin-bottom: 0.8rem;
}
.countdown {
color: #6c757d;
font-size: 0.8rem;
}
.mb-3 {
margin-bottom: 0.8rem !important;
}
.form-label {
margin-bottom: 0.3rem;
font-weight: 600;
font-size: 0.85rem;
color: #495057;
}
.form-text {
margin-top: 0.2rem;
font-size: 0.75rem;
}
.captcha-container img {
height: 32px !important;
}
/* 响应式优化 */
@media (max-height: 700px) {
.register-header {
padding: 1rem;
}
.register-header h2 {
font-size: 1.2rem;
margin-bottom: 0.2rem;
}
.register-header p {
font-size: 0.8rem;
}
.register-body {
padding: 1rem;
}
.mb-3 {
margin-bottom: 0.6rem !important;
}
.form-control {
padding: 6px 10px;
}
.btn-code {
padding: 6px 10px;
font-size: 0.8rem;
}
}
@media (max-width: 480px) {
.register-container {
margin: 5px;
max-width: none;
}
.row.g-2 > * {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
}
</style>
</head>
<body>
<div class="register-container">
<div class="register-header">
<h2 class="mb-0">
<i class="bi bi-person-plus-fill me-2"></i>
用户注册
</h2>
<p class="mb-0 mt-2 opacity-75">创建您的闲鱼自动回复账号</p>
</div>
<div class="register-body">
<div id="alertContainer"></div>
<form id="registerForm">
<div class="mb-3">
<label for="username" class="form-label">
<i class="bi bi-person me-1"></i>用户名
</label>
<input type="text" class="form-control" id="username" name="username"
placeholder="3-20个字符,支持字母、数字、下划线" required>
</div>
<div class="mb-3">
<label for="email" class="form-label">
<i class="bi bi-envelope me-1"></i>邮箱地址
</label>
<input type="email" class="form-control" id="email" name="email"
placeholder="用于接收验证码和重要通知" required>
</div>
<div class="mb-3">
<label for="captchaCode" class="form-label">
<i class="bi bi-shield-lock me-1"></i>数字验证码
</label>
<div class="row g-2">
<div class="col-7">
<input type="text" class="form-control" id="captchaCode" name="captchaCode"
placeholder="输入4位数字验证码" maxlength="4" inputmode="numeric" pattern="\d*" required>
</div>
<div class="col-5">
<div class="captcha-container" style="position: relative;">
<img id="captchaImage" src="" alt="数字验证码"
style="width: 100%; height: 32px; border: 1px solid #ddd; border-radius: 5px; cursor: pointer;"
onclick="refreshCaptcha()">
<div id="captchaLoading" class="text-center" style="display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<div class="spinner-border spinner-border-sm" role="status"></div>
</div>
</div>
</div>
</div>
<div class="form-text">
<span id="captchaStatus">请输入4位数字验证码,点击图片可刷新</span>
</div>
</div>
<div class="mb-3">
<label for="verificationCode" class="form-label">
<i class="bi bi-shield-check me-1"></i>邮箱验证码
</label>
<div class="input-group">
<input type="text" class="form-control" id="verificationCode" name="verificationCode"
placeholder="输入6位验证码" maxlength="6" required>
<button type="button" class="btn btn-code" id="sendCodeBtn" onclick="sendVerificationCode()" disabled>
发送验证码
</button>
</div>
<div class="form-text">
<span id="codeStatus">请先验证数字验证码</span>
</div>
</div>
<div class="mb-3">
<label for="password" class="form-label">
<i class="bi bi-lock me-1"></i>设置密码
</label>
<input type="password" class="form-control" id="password" name="password"
placeholder="至少6个字符" required>
</div>
<div class="mb-3">
<label for="confirmPassword" class="form-label">
<i class="bi bi-lock-fill me-1"></i>确认密码
</label>
<input type="password" class="form-control" id="confirmPassword" name="confirmPassword"
placeholder="再次输入密码" required>
</div>
<button type="submit" class="btn btn-register btn-primary w-100 mt-2">
<i class="bi bi-person-plus me-1"></i>立即注册
</button>
</form>
<div class="login-link">
<span class="text-muted">已有账号?</span>
<a href="/login.html">立即登录</a>
</div>
</div>
</div>
<script src="/static/lib/bootstrap/bootstrap.bundle.min.js"></script>
<script>
let countdownTimer = null;
let countdownSeconds = 0;
let sessionId = generateSessionId();
let captchaVerified = false;
function generateSessionId() {
return 'session_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
}
function showAlert(message, type = 'danger') {
const alertContainer = document.getElementById('alertContainer');
const alertHtml = `
<div class="alert alert-${type} alert-dismissible fade show" role="alert">
<i class="bi bi-${type === 'success' ? 'check-circle' : 'exclamation-triangle'}-fill me-2"></i>
${message}
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
`;
alertContainer.innerHTML = alertHtml;
}
function validateEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
async function loadCaptcha() {
const captchaImage = document.getElementById('captchaImage');
const captchaLoading = document.getElementById('captchaLoading');
const captchaStatus = document.getElementById('captchaStatus');
try {
captchaLoading.style.display = 'block';
captchaImage.style.display = 'none';
const response = await fetch('/generate-captcha', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ session_id: sessionId })
});
const result = await response.json();
if (result.success) {
captchaImage.src = result.captcha_image;
captchaStatus.textContent = '请输入4位数字验证码,点击图片可刷新';
captchaVerified = false;
updateSendCodeButton();
} else {
captchaStatus.textContent = '数字验证码加载失败,请刷新页面重试';
}
} catch (error) {
console.error('加载数字验证码失败:', error);
captchaStatus.textContent = '数字验证码加载失败,请检查网络连接';
} finally {
captchaLoading.style.display = 'none';
captchaImage.style.display = 'block';
}
}
function refreshCaptcha() {
sessionId = generateSessionId(); // 生成新的session ID
loadCaptcha();
// 不再自动清空验证码输入框,让用户自己决定是否清空
}
async function verifyCaptcha() {
const captchaCode = document.getElementById('captchaCode').value.trim();
const captchaStatus = document.getElementById('captchaStatus');
if (!captchaCode) {
captchaStatus.textContent = '请输入4位数字验证码';
captchaVerified = false;
updateSendCodeButton();
return;
}
if (!/^\d{4}$/.test(captchaCode)) {
captchaStatus.innerHTML = '<span style="color: red;">请输入4位数字验证码</span>';
captchaVerified = false;
return;
}
try {
const response = await fetch('/verify-captcha', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
session_id: sessionId,
captcha_code: captchaCode
})
});
const result = await response.json();
if (result.success) {
captchaStatus.innerHTML = '<span style="color: green;">✓ 数字验证码验证成功</span>';
captchaVerified = true;
} else {
captchaStatus.innerHTML = '<span style="color: red;">✗ 数字验证码错误,请重新输入</span>';
captchaVerified = false;
refreshCaptcha();
}
updateSendCodeButton();
} catch (error) {
console.error('验证数字验证码失败:', error);
captchaStatus.innerHTML = '<span style="color: red;">验证失败,请检查网络连接</span>';
captchaVerified = false;
updateSendCodeButton();
}
}
function updateSendCodeButton() {
const sendCodeBtn = document.getElementById('sendCodeBtn');
const email = document.getElementById('email').value.trim();
const codeStatus = document.getElementById('codeStatus');
if (captchaVerified && email && validateEmail(email)) {
sendCodeBtn.disabled = false;
codeStatus.textContent = '数字验证码已验证,可以发送邮箱验证码';
} else {
sendCodeBtn.disabled = true;
if (!captchaVerified) {
codeStatus.textContent = '请先验证数字验证码';
} else if (!email) {
codeStatus.textContent = '请先输入邮箱地址';
} else if (!validateEmail(email)) {
codeStatus.textContent = '请输入有效的邮箱地址';
}
}
}
function startCountdown() {
countdownSeconds = 60;
const sendCodeBtn = document.getElementById('sendCodeBtn');
const codeStatus = document.getElementById('codeStatus');
sendCodeBtn.disabled = true;
countdownTimer = setInterval(() => {
countdownSeconds--;
sendCodeBtn.textContent = `重新发送 (${countdownSeconds}s)`;
codeStatus.innerHTML = `<span class="countdown">验证码已发送,${countdownSeconds}秒后可重新发送</span>`;
if (countdownSeconds <= 0) {
clearInterval(countdownTimer);
sendCodeBtn.disabled = false;
sendCodeBtn.textContent = '发送验证码';
codeStatus.textContent = '可以重新发送验证码';
}
}, 1000);
}
async function sendVerificationCode() {
const email = document.getElementById('email').value.trim();
if (!captchaVerified) {
showAlert('请先验证数字验证码');
return;
}
if (!email) {
showAlert('请先输入邮箱地址');
return;
}
if (!validateEmail(email)) {
showAlert('请输入有效的邮箱地址');
return;
}
try {
const response = await fetch('/send-verification-code', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: email,
session_id: sessionId
})
});
const result = await response.json();
if (result.success) {
showAlert(result.message, 'success');
startCountdown();
} else {
showAlert(result.message);
}
} catch (error) {
console.error('发送验证码失败:', error);
showAlert('发送验证码失败,请检查网络连接');
}
}
document.getElementById('registerForm').addEventListener('submit', async function(e) {
e.preventDefault();
const formData = new FormData(this);
const username = formData.get('username').trim();
const email = formData.get('email').trim();
const captchaCode = formData.get('captchaCode').trim();
const verificationCode = formData.get('verificationCode').trim();
const password = formData.get('password');
const confirmPassword = formData.get('confirmPassword');
// 前端验证
if (!captchaVerified) {
showAlert('请先验证数字验证码');
return;
}
if (username.length < 3 || username.length > 20) {
showAlert('用户名长度必须在3-20个字符之间');
return;
}
if (!/^[a-zA-Z0-9_]+$/.test(username)) {
showAlert('用户名只能包含字母、数字和下划线');
return;
}
if (!validateEmail(email)) {
showAlert('请输入有效的邮箱地址');
return;
}
if (verificationCode.length !== 6) {
showAlert('请输入6位验证码');
return;
}
if (password.length < 6) {
showAlert('密码长度至少6个字符');
return;
}
if (password !== confirmPassword) {
showAlert('两次输入的密码不一致');
return;
}
try {
const response = await fetch('/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: username,
email: email,
verification_code: verificationCode,
password: password
})
});
const result = await response.json();
if (result.success) {
showAlert(result.message, 'success');
setTimeout(() => {
window.location.href = '/login.html';
}, 2000);
} else {
showAlert(result.message);
}
} catch (error) {
console.error('注册失败:', error);
showAlert('注册失败,请检查网络连接');
}
});
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
loadCaptcha();
});
// 数字验证码输入框事件
document.getElementById('captchaCode').addEventListener('input', function() {
this.value = this.value.replace(/\D/g, '');
if (this.value.length === 4) {
verifyCaptcha();
} else {
captchaVerified = false;
updateSendCodeButton();
document.getElementById('captchaStatus').textContent = '请输入4位数字验证码';
}
});
// 邮箱输入框事件
document.getElementById('email').addEventListener('input', function() {
updateSendCodeButton();
});
document.getElementById('email').addEventListener('blur', function() {
const email = this.value.trim();
updateSendCodeButton();
});
</script>
</body>
</html>
+400
View File
@@ -0,0 +1,400 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>用户管理 - 闲鱼自动回复系统</title>
<link href="/static/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="/static/lib/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<style>
.admin-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1rem 0;
margin-bottom: 2rem;
}
.user-card {
transition: transform 0.2s;
border: 1px solid #e0e0e0;
}
.user-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.stats-card {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
color: white;
border: none;
}
.btn-danger-custom {
background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
border: none;
}
.btn-danger-custom:hover {
background: linear-gradient(135deg, #ee5a52 0%, #ff6b6b 100%);
}
</style>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="/">
<i class="bi bi-robot"></i> 闲鱼自动回复系统
</a>
<div class="navbar-nav ms-auto">
<a class="nav-link" href="/">
<i class="bi bi-house"></i> 首页
</a>
<a class="nav-link active" href="/user_management.html">
<i class="bi bi-people"></i> 用户管理
</a>
<a class="nav-link" href="/data_management.html">
<i class="bi bi-database"></i> 数据管理
</a>
<a class="nav-link" href="/log_management.html">
<i class="bi bi-file-text"></i> 日志管理
</a>
<a class="nav-link" href="#" onclick="logout()">
<i class="bi bi-box-arrow-right"></i> 退出
</a>
</div>
</div>
</nav>
<!-- 管理员标题 -->
<div class="admin-header">
<div class="container">
<h1 class="mb-0">
<i class="bi bi-people"></i> 用户管理
</h1>
<p class="mb-0 mt-2">管理系统中的所有用户账号</p>
</div>
</div>
<div class="container">
<!-- 统计信息 -->
<div class="row mb-4">
<div class="col-md-3">
<div class="card stats-card">
<div class="card-body text-center">
<h3 id="totalUsers">-</h3>
<p class="mb-0">总用户数</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-white">
<div class="card-body text-center">
<h3 id="totalCookies">-</h3>
<p class="mb-0">总Cookie数</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-success text-white">
<div class="card-body text-center">
<h3 id="totalCards">-</h3>
<p class="mb-0">总卡券数</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-warning text-white">
<div class="card-body text-center">
<h3 id="systemUptime">运行中</h3>
<p class="mb-0">系统状态</p>
</div>
</div>
</div>
</div>
<!-- 用户列表 -->
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">
<i class="bi bi-people-fill"></i> 用户列表
</h5>
<button class="btn btn-primary" onclick="refreshUsers()">
<i class="bi bi-arrow-clockwise"></i> 刷新
</button>
</div>
<div class="card-body">
<div id="loadingUsers" class="text-center py-4">
<div class="spinner-border" role="status">
<span class="visually-hidden">加载中...</span>
</div>
<p class="mt-2">正在加载用户信息...</p>
</div>
<div id="usersList" class="row" style="display: none;"></div>
<div id="noUsers" class="text-center py-4" style="display: none;">
<i class="bi bi-people" style="font-size: 3rem; color: #ccc;"></i>
<p class="mt-2 text-muted">暂无用户</p>
</div>
</div>
</div>
</div>
<!-- 删除确认模态框 -->
<div class="modal fade" id="deleteUserModal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<i class="bi bi-exclamation-triangle text-warning"></i> 确认删除
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<p>您确定要删除用户 <strong id="deleteUserName"></strong> 吗?</p>
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle"></i>
<strong>警告:</strong>此操作将删除该用户的所有数据,包括:
<ul class="mt-2 mb-0">
<li>所有Cookie账号</li>
<li>所有卡券</li>
<li>所有关键字和回复设置</li>
<li>所有个人设置</li>
</ul>
<p class="mt-2 mb-0"><strong>此操作不可恢复!</strong></p>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
<button type="button" class="btn btn-danger-custom" onclick="confirmDeleteUser()">
<i class="bi bi-trash"></i> 确认删除
</button>
</div>
</div>
</div>
</div>
<script src="/static/lib/bootstrap/bootstrap.bundle.min.js"></script>
<script>
let currentDeleteUserId = null;
let deleteUserModal = null;
// 页面加载完成后初始化
document.addEventListener('DOMContentLoaded', function() {
// 检查管理员权限
checkAdminPermission();
// 初始化模态框
deleteUserModal = new bootstrap.Modal(document.getElementById('deleteUserModal'));
// 加载数据
loadSystemStats();
loadUsers();
});
// 检查管理员权限
function checkAdminPermission() {
const token = localStorage.getItem('auth_token');
if (!token) {
alert('请先登录');
window.location.href = '/login.html';
return;
}
// 验证token并检查是否为管理员
fetch('/verify', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
if (!data.authenticated) {
alert('登录已过期,请重新登录');
window.location.href = '/login.html';
return;
}
// 检查是否为管理员
if (data.username !== 'admin') {
alert('此功能仅限管理员使用');
window.location.href = '/';
return;
}
})
.catch(error => {
console.error('权限验证失败:', error);
alert('权限验证失败');
window.location.href = '/login.html';
});
}
// 加载系统统计信息
function loadSystemStats() {
const token = localStorage.getItem('auth_token');
fetch('/admin/stats', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
document.getElementById('totalUsers').textContent = data.users.total;
document.getElementById('totalCookies').textContent = data.cookies.total;
document.getElementById('totalCards').textContent = data.cards.total;
})
.catch(error => {
console.error('加载统计信息失败:', error);
});
}
// 加载用户列表
function loadUsers() {
const token = localStorage.getItem('auth_token');
const loadingDiv = document.getElementById('loadingUsers');
const usersListDiv = document.getElementById('usersList');
const noUsersDiv = document.getElementById('noUsers');
loadingDiv.style.display = 'block';
usersListDiv.style.display = 'none';
noUsersDiv.style.display = 'none';
fetch('/admin/users', {
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
loadingDiv.style.display = 'none';
if (data.users && data.users.length > 0) {
displayUsers(data.users);
usersListDiv.style.display = 'block';
} else {
noUsersDiv.style.display = 'block';
}
})
.catch(error => {
console.error('加载用户列表失败:', error);
loadingDiv.style.display = 'none';
noUsersDiv.style.display = 'block';
alert('加载用户列表失败');
});
}
// 显示用户列表
function displayUsers(users) {
const usersListDiv = document.getElementById('usersList');
usersListDiv.innerHTML = '';
users.forEach(user => {
const userCard = createUserCard(user);
usersListDiv.appendChild(userCard);
});
}
// 创建用户卡片
function createUserCard(user) {
const col = document.createElement('div');
col.className = 'col-md-6 col-lg-4 mb-3';
const isAdmin = user.username === 'admin';
const badgeClass = isAdmin ? 'bg-danger' : 'bg-primary';
const badgeText = isAdmin ? '管理员' : '普通用户';
col.innerHTML = `
<div class="card user-card h-100">
<div class="card-body">
<div class="d-flex justify-content-between align-items-start mb-2">
<h6 class="card-title mb-0">
<i class="bi bi-person-circle"></i> ${user.username}
</h6>
<span class="badge ${badgeClass}">${badgeText}</span>
</div>
<p class="card-text text-muted small mb-2">
<i class="bi bi-envelope"></i> ${user.email}
</p>
<div class="row text-center mb-3">
<div class="col">
<small class="text-muted">Cookie数</small>
<div class="fw-bold">${user.cookie_count || 0}</div>
</div>
<div class="col">
<small class="text-muted">卡券数</small>
<div class="fw-bold">${user.card_count || 0}</div>
</div>
</div>
<div class="text-muted small mb-2">
<i class="bi bi-calendar"></i> 注册时间:${formatDate(user.created_at)}
</div>
${!isAdmin ? `
<div class="d-grid">
<button class="btn btn-danger-custom btn-sm" onclick="deleteUser(${user.id}, '${user.username}')">
<i class="bi bi-trash"></i> 删除用户
</button>
</div>
` : `
<div class="text-center">
<small class="text-muted">
<i class="bi bi-shield-check"></i> 管理员账号不可删除
</small>
</div>
`}
</div>
</div>
`;
return col;
}
// 格式化日期
function formatDate(dateString) {
const date = new Date(dateString);
return date.toLocaleDateString('zh-CN') + ' ' + date.toLocaleTimeString('zh-CN');
}
// 删除用户
function deleteUser(userId, username) {
currentDeleteUserId = userId;
document.getElementById('deleteUserName').textContent = username;
deleteUserModal.show();
}
// 确认删除用户
function confirmDeleteUser() {
if (!currentDeleteUserId) return;
const token = localStorage.getItem('auth_token');
fetch(`/admin/users/${currentDeleteUserId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => {
deleteUserModal.hide();
alert(data.message || '用户删除成功');
// 刷新页面数据
loadSystemStats();
loadUsers();
})
.catch(error => {
console.error('删除用户失败:', error);
alert('删除用户失败');
});
}
// 刷新用户列表
function refreshUsers() {
loadSystemStats();
loadUsers();
}
// 退出登录
function logout() {
localStorage.removeItem('auth_token');
window.location.href = '/login.html';
}
</script>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

+568
View File
@@ -0,0 +1,568 @@
const crypto = require('crypto')
const generate_mid = () => {
return "" + Math.floor(1e3 * Math.random()) + new Date().getTime() + " 0"
}
const generate_uuid = () => {
return "-" + Date.now() + "1"
}
const generate_device_id = (user_id) => {
for (var ee, et = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""), en = [], eo = Math.random, ei = 0; ei < 36; ei++)
8 === ei || 13 === ei || 18 === ei || 23 === ei ? en[ei] = "-" : 14 === ei ? en[ei] = "4" : (ee = 0 | 16 * eo(),
en[ei] = et[19 === ei ? 3 & ee | 8 : ee]);
return en.join("") + "-" + user_id
}
const generate_sign = (t, token, data) => {
const j = t
const h = 34839810
const msg = token + "&" + j + "&" + h + "&" + data
const md5 = crypto.createHash('md5')
md5.update(msg)
return md5.digest('hex')
}
eM = new TextDecoder("utf-8");
eL = null
var sv = Array(4096);
function sg() {
var ee, et = eI[aG++];
if (!(et >= 160) || !(et < 192))
return aG--,
sy(a5());
if (et -= 160,
aX >= aG)
return eR.slice(aG - aq, (aG += et) - aq);
if (!(0 == aX && eO < 180))
return se(et);
var en = (et << 5 ^ (et > 1 ? eZ.getUint16(aG) : et > 0 ? eI[aG] : 0)) & 4095
, eo = sv[en]
, ei = aG
, ec = aG + et - 3
, eu = 0;
if (eo && eo.bytes == et) {
for (; ei < ec;) {
if ((ee = eZ.getUint32(ei)) != eo[eu++]) {
ei = 1879048192;
break
}
ei += 4
}
for (ec += 3; ei < ec;)
if ((ee = eI[ei++]) != eo[eu++]) {
ei = 1879048192;
break
}
if (ei === ec)
return aG = ei,
eo.string;
ec -= 3,
ei = aG
}
for (eo = [],
sv[en] = eo,
eo.bytes = et; ei < ec;)
ee = eZ.getUint32(ei),
eo.push(ee),
ei += 4;
for (ec += 3; ei < ec;)
ee = eI[ei++],
eo.push(ee);
var ed = et < 16 ? su(et) : sl(et);
return null != ed ? eo.string = ed : eo.string = se(et)
}
function sy(ee) {
if ("string" == typeof ee)
return ee;
if ("number" == typeof ee || "boolean" == typeof ee || "bigint" == typeof ee)
return ee.toString();
if (null == ee)
return ee + "";
throw Error("Invalid property type for record", typeof ee)
}
r9 = function (ee) {
return atob(rW(ee))
}
rW = function (ee) {
return ee.replace(/[^A-Za-z0-9\+\/]/g, "")
}
aW = {
"useRecords": false,
"mapsAsObjects": true
}
aJ = false
eP = []
function a3(ee) {
if (!aW.trusted && !aJ) {
var et, en, eo = eP.sharedLength || 0;
eo < eP.length && (eP.length = eo)
}
if (aW.randomAccessStructure && eI[aG] < 64 && eI[aG] >= 32 && ej ? (et = ej(eI, aG, eO, aW),
eI = null,
!(ee && ee.lazy) && et && (et = et.toJSON()),
aG = eO) : et = a5(),
eD && (aG = eD.postBundlePosition,
eD = null),
aJ && (eP.restoreStructures = null),
aG == eO)
eP && eP.restoreStructures && a4(),
eP = null,
eI = null,
eL && (eL = null);
else if (aG > eO)
throw Error("Unexpected end of MessagePack data");
else if (!aJ) {
try {
en = JSON.stringify(et, function (ee, et) {
return "bigint" == typeof et ? "".concat(et, "n") : et
}).slice(0, 100)
} catch (ee) {
en = "(JSON view not available " + ee + ")"
}
throw Error("Data read, but end of buffer not reached " + en)
}
return et
}
function so(ee) {
if (ee < 16 && (et = su(ee)))
return et;
if (ee > 64 && eM)
return eM.decode(eI.subarray(aG, aG += ee));
var et, en = aG + ee, eo = [];
for (et = ""; aG < en;) {
var ei = eI[aG++];
if ((128 & ei) === 0)
eo.push(ei);
else if ((224 & ei) === 192) {
var ec = 63 & eI[aG++];
eo.push((31 & ei) << 6 | ec)
} else if ((240 & ei) === 224) {
var eu = 63 & eI[aG++]
, ed = 63 & eI[aG++];
eo.push((31 & ei) << 12 | eu << 6 | ed)
} else if ((248 & ei) === 240) {
var ef = (7 & ei) << 18 | (63 & eI[aG++]) << 12 | (63 & eI[aG++]) << 6 | 63 & eI[aG++];
ef > 65535 && (ef -= 65536,
eo.push(ef >>> 10 & 1023 | 55296),
ef = 56320 | 1023 & ef),
eo.push(ef)
} else
eo.push(ei);
eo.length >= 4096 && (et += sc.apply(String, eo),
eo.length = 0)
}
return eo.length > 0 && (et += sc.apply(String, eo)),
et
}
se = so;
var sc = String.fromCharCode;
function sl(ee) {
for (var et = aG, en = Array(ee), eo = 0; eo < ee; eo++) {
var ei = eI[aG++];
if ((128 & ei) > 0) {
aG = et;
return
}
en[eo] = ei
}
return sc.apply(String, en)
}
function su(ee) {
if (ee < 4) {
if (ee < 2) {
if (0 === ee)
return "";
var et = eI[aG++];
if ((128 & et) > 1) {
aG -= 1;
return
}
return sc(et)
}
var en = eI[aG++]
, eo = eI[aG++];
if ((128 & en) > 0 || (128 & eo) > 0) {
aG -= 2;
return
}
if (ee < 3)
return sc(en, eo);
var ei = eI[aG++];
if ((128 & ei) > 0) {
aG -= 3;
return
}
return sc(en, eo, ei)
}
var ec = eI[aG++]
, eu = eI[aG++]
, ed = eI[aG++]
, ef = eI[aG++];
if ((128 & ec) > 0 || (128 & eu) > 0 || (128 & ed) > 0 || (128 & ef) > 0) {
aG -= 4;
return
}
if (ee < 6) {
if (4 === ee)
return sc(ec, eu, ed, ef);
var ep = eI[aG++];
if ((128 & ep) > 0) {
aG -= 5;
return
}
return sc(ec, eu, ed, ef, ep)
}
if (ee < 8) {
var em = eI[aG++]
, eh = eI[aG++];
if ((128 & em) > 0 || (128 & eh) > 0) {
aG -= 6;
return
}
if (ee < 7)
return sc(ec, eu, ed, ef, em, eh);
var ev = eI[aG++];
if ((128 & ev) > 0) {
aG -= 7;
return
}
return sc(ec, eu, ed, ef, em, eh, ev)
}
var eg = eI[aG++]
, eC = eI[aG++]
, eS = eI[aG++]
, ew = eI[aG++];
if ((128 & eg) > 0 || (128 & eC) > 0 || (128 & eS) > 0 || (128 & ew) > 0) {
aG -= 8;
return
}
if (ee < 10) {
if (8 === ee)
return sc(ec, eu, ed, ef, eg, eC, eS, ew);
var eE = eI[aG++];
if ((128 & eE) > 0) {
aG -= 9;
return
}
return sc(ec, eu, ed, ef, eg, eC, eS, ew, eE)
}
if (ee < 12) {
var ek = eI[aG++]
, e_ = eI[aG++];
if ((128 & ek) > 0 || (128 & e_) > 0) {
aG -= 10;
return
}
if (ee < 11)
return sc(ec, eu, ed, ef, eg, eC, eS, ew, ek, e_);
var eT = eI[aG++];
if ((128 & eT) > 0) {
aG -= 11;
return
}
return sc(ec, eu, ed, ef, eg, eC, eS, ew, ek, e_, eT)
}
var eN = eI[aG++]
, eM = eI[aG++]
, eO = eI[aG++]
, eP = eI[aG++];
if ((128 & eN) > 0 || (128 & eM) > 0 || (128 & eO) > 0 || (128 & eP) > 0) {
aG -= 12;
return
}
if (ee < 14) {
if (12 === ee)
return sc(ec, eu, ed, ef, eg, eC, eS, ew, eN, eM, eO, eP);
var eR = eI[aG++];
if ((128 & eR) > 0) {
aG -= 13;
return
}
return sc(ec, eu, ed, ef, eg, eC, eS, ew, eN, eM, eO, eP, eR)
}
var eD = eI[aG++]
, eL = eI[aG++];
if ((128 & eD) > 0 || (128 & eL) > 0) {
aG -= 14;
return
}
if (ee < 15)
return sc(ec, eu, ed, ef, eg, eC, eS, ew, eN, eM, eO, eP, eD, eL);
var eZ = eI[aG++];
if ((128 & eZ) > 0) {
aG -= 15;
return
}
return sc(ec, eu, ed, ef, eg, eC, eS, ew, eN, eM, eO, eP, eD, eL, eZ)
}
function ss(ee) {
if (aW.mapsAsObjects) {
for (var et = {}, en = 0; en < ee; en++) {
var eo = sg();
"__proto__" === eo && (eo = "__proto_"),
et[eo] = a5()
}
return et
}
for (var ei = new Map, ec = 0; ec < ee; ec++)
ei.set(a5(), a5());
return ei
}
function a5() {
var ee, et = eI[aG++];
if (et < 160) {
if (et < 128) {
if (et < 64)
return et;
var en = eP[63 & et] || aW.getStructures && a9()[63 & et];
return en ? (en.read || (en.read = a8(en, 63 & et)),
en.read()) : et
}
if (et < 144) {
if (et -= 128,
aW.mapsAsObjects) {
for (var eo = {}, ei = 0; ei < et; ei++) {
var ec = sg();
"__proto__" === ec && (ec = "__proto_"),
eo[ec] = a5()
}
return eo
}
for (var eu = new Map, ed = 0; ed < et; ed++)
eu.set(a5(), a5());
return eu
}
for (var ef = Array(et -= 144), ep = 0; ep < et; ep++)
ef[ep] = a5();
return aW.freezeData ? Object.freeze(ef) : ef
}
if (et < 192) {
var em = et - 160;
if (aX >= aG)
return eR.slice(aG - aq, (aG += em) - aq);
if (0 == aX && eO < 140) {
var eh = em < 16 ? su(em) : sl(em);
if (null != eh)
return eh
}
return se(em)
}
switch (et) {
case 192:
return null;
case 193:
if (eD) {
if ((ee = a5()) > 0)
return eD[1].slice(eD.position1, eD.position1 += ee);
return eD[0].slice(eD.position0, eD.position0 -= ee)
}
return aY;
case 194:
return !1;
case 195:
return !0;
case 196:
if (void 0 === (ee = eI[aG++]))
throw Error("Unexpected end of buffer");
return sm(ee);
case 197:
return ee = eZ.getUint16(aG),
aG += 2,
sm(ee);
case 198:
return ee = eZ.getUint32(aG),
aG += 4,
sm(ee);
case 199:
return sh(eI[aG++]);
case 200:
return ee = eZ.getUint16(aG),
aG += 2,
sh(ee);
case 201:
return ee = eZ.getUint32(aG),
aG += 4,
sh(ee);
case 202:
if (ee = eZ.getFloat32(aG),
aW.useFloat32 > 2) {
var ev = sT[(127 & eI[aG]) << 1 | eI[aG + 1] >> 7];
return aG += 4,
(ev * ee + (ee > 0 ? .5 : -.5) >> 0) / ev
}
return aG += 4,
ee;
case 203:
return ee = eZ.getFloat64(aG),
aG += 8,
ee;
case 204:
return eI[aG++];
case 205:
return ee = eZ.getUint16(aG),
aG += 2,
ee;
case 206:
return ee = eZ.getUint32(aG),
aG += 4,
ee;
case 207:
return "number" === aW.int64AsType ? ee = 4294967296 * eZ.getUint32(aG) + eZ.getUint32(aG + 4) : "string" === aW.int64AsType ? ee = eZ.getBigUint64(aG).toString() : "auto" === aW.int64AsType ? (ee = eZ.getBigUint64(aG)) <= BigInt(2) << BigInt(52) && (ee = Number(ee)) : ee = eZ.getBigUint64(aG),
aG += 8,
ee;
case 208:
return eZ.getInt8(aG++);
case 209:
return ee = eZ.getInt16(aG),
aG += 2,
ee;
case 210:
return ee = eZ.getInt32(aG),
aG += 4,
ee;
case 211:
return "number" === aW.int64AsType ? ee = 4294967296 * eZ.getInt32(aG) + eZ.getUint32(aG + 4) : "string" === aW.int64AsType ? ee = eZ.getBigInt64(aG).toString() : "auto" === aW.int64AsType ? (ee = eZ.getBigInt64(aG)) >= BigInt(-2) << BigInt(52) && ee <= BigInt(2) << BigInt(52) && (ee = Number(ee)) : ee = eZ.getBigInt64(aG),
aG += 8,
ee;
case 212:
if (114 == (ee = eI[aG++]))
return sC(63 & eI[aG++]);
var eg = aK[ee];
if (eg) {
if (eg.read)
return aG++,
eg.read(a5());
if (eg.noBuffer)
return aG++,
eg();
return eg(eI.subarray(aG, ++aG))
}
throw Error("Unknown extension " + ee);
case 213:
if (114 == (ee = eI[aG]))
return aG++,
sC(63 & eI[aG++], eI[aG++]);
return sh(2);
case 214:
return sh(4);
case 215:
return sh(8);
case 216:
return sh(16);
case 217:
if (ee = eI[aG++],
aX >= aG)
return eR.slice(aG - aq, (aG += ee) - aq);
return st(ee);
case 218:
if (ee = eZ.getUint16(aG),
aG += 2,
aX >= aG)
return eR.slice(aG - aq, (aG += ee) - aq);
return sn(ee);
case 219:
if (ee = eZ.getUint32(aG),
aG += 4,
aX >= aG)
return eR.slice(aG - aq, (aG += ee) - aq);
return sr(ee);
case 220:
return ee = eZ.getUint16(aG),
aG += 2,
si(ee);
case 221:
return ee = eZ.getUint32(aG),
aG += 4,
si(ee);
case 222:
return ee = eZ.getUint16(aG),
aG += 2,
ss(ee);
case 223:
return ee = eZ.getUint32(aG),
aG += 4,
ss(ee);
default:
if (et >= 224)
return et - 256;
if (void 0 === et) {
var eC = Error("Unexpected end of MessagePack data");
throw eC.incomplete = !0,
eC
}
throw Error("Unknown MessagePack token " + et)
}
}
sn = so
var a6 = /^[a-zA-Z_$][a-zA-Z\d_$]*$/;
const decrypt = (ee) => {
for (var et, en, eo = r9(ee), ei = eo.length, ec = new Uint8Array(ei), eu = 0; eu < ei; eu++) {
var ed = eo.charCodeAt(eu);
ec[eu] = ed
}
en = {}
et = ec;
et.buffer || et.constructor !== ArrayBuffer || (et = "undefined" != typeof Buffer ? Buffer.from(et) : new Uint8Array(et)),
"object" == typeof en ? (eO = en.end || et.length,
aG = en.start || 0) : (aG = 0,
eO = en > -1 ? en : et.length),
aX = 0,
eR = null,
eD = null,
eI = et;
eM = new TextDecoder("utf-8");
eL = null
eP = [];
eZ = et.dataView || (et.dataView = new DataView(et.buffer, et.byteOffset, et.byteLength))
res = a3(en)
// ec = ecc;
// rA = 0;
// rB = 0;
// ed = [];
// eu = ec.length;
// rj = {
// "useRecords": false,
// "mapsAsObjects": true
// }
// // ei 是 TextDecoder
// ei = new TextDecoder("utf-8");
// eh = new DataView(ec.buffer, ec.byteOffset, ec.byteLength);
// ec.dataView = eh;
// let res = rK()
const replacer = (key, value) => {
if (typeof value === 'bigint') {
return value.toString();
}
return value;
};
res = JSON.stringify(res, replacer);
return res;
}
// console.log(generate_mid())
// console.log(generate_uuid())
// console.log(generate_device_id())
// console.log(generate_sign('5f65b00f83994987e334f97360d69557', '{"sessionTypes":"1,19"}'))
// let msg = "ggGLAYEBtTIyMDI2NDA5MTgwNzlAZ29vZmlzaAKzNDc4MTI4NzAwMDBAZ29vZmlzaAOxMzQwMjM5MTQ3MjUwMy5QTk0EAAXPAAABlYW04bIGggFlA4UBoAKjMTExA6AEAQXaADR7ImF0VXNlcnMiOltdLCJjb250ZW50VHlwZSI6MSwidGV4dCI6eyJ0ZXh0IjoiMTExIn19BwIIAQkACoupX3BsYXRmb3Jtp2FuZHJvaWSmYml6VGFn2gBBeyJzb3VyY2VJZCI6IlM6MSIsIm1lc3NhZ2VJZCI6ImYzNjkwMmVmZjQ1NDQ1YmRiMmQxYjBmZDE2OGY4MjY0In2sZGV0YWlsTm90aWNlozExMadleHRKc29u2gBLeyJxdWlja1JlcGx5IjoiMSIsIm1lc3NhZ2VJZCI6ImYzNjkwMmVmZjQ1NDQ1YmRiMmQxYjBmZDE2OGY4MjY0IiwidGFnIjoidSJ9r3JlbWluZGVyQ29udGVudKMxMTGucmVtaW5kZXJOb3RpY2W15Y+R5p2l5LiA5p2h5paw5raI5oGvrXJlbWluZGVyVGl0bGWmc2hh5L+uq3JlbWluZGVyVXJs2gCbZmxlYW1hcmtldDovL21lc3NhZ2VfY2hhdD9pdGVtSWQ9ODk3NzQyNzQ4MDExJnBlZXJVc2VySWQ9MjIwMjY0MDkxODA3OSZwZWVyVXNlck5pY2s9dCoqKjEmc2lkPTQ3ODEyODcwMDAwJm1lc3NhZ2VJZD1mMzY5MDJlZmY0NTQ0NWJkYjJkMWIwZmQxNjhmODI2NCZhZHY9bm+sc2VuZGVyVXNlcklkrTIyMDI2NDA5MTgwNzmuc2VuZGVyVXNlclR5cGWhMKtzZXNzaW9uVHlwZaExDAEDgahuZWVkUHVzaKR0cnVl";
//
// msg = "ggGLAYEBsjMxNDk2MzcwNjNAZ29vZmlzaAKzNDc5ODMzODkwOTZAZ29vZmlzaAOxMzQxNjU2NTI3NDU0Mi5QTk0EAAXPAAABlbKji20GggFlA4UBoAK6W+aIkeW3suaLjeS4i++8jOW+heS7mOasvl0DoAQaBdoEKnsiY29udGVudFR5cGUiOjI2LCJkeENhcmQiOnsiaXRlbSI6eyJtYWluIjp7ImNsaWNrUGFyYW0iOnsiYXJnMSI6Ik1zZ0NhcmQiLCJhcmdzIjp7InNvdXJjZSI6ImltIiwidGFza19pZCI6IjNleFFKSE9UbVBVMSIsIm1zZ19pZCI6ImNjOGJjMmRmN2M5MzRkZjA4NmUwNTY3Y2I2OWYxNTczIn19LCJleENvbnRlbnQiOnsiYmdDb2xvciI6IiNGRkZGRkYiLCJidXR0b24iOnsiYmdDb2xvciI6IiNGRkU2MEYiLCJib3JkZXJDb2xvciI6IiNGRkU2MEYiLCJjbGlja1BhcmFtIjp7ImFyZzEiOiJNc2dDYXJkQWN0aW9uIiwiYXJncyI6eyJzb3VyY2UiOiJpbSIsInRhc2tfaWQiOiIzZXhRSkhPVG1QVTEiLCJtc2dfaWQiOiJjYzhiYzJkZjdjOTM0ZGYwODZlMDU2N2NiNjlmMTU3MyJ9fSwiZm9udENvbG9yIjoiIzMzMzMzMyIsInRhcmdldFVybCI6ImZsZWFtYXJrZXQ6Ly9hZGp1c3RfcHJpY2U/Zmx1dHRlcj10cnVlJmJpek9yZGVySWQ9MjUwMzY4ODEyNjM1NjYzNjM3MCIsInRleHQiOiLkv67mlLnku7fmoLwifSwiZGVzYyI6Iuivt+WPjOaWueayn+mAmuWPiuaXtuehruiupOS7t+agvCIsImRlc2NDb2xvciI6IiNBM0EzQTMiLCJ0aXRsZSI6IuaIkeW3suaLjeS4i++8jOW+heS7mOasviIsInVwZ3JhZGUiOnsidGFyZ2V0VXJsIjoiaHR0cHM6Ly9oNS5tLmdvb2Zpc2guY29tL2FwcC9pZGxlRmlzaC1GMmUvZm0tZG93bmxhb2QvaG9tZS5odG1sP25vUmVkcmllY3Q9dHJ1ZSZjYW5CYWNrPXRydWUmY2hlY2tWZXJzaW9uPXRydWUiLCJ2ZXJzaW9uIjoiNy43LjkwIn19LCJ0YXJnZXRVcmwiOiJmbGVhbWFya2V0Oi8vb3JkZXJfZGV0YWlsP2lkPTI1MDM2ODgxMjYzNTY2MzYzNzAmcm9sZT1zZWxsZXIifX0sInRlbXBsYXRlIjp7Im5hbWUiOiJpZGxlZmlzaF9tZXNzYWdlX3RyYWRlX2NoYXRfY2FyZCIsInVybCI6Imh0dHBzOi8vZGluYW1pY3guYWxpYmFiYXVzZXJjb250ZW50LmNvbS9wdWIvaWRsZWZpc2hfbWVzc2FnZV90cmFkZV9jaGF0X2NhcmQvMTY2NzIyMjA1Mjc2Ny9pZGxlZmlzaF9tZXNzYWdlX3RyYWRlX2NoYXRfY2FyZC56aXAiLCJ2ZXJzaW9uIjoiMTY2NzIyMjA1Mjc2NyJ9fX0HAQgBCQAK3gAQpmJpelRhZ9oAe3sic291cmNlSWQiOiJDMkM6M2V4UUpIT1RtUFUxIiwidGFza05hbWUiOiLlt7Lmi43kuItf5pyq5LuY5qy+X+WNluWutiIsIm1hdGVyaWFsSWQiOiIzZXhRSkhPVG1QVTEiLCJ0YXNrSWQiOiIzZXhRSkhPVG1QVTEifbFjbG9zZVB1c2hSZWNlaXZlcqVmYWxzZbFjbG9zZVVucmVhZE51bWJlcqVmYWxzZaxkZXRhaWxOb3RpY2W6W+aIkeW3suaLjeS4i++8jOW+heS7mOasvl2nZXh0SnNvbtoBr3sibXNnQXJncyI6eyJ0YXNrX2lkIjoiM2V4UUpIT1RtUFUxIiwic291cmNlIjoiaW0iLCJtc2dfaWQiOiJjYzhiYzJkZjdjOTM0ZGYwODZlMDU2N2NiNjlmMTU3MyJ9LCJxdWlja1JlcGx5IjoiMSIsIm1zZ0FyZzEiOiJNc2dDYXJkIiwidXBkYXRlS2V5IjoiNDc5ODMzODkwOTY6MjUwMzY4ODEyNjM1NjYzNjM3MDoxX25vdF9wYXlfc2VsbGVyIiwibWVzc2FnZUlkIjoiY2M4YmMyZGY3YzkzNGRmMDg2ZTA1NjdjYjY5ZjE1NzMiLCJtdWx0aUNoYW5uZWwiOnsiaHVhd2VpIjoiRVhQUkVTUyIsInhpYW9taSI6IjEwODAwMCIsIm9wcG8iOiJFWFBSRVNTIiwiaG9ub3IiOiJOT1JNQUwiLCJhZ29vIjoicHJvZHVjdCIsInZpdm8iOiJPUkRFUiJ9LCJjb250ZW50VHlwZSI6IjI2IiwiY29ycmVsYXRpb25Hcm91cElkIjoiM2V4UUpIT1RtUFUxX0ZGcjRHT1NuOE9RbyJ9qHJlY2VpdmVyrTIyMDI2NDA5MTgwNzmrcmVkUmVtaW5kZXKy562J5b6F5Lmw5a625LuY5qy+sHJlZFJlbWluZGVyU3R5bGWhMa9yZW1pbmRlckNvbnRlbnS6W+aIkeW3suaLjeS4i++8jOW+heS7mOasvl2ucmVtaW5kZXJOb3RpY2W75Lmw5a625bey5ouN5LiL77yM5b6F5LuY5qy+rXJlbWluZGVyVGl0bGW75Lmw5a625bey5ouN5LiL77yM5b6F5LuY5qy+q3JlbWluZGVyVXJs2gCaZmxlYW1hcmtldDovL21lc3NhZ2VfY2hhdD9pdGVtSWQ9OTAwMDUyNjQ0Mjc3JnBlZXJVc2VySWQ9MzE0OTYzNzA2MyZwZWVyVXNlck5pY2s955S3KioqeSZzaWQ9NDc5ODMzODkwOTYmbWVzc2FnZUlkPWNjOGJjMmRmN2M5MzRkZjA4NmUwNTY3Y2I2OWYxNTczJmFkdj1ub6xzZW5kZXJVc2VySWSqMzE0OTYzNzA2M65zZW5kZXJVc2VyVHlwZaEwq3Nlc3Npb25UeXBloTGqdXBkYXRlSGVhZKR0cnVlDAEDgahuZWVkUHVzaKR0cnVl"
// msg = "hAGzNDc5ODMzODkwOTZAZ29vZmlzaAIBA4KrcmVkUmVtaW5kZXKy562J5b6F5Lmw5a625LuY5qy+sHJlZFJlbWluZGVyU3R5bGWhMQTPAAABlbMlNng="
// res = decrypt(msg);
// console.log(res);