mirror of
https://github.com/halfwaystudent/douyin-sparkflow.git
synced 2026-09-08 08:57:27 +08:00
Update send console workflow and redesign dashboard UI
This commit is contained in:
@@ -35,6 +35,5 @@
|
||||
"happyNewYear": {
|
||||
"enabled": true,
|
||||
"messageTemplate": "\r\n"
|
||||
},
|
||||
"useProtocolSender": false
|
||||
}
|
||||
}
|
||||
@@ -374,7 +374,18 @@ def _select_due_targets(user, send_window, now):
|
||||
microsecond=0,
|
||||
)
|
||||
if now < window_start or now > window_end:
|
||||
return [], [], [(target, _scheduled_send_time(user, target, send_window, now)) for target in targets], []
|
||||
already_sent = []
|
||||
pending_targets = []
|
||||
queued_failures = []
|
||||
for target_name in targets:
|
||||
if _target_sent_today(user, target_name, now):
|
||||
already_sent.append(target_name)
|
||||
continue
|
||||
if _target_failed_today(user, target_name, now):
|
||||
queued_failures.append(target_name)
|
||||
continue
|
||||
pending_targets.append((target_name, _scheduled_send_time(user, target_name, send_window, now)))
|
||||
return [], already_sent, pending_targets, queued_failures
|
||||
|
||||
due_targets = []
|
||||
already_sent = []
|
||||
|
||||
@@ -575,9 +575,9 @@ def create_app():
|
||||
|
||||
pid = run_task_now()
|
||||
if pid == -1:
|
||||
flash(request, "Failed to start failed-target retry run. Check server logs for details.", "error")
|
||||
flash(request, "Failed to start the full resend run. Check server logs for details.", "error")
|
||||
else:
|
||||
flash(request, f"Triggered a failed-target retry run in the background (pid {pid}).", "success")
|
||||
flash(request, f"Triggered a full resend run in the background (pid {pid}).", "success")
|
||||
return redirect("/")
|
||||
|
||||
@app.post("/ops/proxy/refresh")
|
||||
|
||||
@@ -196,7 +196,6 @@ def run_task_now():
|
||||
cwd=cwd,
|
||||
env={
|
||||
"SPARKFLOW_MANUAL_RUN": "1",
|
||||
"SPARKFLOW_MANUAL_FAILED_ONLY": "1",
|
||||
"PYTHONUNBUFFERED": "1",
|
||||
},
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,100 +1,558 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}抖音多账号续火花控制台{% endblock %}
|
||||
{% block page_title %}抖音多账号续火花控制台{% endblock %}
|
||||
{% block nav_key %}dashboard{% endblock %}
|
||||
{% block title %}自动续火花控制台{% endblock %}
|
||||
{% block page_title %}自动续火花控制台{% endblock %}
|
||||
{% block page_subtitle %}多账号发送与运营管理{% endblock %}
|
||||
|
||||
{% block topbar_actions %}
|
||||
<a class="ghost-button" href="/ops/send-console">✦ 发送控制台</a>
|
||||
<form method="post" action="/ops/run-now">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">✈ 补发全部对象</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% set enabled_accounts = accounts | selectattr("enabled", "equalto", true) | list %}
|
||||
{% set send_summary = ops.send_console.summary %}
|
||||
{% set proxy_rows = ops.containers | selectattr("Names", "equalto", "mihomo") | list %}
|
||||
<div class="layout-grid">
|
||||
<div class="stack">
|
||||
<section class="panel">
|
||||
|
||||
<style>
|
||||
.dashboard-shell {
|
||||
display: grid;
|
||||
gap: 22px;
|
||||
}
|
||||
|
||||
.dashboard-overview {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.dashboard-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 360px;
|
||||
gap: 22px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.dashboard-main,
|
||||
.dashboard-side {
|
||||
display: grid;
|
||||
gap: 22px;
|
||||
}
|
||||
|
||||
.dashboard-overview .stat-card {
|
||||
min-height: 132px;
|
||||
}
|
||||
|
||||
.dashboard-kpi-icon {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.dashboard-kpi-subline {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.section-anchor-note {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--text-soft);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.section-anchor-note::before {
|
||||
content: "";
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, var(--primary), #8eb0ff);
|
||||
box-shadow: 0 0 0 4px rgba(47, 103, 255, 0.12);
|
||||
}
|
||||
|
||||
.quick-panels {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.quick-panel {
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(180deg, #ffffff, #fbfdff);
|
||||
box-shadow: var(--shadow-soft);
|
||||
padding: 18px 18px 20px;
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.quick-panel__title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.quick-panel__desc {
|
||||
color: var(--text-soft);
|
||||
font-size: 13px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.inline-code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
border-radius: 999px;
|
||||
padding: 3px 8px;
|
||||
background: #f4f7fd;
|
||||
color: #7284a2;
|
||||
}
|
||||
|
||||
.action-stack {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.login-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 320px minmax(0, 1fr) 300px;
|
||||
gap: 18px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(180deg, #ffffff, #fcfdff);
|
||||
box-shadow: var(--shadow-soft);
|
||||
padding: 18px;
|
||||
min-height: 340px;
|
||||
}
|
||||
|
||||
.login-box.warning {
|
||||
background: linear-gradient(180deg, #fbfdff, #f3f7ff);
|
||||
}
|
||||
|
||||
.login-box.highlight {
|
||||
background: linear-gradient(180deg, #fcfffd, #f3fbf6);
|
||||
}
|
||||
|
||||
.login-stepbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 2px 2px 10px;
|
||||
}
|
||||
|
||||
.step-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: var(--text-soft);
|
||||
font-weight: 700;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.step-index {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #fff;
|
||||
background: linear-gradient(180deg, #4e7dff, #2f67ff);
|
||||
box-shadow: 0 10px 18px rgba(47, 103, 255, 0.18);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.step-connector {
|
||||
flex: 1;
|
||||
min-width: 32px;
|
||||
height: 2px;
|
||||
border-radius: 999px;
|
||||
background: linear-gradient(90deg, rgba(47, 103, 255, 0.2), rgba(214, 223, 238, 0.85));
|
||||
}
|
||||
|
||||
.login-lead {
|
||||
color: #476180;
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.feature-list {
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
color: var(--text);
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.url-field {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.url-field input {
|
||||
flex: 1;
|
||||
background: #fbfcff;
|
||||
}
|
||||
|
||||
.url-copy {
|
||||
width: 46px;
|
||||
padding: 11px 0;
|
||||
}
|
||||
|
||||
.desktop-frame-wrap {
|
||||
overflow: hidden;
|
||||
border-radius: 18px;
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
background: #0d1525;
|
||||
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
|
||||
}
|
||||
|
||||
.desktop-frame {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 10;
|
||||
border: none;
|
||||
display: block;
|
||||
background: #0d1525;
|
||||
}
|
||||
|
||||
.status-list {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin: 8px 0 18px;
|
||||
}
|
||||
|
||||
.status-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: var(--text-soft);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
background: #e3ebf7;
|
||||
border: 1px solid #d5ddec;
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255,0.78);
|
||||
}
|
||||
|
||||
.status-item.pending .status-dot {
|
||||
background: #dce8ff;
|
||||
border-color: #bdd1ff;
|
||||
}
|
||||
|
||||
.status-item.success .status-dot {
|
||||
background: #d2f5df;
|
||||
border-color: #9dd3b2;
|
||||
}
|
||||
|
||||
.status-item.error .status-dot {
|
||||
background: #ffe1de;
|
||||
border-color: #f3b5af;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(38, 176, 100, 0.16);
|
||||
background: linear-gradient(180deg, rgba(38, 176, 100, 0.07), rgba(38, 176, 100, 0.03));
|
||||
padding: 16px;
|
||||
color: #335c47;
|
||||
line-height: 1.7;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.summary-table td:first-child strong {
|
||||
display: inline-block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.summary-table td:first-child span {
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
color: var(--text-soft);
|
||||
}
|
||||
|
||||
.account-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.account-card {
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(180deg, #ffffff, #fbfdff);
|
||||
box-shadow: var(--shadow-soft);
|
||||
padding: 18px;
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.account-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.account-ident {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.avatar-photo {
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(180deg, #7ea9ff, #5888ff);
|
||||
color: #fff;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
box-shadow: 0 10px 18px rgba(47, 103, 255, 0.22);
|
||||
}
|
||||
|
||||
.account-name {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.account-sub {
|
||||
margin-top: 5px;
|
||||
color: var(--text-soft);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.metric-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.metric-box {
|
||||
border-radius: 16px;
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
background: #f9fbff;
|
||||
padding: 12px 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.metric-box .label {
|
||||
display: block;
|
||||
color: var(--text-soft);
|
||||
font-size: 12px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.metric-box strong {
|
||||
font-size: 17px;
|
||||
}
|
||||
|
||||
.friend-picker {
|
||||
border-radius: 18px;
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
background: linear-gradient(180deg, #fbfdff, #f6f9ff);
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.friend-picker-toolbar {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.friend-picker-title {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.friend-picker-list {
|
||||
max-height: 220px;
|
||||
overflow: auto;
|
||||
border-radius: 14px;
|
||||
border: 1px solid rgba(227, 235, 245, 0.96);
|
||||
background: #fff;
|
||||
padding: 8px;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.friend-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
border-radius: 12px;
|
||||
border: 1px solid transparent;
|
||||
padding: 9px 10px;
|
||||
}
|
||||
|
||||
.friend-option.selected {
|
||||
background: var(--primary-soft);
|
||||
border-color: rgba(47, 103, 255, 0.12);
|
||||
}
|
||||
|
||||
.friend-picker-empty {
|
||||
padding: 18px 12px;
|
||||
text-align: center;
|
||||
color: var(--text-soft);
|
||||
}
|
||||
|
||||
.dashboard-side .panel h2 {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.settings-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.ops-card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.ops-card-grid .panel {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 1480px) {
|
||||
.quick-panels,
|
||||
.ops-card-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.account-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.login-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.settings-grid,
|
||||
.metric-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="dashboard-shell">
|
||||
<section class="dashboard-overview">
|
||||
<div class="section-anchor-note">首页总览 · 当前系统状态与发送概况</div>
|
||||
|
||||
<div class="stats-grid">
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">账号总数</span>
|
||||
<span class="muted compact">已启用 {{ enabled_accounts|length }} / 总数 {{ accounts|length }}</span>
|
||||
<strong class="stat-value">{{ accounts|length }}</strong>
|
||||
<span class="stat-label">启用账号</span>
|
||||
<strong class="stat-value">{{ enabled_accounts|length }}</strong>
|
||||
<div class="dashboard-kpi-subline">
|
||||
<span class="muted">总账号 {{ accounts|length }}</span>
|
||||
</div>
|
||||
<div class="stat-icon blue">👥</div>
|
||||
</div>
|
||||
<div class="stat-icon blue"><span class="dashboard-kpi-icon">👥</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">今日发送计划时间</span>
|
||||
<span class="muted compact">下一次执行:{{ ops.daily_schedule or "未配置" }}</span>
|
||||
<strong class="stat-subvalue">{{ ops.daily_schedule or "未配置" }}</strong>
|
||||
<span class="stat-label">今日成功目标</span>
|
||||
<strong class="stat-value">{{ send_summary.today_sent_targets }}</strong>
|
||||
<div class="dashboard-kpi-subline">
|
||||
<span class="stat-help positive">成功结果来自浏览器真实发送确认</span>
|
||||
</div>
|
||||
<div class="stat-icon green">🕒</div>
|
||||
</div>
|
||||
<div class="stat-icon green"><span class="dashboard-kpi-icon">🎯</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">代理容器状态</span>
|
||||
<span class="muted compact">容器在线 / 离线</span>
|
||||
<div class="status-line">
|
||||
<span class="pill {% if proxy_rows %}soft{% else %}warning{% endif %}">{{ proxy_rows|length }} / {{ ops.containers|length }}</span>
|
||||
<span class="pill {% if ops.image_present %}soft{% else %}warning{% endif %}">
|
||||
{% if ops.image_present %}镜像已构建{% else %}镜像待构建{% endif %}
|
||||
</span>
|
||||
<span class="stat-label">失败待补发</span>
|
||||
<strong class="stat-value">{{ send_summary.today_failed_targets }}</strong>
|
||||
<div class="dashboard-kpi-subline">
|
||||
<span class="stat-help negative">失败会进入补发与重试队列</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="stat-icon soft">▣</div>
|
||||
<div class="stat-icon red"><span class="dashboard-kpi-icon">⚠</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">交互式登录桌面</span>
|
||||
<span class="muted compact"><a href="{{ login_desktop_public_url }}" target="_blank" rel="noreferrer">{{ login_desktop_public_url }}</a></span>
|
||||
<strong class="stat-subvalue">noVNC 直连</strong>
|
||||
<span class="stat-label">待发送 / 未处理</span>
|
||||
<strong class="stat-value">{{ send_summary.today_pending_targets + send_summary.today_unprocessed_targets }}</strong>
|
||||
<div class="dashboard-kpi-subline">
|
||||
<span class="muted">{{ ops.daily_schedule or "未配置发送窗口" }}</span>
|
||||
</div>
|
||||
<div class="stat-icon blue">🖥</div>
|
||||
</div>
|
||||
<div class="stat-icon orange"><span class="dashboard-kpi-icon">◔</span></div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="dashboard-layout">
|
||||
<div class="dashboard-main">
|
||||
<section class="panel" id="interactive-login-section">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>交互式登录浏览器(推荐)</h2>
|
||||
<p class="muted compact">在网页里直接操作服务器浏览器完成扫码、短信验证和登录,不再依赖远程截图轮询。</p>
|
||||
<h2>交互式登录浏览器</h2>
|
||||
<p class="muted compact">直接在网页中操作远端浏览器完成扫码、验证码与创作者中心登录,登录完成后可一键保存当前账号。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-stepbar">
|
||||
<div class="step-item active"><span class="step-index">1</span><span>打开浏览器</span></div>
|
||||
<div class="step-item"><span class="step-index">1</span><span>打开浏览器</span></div>
|
||||
<div class="step-connector"></div>
|
||||
<div class="step-item active"><span class="step-index">2</span><span>扫码与验证</span></div>
|
||||
<div class="step-item"><span class="step-index">2</span><span>扫码与验证</span></div>
|
||||
<div class="step-connector"></div>
|
||||
<div class="step-item active"><span class="step-index">3</span><span>进入创作者中心</span></div>
|
||||
<div class="step-item"><span class="step-index">3</span><span>进入创作者中心</span></div>
|
||||
<div class="step-connector"></div>
|
||||
<div class="step-item active"><span class="step-index">4</span><span>保存登录账号</span></div>
|
||||
<div class="step-item"><span class="step-index">4</span><span>保存登录账号</span></div>
|
||||
</div>
|
||||
|
||||
<div class="login-grid">
|
||||
<div class="login-box warning">
|
||||
<div class="stack-form">
|
||||
<div class="action-stack">
|
||||
<div class="status-line">
|
||||
<span class="pill soft">方式:交互式远端浏览器</span>
|
||||
<span class="pill">端口:8788</span>
|
||||
</div>
|
||||
<div class="login-lead">
|
||||
通过 noVNC 直接在网页里操作服务器浏览器完成登录。
|
||||
<span class="pill soft">推荐模式</span>
|
||||
<span class="pill">noVNC :8788</span>
|
||||
</div>
|
||||
<div class="login-lead">通过 noVNC 打开远端浏览器,手动完成抖音登录,再把当前登录态同步回后台账号系统。</div>
|
||||
<ul class="feature-list">
|
||||
<li>在远端浏览器中直接扫码登录。</li>
|
||||
<li>短信验证码、验证按钮都由你直接操作。</li>
|
||||
<li>登录完成后点击“保存当前登录账号”同步到系统。</li>
|
||||
<li>支持扫码、验证码、短信验证等人工步骤</li>
|
||||
<li>登录成功后可直接保存到新账号或覆盖已有账号</li>
|
||||
<li>适合登录态失效、环境异常或批量修复前的人工接管</li>
|
||||
</ul>
|
||||
<div class="button-row">
|
||||
<button type="button" class="success-button login-desktop-open" data-relogin-unique-id="">打开交互式登录浏览器 ↗</button>
|
||||
<button type="button" class="ghost-button login-desktop-reset">重置登录桌面 ↻</button>
|
||||
<button type="button" class="ghost-button login-desktop-save" data-relogin-unique-id="">保存当前登录账号 ↗</button>
|
||||
<button type="button" class="soft-button login-desktop-save" data-relogin-unique-id="">保存当前登录账号</button>
|
||||
</div>
|
||||
<p class="muted compact">登录完成后,再点击“保存当前登录账号”,把当前浏览器中的账号写入后台。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-box">
|
||||
<div class="stack-form">
|
||||
<strong>交互式浏览器窗口(远端浏览器工作区)</strong>
|
||||
<strong>浏览器工作区</strong>
|
||||
<div class="url-field">
|
||||
<input id="desktop-public-url" type="text" value="{{ login_desktop_public_url }}" readonly>
|
||||
<button type="button" class="ghost-button url-copy" id="copy-public-url">⧉</button>
|
||||
@@ -109,30 +567,20 @@
|
||||
id="login-desktop-controls"
|
||||
data-public-url="{{ login_desktop_public_url }}"
|
||||
data-csrf-token="{{ csrf_token }}">
|
||||
<div class="status-line">
|
||||
<h3>交互式登录浏览器</h3>
|
||||
<span class="pill soft">推荐</span>
|
||||
<div class="section-title-row" style="margin-bottom: 10px;">
|
||||
<div>
|
||||
<h3>登录状态</h3>
|
||||
<p class="muted compact">持续轮询远端交互式桌面状态</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-list">
|
||||
<div class="status-item" id="desktop-status-checking">
|
||||
<span class="status-dot"></span>
|
||||
<span>检查中</span>
|
||||
</div>
|
||||
<div class="status-item pending" id="desktop-status-pending">
|
||||
<span class="status-dot"></span>
|
||||
<span>待登录</span>
|
||||
</div>
|
||||
<div class="status-item success" id="desktop-status-success">
|
||||
<span class="status-dot"></span>
|
||||
<span>已登录</span>
|
||||
</div>
|
||||
<div class="status-item error" id="desktop-status-error">
|
||||
<span class="status-dot"></span>
|
||||
<span>异常</span>
|
||||
</div>
|
||||
<div class="status-item" id="desktop-status-checking"><span class="status-dot"></span><span>检查中</span></div>
|
||||
<div class="status-item pending" id="desktop-status-pending"><span class="status-dot"></span><span>待登录</span></div>
|
||||
<div class="status-item success" id="desktop-status-success"><span class="status-dot"></span><span>已登录</span></div>
|
||||
<div class="status-item error" id="desktop-status-error"><span class="status-dot"></span><span>异常</span></div>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<div class="status-line" style="margin-bottom: 8px;">
|
||||
<div class="status-line" style="margin-bottom: 10px;">
|
||||
<span class="pill" id="login-desktop-runtime-state">检查中</span>
|
||||
</div>
|
||||
<div id="login-desktop-status-text">正在检查交互式登录桌面状态。</div>
|
||||
@@ -145,41 +593,43 @@
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>发送控制台摘要</h2>
|
||||
<p class="muted compact">展示今天的成功、失败、待发送与待补发状态。失败目标可在详情页单独重试。</p>
|
||||
<p class="muted compact">查看每个账号今天的发送状态分布,并快速进入发送控制台做批量补发或针对性重试。</p>
|
||||
</div>
|
||||
<a class="link-button" href="/ops/send-console">打开发送控制台</a>
|
||||
</div>
|
||||
<div class="stats-grid" style="grid-template-columns: repeat(4, minmax(0, 1fr));">
|
||||
|
||||
<div class="stats-grid">
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">启用账号</span>
|
||||
<strong class="stat-value">{{ ops.send_console.summary.enabled_accounts }}</strong>
|
||||
<strong class="stat-value">{{ send_summary.enabled_accounts }}</strong>
|
||||
</div>
|
||||
<div class="stat-icon blue">A</div>
|
||||
</article>
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">今日成功目标</span>
|
||||
<strong class="stat-value">{{ ops.send_console.summary.today_sent_targets }}</strong>
|
||||
<strong class="stat-value">{{ send_summary.today_sent_targets }}</strong>
|
||||
</div>
|
||||
<div class="stat-icon green">OK</div>
|
||||
<div class="stat-icon green">✓</div>
|
||||
</article>
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">失败待补发</span>
|
||||
<strong class="stat-value">{{ ops.send_console.summary.today_failed_targets }}</strong>
|
||||
<strong class="stat-value">{{ send_summary.today_failed_targets }}</strong>
|
||||
</div>
|
||||
<div class="stat-icon soft">!</div>
|
||||
<div class="stat-icon red">!</div>
|
||||
</article>
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">待发送 / 未处理</span>
|
||||
<strong class="stat-value">{{ ops.send_console.summary.today_pending_targets + ops.send_console.summary.today_unprocessed_targets }}</strong>
|
||||
<strong class="stat-value">{{ send_summary.today_pending_targets + send_summary.today_unprocessed_targets }}</strong>
|
||||
</div>
|
||||
<div class="stat-icon soft">...</div>
|
||||
<div class="stat-icon orange">…</div>
|
||||
</article>
|
||||
</div>
|
||||
<div class="table-shell" style="margin-top: 16px;">
|
||||
|
||||
<div class="table-shell summary-table" style="margin-top: 18px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -188,13 +638,16 @@
|
||||
<th>失败待补发</th>
|
||||
<th>待发送</th>
|
||||
<th>未处理</th>
|
||||
<th>最后失败原因</th>
|
||||
<th>最近失败原因</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in ops.send_console.accounts %}
|
||||
<tr>
|
||||
<td><strong>{{ row.username }}</strong><br><span class="muted">{{ row.unique_id }}</span></td>
|
||||
<td>
|
||||
<strong>{{ row.username }}</strong><br>
|
||||
<span>{{ row.unique_id }}</span>
|
||||
</td>
|
||||
<td>{{ row.sent_targets|length }}</td>
|
||||
<td>{{ row.failed_targets|length }}</td>
|
||||
<td>{{ row.pending_targets|length }}</td>
|
||||
@@ -202,7 +655,7 @@
|
||||
<td>{{ row.last_failure_reason or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6">暂无发送状态摘要。</td></tr>
|
||||
<tr><td colspan="6">当前没有发送摘要数据。</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -212,8 +665,8 @@
|
||||
<section class="panel" id="account-management">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>账号管理({{ accounts|length }})</h2>
|
||||
<p class="muted compact">多账号、目标好友、启停状态、交互式登录同步都在这里集中管理。</p>
|
||||
<h2>账号管理</h2>
|
||||
<p class="muted compact">集中管理账号开关、目标好友、好友缓存、登录同步和删除操作。布局与发送控制台保持同一套卡片系统。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -223,13 +676,13 @@
|
||||
<article class="account-card">
|
||||
<div class="account-head">
|
||||
<div class="account-ident">
|
||||
<div class="avatar-photo">{{ account.username[:1] if account.username else "账" }}</div>
|
||||
<div class="avatar-photo">{{ account.username[:1] if account.username else "A" }}</div>
|
||||
<div>
|
||||
<div class="account-name">{{ account.username }}</div>
|
||||
<div class="account-sub">unique_id: {{ account.unique_id }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="pill {% if account.enabled|default(true) %}soft{% else %}warning{% endif %}">
|
||||
<span class="status-chip {% if account.enabled|default(true) %}success{% else %}warning{% endif %}">
|
||||
{% if account.enabled|default(true) %}已启用{% else %}已停用{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
@@ -263,7 +716,7 @@
|
||||
<span>手动目标好友(每行一个)</span>
|
||||
<textarea name="targets" rows="5">{{ account.targets|default([], true)|join('\n') }}</textarea>
|
||||
</label>
|
||||
<p class="muted compact">好友太多刷不出来时,直接在这里填写目标昵称并保存。</p>
|
||||
<p class="muted compact">如果好友过多无法滚动读取,可直接在这里填写目标昵称并保存。</p>
|
||||
|
||||
<div class="friend-picker"
|
||||
data-account-id="{{ account.unique_id }}"
|
||||
@@ -284,7 +737,7 @@
|
||||
<button type="button" class="ghost-button friend-refresh-button">刷新好友列表</button>
|
||||
</div>
|
||||
|
||||
<label class="friend-search">
|
||||
<label class="stack-form" style="gap: 8px;">
|
||||
<span>搜索好友</span>
|
||||
<input type="search" class="friend-search-input" placeholder="输入昵称筛选好友">
|
||||
</label>
|
||||
@@ -323,14 +776,14 @@
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">还没有账号。先通过交互式登录浏览器登录并保存账号。</div>
|
||||
<div class="empty-state">当前没有账号。先通过交互式登录浏览器登录并保存账号。</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<div class="layout-grid" style="grid-template-columns: repeat(3, minmax(0, 1fr));">
|
||||
<div class="ops-card-grid">
|
||||
<section class="panel">
|
||||
<h2>容器状态</h2>
|
||||
<div class="table-shell">
|
||||
<div class="table-shell scrollable" style="margin-top: 16px;">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -343,11 +796,7 @@
|
||||
{% for row in ops.containers %}
|
||||
<tr>
|
||||
<td>{{ row.Names }}</td>
|
||||
<td>
|
||||
<span class="pill {% if 'Up' in row.Status %}soft{% else %}warning{% endif %}">
|
||||
{{ row.Status }}
|
||||
</span>
|
||||
</td>
|
||||
<td><span class="pill {% if 'Up' in row.Status %}soft{% else %}warning{% endif %}">{{ row.Status }}</span></td>
|
||||
<td>{{ row.Image }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
@@ -359,21 +808,26 @@
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>Cron / 调度(服务端 crontab)</h2>
|
||||
<pre class="code-block">{{ ops.crontab or "当前没有 crontab 任务。" }}</pre>
|
||||
<h2>Cron / 调度</h2>
|
||||
<pre class="code-block" style="margin-top: 16px;">{{ ops.crontab or "当前没有 crontab 任务。" }}</pre>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>日志预览(最近 100 行)</h2>
|
||||
<pre class="code-block light tall">{{ ops.log_tail or "暂无日志" }}</pre>
|
||||
<h2>日志预览</h2>
|
||||
<pre class="code-block light" style="margin-top: 16px; min-height: 260px;">{{ ops.log_tail or "暂无日志" }}</pre>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="stack">
|
||||
<aside class="dashboard-side">
|
||||
<section class="panel" id="config-panel">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>运行配置</h2>
|
||||
<form method="post" action="/config" class="stack-form" style="margin-top: 14px;">
|
||||
<p class="muted compact">消息模板、随机策略、时间间隔等核心发送参数。</p>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="/config" class="stack-form">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>
|
||||
<span>固定消息模板</span>
|
||||
@@ -392,11 +846,11 @@
|
||||
</label>
|
||||
<div class="settings-grid">
|
||||
<label>
|
||||
<span>两条消息随机间隔(最小)</span>
|
||||
<span>消息最小间隔(秒)</span>
|
||||
<input type="number" name="messageIntervalSecondsMin" min="0" value="{{ runtime_config.sendStrategy.messageIntervalSecondsMin }}">
|
||||
</label>
|
||||
<label>
|
||||
<span>两条消息随机间隔(最大)</span>
|
||||
<span>消息最大间隔(秒)</span>
|
||||
<input type="number" name="messageIntervalSecondsMax" min="0" value="{{ runtime_config.sendStrategy.messageIntervalSecondsMax }}">
|
||||
</label>
|
||||
</div>
|
||||
@@ -405,11 +859,16 @@
|
||||
</section>
|
||||
|
||||
<section class="panel" id="ops-panel">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>运维操作</h2>
|
||||
<div class="button-grid" style="margin-top: 14px;">
|
||||
<p class="muted compact">立即补发、刷新代理、查看日志和调整自动发送窗口。</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="button-grid">
|
||||
<form method="post" action="/ops/run-now">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">立刻运行一次</button>
|
||||
<button type="submit">补发全部对象</button>
|
||||
</form>
|
||||
<form method="post" action="/ops/proxy/refresh">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
@@ -422,7 +881,7 @@
|
||||
<a class="link-button" href="/ops/logs">查看详细日志</a>
|
||||
</div>
|
||||
|
||||
<form method="post" action="/ops/schedule" class="stack-form" style="margin-top: 16px;">
|
||||
<form method="post" action="/ops/schedule" class="stack-form" style="margin-top: 18px;">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<label>
|
||||
<span>发送窗口(北京时间,例如 10:00-18:00/10m)</span>
|
||||
@@ -431,7 +890,7 @@
|
||||
<button type="submit" class="ghost-button">更新发送窗口</button>
|
||||
</form>
|
||||
|
||||
<div class="stack-form" style="margin-top: 16px;">
|
||||
<div class="stack-form" style="margin-top: 18px;">
|
||||
<label>
|
||||
<span>Compose 根目录</span>
|
||||
<input type="text" value="{{ ops.compose_root }}" readonly>
|
||||
@@ -442,14 +901,12 @@
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<section class="panel" id="settings-panel" style="margin-top: 20px;">
|
||||
<div class="panel-header">
|
||||
<section class="panel" id="settings-panel">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>面板与服务器设置</h2>
|
||||
<p class="muted compact">服务器参数、交互式登录桌面 API 地址、日志路径等基础设置。</p>
|
||||
<h2>面板与服务设置</h2>
|
||||
<p class="muted compact">服务连接、日志路径、交互式登录 API 与管理员配置。</p>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="/settings" class="stack-form">
|
||||
@@ -501,23 +958,26 @@
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
(() => {
|
||||
const runNowForm = document.querySelector('form[action="/ops/run-now"]');
|
||||
if (!runNowForm) return;
|
||||
const button = runNowForm.querySelector('button[type="submit"]');
|
||||
if (button) {
|
||||
button.textContent = "补发全部失败项";
|
||||
}
|
||||
if (!runNowForm.nextElementSibling || !runNowForm.nextElementSibling.classList.contains("failed-only-note")) {
|
||||
const runNowForms = document.querySelectorAll('form[action="/ops/run-now"]');
|
||||
if (!runNowForms.length) return;
|
||||
runNowForms.forEach((form) => {
|
||||
const button = form.querySelector('button[type="submit"]');
|
||||
if (button) button.textContent = "补发全部对象";
|
||||
if (!form.nextElementSibling || !form.nextElementSibling.classList.contains("resend-note")) {
|
||||
const note = document.createElement("p");
|
||||
note.className = "muted compact failed-only-note";
|
||||
note.textContent = "“补发全部失败项”只处理今天 failure_queue 中的目标,不会全量重发全部账号。";
|
||||
runNowForm.insertAdjacentElement("afterend", note);
|
||||
note.className = "muted compact resend-note";
|
||||
note.textContent = "“补发全部对象”会对所有启用账号的全部目标重新发送一遍,并按最终成功 / 失败结果更新控制台摘要。";
|
||||
form.insertAdjacentElement("afterend", note);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
(() => {
|
||||
@@ -542,7 +1002,7 @@
|
||||
const setVisualStatus = (state) => {
|
||||
Object.values(statusMap).forEach((node) => {
|
||||
if (!node) return;
|
||||
node.style.opacity = "0.45";
|
||||
node.style.opacity = "0.42";
|
||||
});
|
||||
if (statusMap[state]) {
|
||||
statusMap[state].style.opacity = "1";
|
||||
@@ -576,7 +1036,7 @@
|
||||
const openDesktopWindow = () => {
|
||||
const popup = window.open(publicUrl, "_blank");
|
||||
if (!popup) {
|
||||
setStatus("浏览器拦截了交互式登录窗口,请允许弹窗后再试。", "danger", "error");
|
||||
setStatus("浏览器阻止了交互式登录窗口,请允许弹窗后再试。", "danger", "error");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -595,7 +1055,7 @@
|
||||
if (data.logged_in) {
|
||||
setStatus(`当前浏览器已登录:${data.username}(${data.unique_id})`, "soft", "success");
|
||||
} else {
|
||||
setStatus("正在检查交互式登录桌面状态。当前浏览器未登录,打开浏览器开始登录。", "", "pending");
|
||||
setStatus("当前浏览器尚未登录,可打开交互式登录浏览器开始人工登录。", "", "pending");
|
||||
}
|
||||
} catch (error) {
|
||||
if (runtimeStateEl) runtimeStateEl.textContent = "异常";
|
||||
@@ -658,7 +1118,7 @@
|
||||
button.addEventListener("click", async () => {
|
||||
try {
|
||||
await postForm("/login-desktop/reset");
|
||||
setStatus("交互式登录桌面已重置,正在重新初始化浏览器…", "warning", "checking");
|
||||
setStatus("交互式登录桌面已重置,正在重新初始化浏览器。", "warning", "checking");
|
||||
await pollStatus();
|
||||
} catch (error) {
|
||||
setStatus(`重置交互式登录桌面失败:${error.message}`, "danger", "error");
|
||||
@@ -736,11 +1196,12 @@
|
||||
|
||||
const renderList = () => {
|
||||
const query = (searchInput.value || "").trim().toLowerCase();
|
||||
const displayNames = combinedFriends().filter((name) => name.toLowerCase().includes(query));
|
||||
const allNames = combinedFriends();
|
||||
const displayNames = allNames.filter((name) => name.toLowerCase().includes(query));
|
||||
renderHiddenInputs();
|
||||
updateSummary();
|
||||
|
||||
if (!combinedFriends().length) {
|
||||
if (!allNames.length) {
|
||||
listEl.innerHTML = '<div class="friend-picker-empty">点击“刷新好友列表”后再勾选目标好友。</div>';
|
||||
return;
|
||||
}
|
||||
@@ -750,16 +1211,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
listEl.innerHTML = displayNames
|
||||
.map(
|
||||
(name) => `
|
||||
listEl.innerHTML = displayNames.map((name) => `
|
||||
<label class="friend-option ${selected.has(name) ? "selected" : ""}">
|
||||
<span>${escapeHtml(name)}</span>
|
||||
<input type="checkbox" value="${escapeHtml(name)}" ${selected.has(name) ? "checked" : ""}>
|
||||
</label>
|
||||
`
|
||||
)
|
||||
.join("");
|
||||
`).join("");
|
||||
|
||||
listEl.querySelectorAll('input[type="checkbox"]').forEach((checkbox) => {
|
||||
checkbox.addEventListener("change", () => {
|
||||
|
||||
@@ -1,77 +1,397 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block nav_key %}send_console{% endblock %}
|
||||
{% block title %}发送控制台{% endblock %}
|
||||
{% block page_title %}发送控制台{% endblock %}
|
||||
{% block page_subtitle %}今日发送总览{% endblock %}
|
||||
|
||||
{% block topbar_actions %}
|
||||
<a class="ghost-button" href="/">⌂ 返回首页</a>
|
||||
<form method="post" action="/ops/run-now">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">✈ 补发全部对象</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% set send_console = ops.send_console %}
|
||||
<div class="stack">
|
||||
<section class="panel">
|
||||
<div class="section-title-row">
|
||||
<div>
|
||||
<h2>今日发送总览</h2>
|
||||
<p class="muted compact">当前时间:{{ send_console.now }}。本页按账号展示今天已成功、失败待补发、待发送和未处理目标。</p>
|
||||
</div>
|
||||
<div class="button-row two" style="width: 320px;">
|
||||
<a class="ghost-button" href="/">返回首页</a>
|
||||
<form method="post" action="/ops/run-now">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<button type="submit">补发全部失败项</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.console-shell {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
<div class="stats-grid">
|
||||
.console-overview {
|
||||
display: grid;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.console-stats .stat-card {
|
||||
min-height: 132px;
|
||||
}
|
||||
|
||||
.console-kpi-icon {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.console-account-list {
|
||||
display: grid;
|
||||
gap: 22px;
|
||||
}
|
||||
|
||||
.account-panel {
|
||||
padding: 20px 20px 22px;
|
||||
}
|
||||
|
||||
.account-panel__header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 18px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.account-panel__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.account-avatar {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(180deg, #7ea9ff, #5888ff);
|
||||
color: #fff;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 800;
|
||||
box-shadow: 0 10px 18px rgba(47, 103, 255, 0.22);
|
||||
}
|
||||
|
||||
.account-panel__name {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.account-panel__subline {
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--text-soft);
|
||||
font-size: 13px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.account-panel__subline code {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
color: #7486a4;
|
||||
background: #f5f8fd;
|
||||
padding: 2px 6px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.account-panel__status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.account-panel__collapse {
|
||||
color: #98a8c4;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.account-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.data-card {
|
||||
border: 1px solid rgba(228, 236, 246, 0.96);
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(180deg, #ffffff, #fdfdff);
|
||||
box-shadow: var(--shadow-soft);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.data-card__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 16px 18px 12px;
|
||||
}
|
||||
|
||||
.data-card__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.data-card__title i {
|
||||
font-style: normal;
|
||||
display: inline-flex;
|
||||
width: 18px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.data-card__title.success {
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.data-card__title.danger {
|
||||
color: var(--danger);
|
||||
}
|
||||
|
||||
.data-card__title.warning {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.data-card__title.info {
|
||||
color: var(--info);
|
||||
}
|
||||
|
||||
.data-card__table {
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.data-card__table td:first-child,
|
||||
.data-card__table th:first-child {
|
||||
min-width: 176px;
|
||||
}
|
||||
|
||||
.data-card__table td:last-child,
|
||||
.data-card__table th:last-child {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.data-card__footer {
|
||||
padding: 10px 18px 14px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
font-size: 13px;
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.data-card__footer-button {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--primary);
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
border-radius: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.data-card__footer-button:hover {
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.data-card__footer-button[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.data-card__extra {
|
||||
display: none;
|
||||
padding: 0 18px 16px;
|
||||
}
|
||||
|
||||
.data-card__extra.is-open {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.data-card__extra .table-shell {
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.retry-button {
|
||||
padding: 8px 12px;
|
||||
border-radius: 10px;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.console-empty {
|
||||
padding: 46px 24px;
|
||||
text-align: center;
|
||||
color: var(--text-soft);
|
||||
border-radius: 18px;
|
||||
border: 1px dashed var(--border-strong);
|
||||
background: rgba(255, 255, 255, 0.74);
|
||||
}
|
||||
|
||||
.console-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 18px;
|
||||
padding: 6px 0 0;
|
||||
color: var(--text-soft);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.console-pagination {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.console-page {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--border);
|
||||
background: #fff;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--text-soft);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.console-page.active {
|
||||
background: linear-gradient(180deg, #3d79ff, #2f67ff);
|
||||
color: #fff;
|
||||
border-color: transparent;
|
||||
box-shadow: 0 10px 18px rgba(47, 103, 255, 0.18);
|
||||
}
|
||||
|
||||
.console-page.ghost {
|
||||
width: auto;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 1380px) {
|
||||
.account-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="console-shell">
|
||||
<section class="console-overview">
|
||||
<div class="overview-time">当前时间:{{ send_console.now|replace('T', ' ') }}</div>
|
||||
|
||||
<div class="stats-grid console-stats">
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">启用账号</span>
|
||||
<strong class="stat-value">{{ send_console.summary.enabled_accounts }}</strong>
|
||||
<span class="stat-help">实时统计 · 当前可发送账号</span>
|
||||
</div>
|
||||
<div class="stat-icon blue">A</div>
|
||||
<div class="stat-icon blue"><span class="console-kpi-icon">👥</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">今日成功目标</span>
|
||||
<strong class="stat-value">{{ send_console.summary.today_sent_targets }}</strong>
|
||||
<span class="stat-help positive">发送成功后立即写回历史</span>
|
||||
</div>
|
||||
<div class="stat-icon green">OK</div>
|
||||
<div class="stat-icon green"><span class="console-kpi-icon">🎯</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">失败待补发</span>
|
||||
<strong class="stat-value">{{ send_console.summary.today_failed_targets }}</strong>
|
||||
<span class="stat-help negative">按失败分类进入补发与重试</span>
|
||||
</div>
|
||||
<div class="stat-icon soft">!</div>
|
||||
<div class="stat-icon red"><span class="console-kpi-icon">⚠</span></div>
|
||||
</article>
|
||||
|
||||
<article class="stat-card">
|
||||
<div class="stat-meta">
|
||||
<span class="stat-label">待发送 / 未处理</span>
|
||||
<strong class="stat-value">{{ send_console.summary.today_pending_targets + send_console.summary.today_unprocessed_targets }}</strong>
|
||||
<span class="stat-help">窗口内按计划发送,窗口外展示剩余目标</span>
|
||||
</div>
|
||||
<div class="stat-icon soft">...</div>
|
||||
<div class="stat-icon orange"><span class="console-kpi-icon">◔</span></div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% if send_console.accounts %}
|
||||
<section class="console-account-list">
|
||||
{% for account in send_console.accounts %}
|
||||
<section class="panel">
|
||||
<div class="section-title-row">
|
||||
<article class="panel account-panel">
|
||||
<div class="account-panel__header">
|
||||
<div class="account-panel__meta">
|
||||
<div class="account-avatar">{{ (account.username or 'A')[:1] }}</div>
|
||||
<div>
|
||||
<h2>{{ account.username }}</h2>
|
||||
<p class="muted compact">unique_id: {{ account.unique_id }}</p>
|
||||
<div class="account-panel__name">{{ account.username }}</div>
|
||||
<div class="account-panel__subline">
|
||||
<span>unique_id:</span>
|
||||
<code>{{ account.unique_id }}</code>
|
||||
</div>
|
||||
<div class="status-line">
|
||||
<span class="pill soft">成功 {{ account.sent_targets|length }}</span>
|
||||
<span class="pill {% if account.failed_targets %}danger{% else %}soft{% endif %}">失败 {{ account.failed_targets|length }}</span>
|
||||
<span class="pill">待发送 {{ account.pending_targets|length }}</span>
|
||||
<span class="pill warning">未处理 {{ account.unprocessed_targets|length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layout-grid" style="grid-template-columns: repeat(2, minmax(0, 1fr));">
|
||||
<section class="panel" style="box-shadow:none; margin:0; padding:14px;">
|
||||
<h3>今日已成功</h3>
|
||||
<div class="table-shell" style="margin-top: 12px;">
|
||||
<div class="account-panel__status">
|
||||
<span class="status-chip success">成功 {{ account.sent_targets|length }}</span>
|
||||
<span class="status-chip danger">失败 {{ account.failed_targets|length }}</span>
|
||||
<span class="status-chip warning">待发送 {{ account.pending_targets|length }}</span>
|
||||
<span class="status-chip info">未处理 {{ account.unprocessed_targets|length }}</span>
|
||||
<span class="account-panel__collapse">⌃</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="account-grid">
|
||||
<section class="data-card">
|
||||
<div class="data-card__head">
|
||||
<div class="data-card__title success"><i>●</i><span>A. 今日已成功</span></div>
|
||||
</div>
|
||||
<div class="table-shell data-card__table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>目标</th>
|
||||
<th>消息</th>
|
||||
<th>sentAt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in account.sent_targets[:5] %}
|
||||
<tr>
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.message or "-" }}</td>
|
||||
<td>{{ item.sentAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="3">今日暂无成功目标</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="data-card__footer">
|
||||
<button
|
||||
type="button"
|
||||
class="data-card__footer-button"
|
||||
data-expand-target="sent-{{ loop.index0 }}"
|
||||
data-total-label="查看全部({{ account.sent_targets|length }})"
|
||||
{% if account.sent_targets|length <= 5 %}hidden{% endif %}
|
||||
>查看全部({{ account.sent_targets|length }})</button>
|
||||
</div>
|
||||
<div class="data-card__extra" id="sent-{{ loop.index0 }}">
|
||||
<div class="table-shell scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -87,17 +407,60 @@
|
||||
<td>{{ item.message or "-" }}</td>
|
||||
<td>{{ item.sentAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="3">暂无今日成功目标。</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel" style="box-shadow:none; margin:0; padding:14px;">
|
||||
<h3>失败待补发</h3>
|
||||
<div class="table-shell" style="margin-top: 12px;">
|
||||
<section class="data-card">
|
||||
<div class="data-card__head">
|
||||
<div class="data-card__title danger"><i>▲</i><span>B. 失败待补发</span></div>
|
||||
</div>
|
||||
<div class="table-shell data-card__table scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>目标</th>
|
||||
<th>失败分类</th>
|
||||
<th>失败原因</th>
|
||||
<th>次数</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in account.failed_targets[:5] %}
|
||||
<tr>
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.category or "-" }}</td>
|
||||
<td>{{ item.reason or "-" }}</td>
|
||||
<td>{{ item.attemptCount or 0 }}</td>
|
||||
<td>
|
||||
<form method="post" action="/accounts/{{ account.unique_id }}/retry-target">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="target" value="{{ item.target }}">
|
||||
<button type="submit" class="soft-button retry-button">重试此目标</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="5">暂无失败待补发目标</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="data-card__footer">
|
||||
<button
|
||||
type="button"
|
||||
class="data-card__footer-button"
|
||||
data-expand-target="failed-{{ loop.index0 }}"
|
||||
data-total-label="查看全部({{ account.failed_targets|length }})"
|
||||
{% if account.failed_targets|length <= 5 %}hidden{% endif %}
|
||||
>查看全部({{ account.failed_targets|length }})</button>
|
||||
</div>
|
||||
<div class="data-card__extra" id="failed-{{ loop.index0 }}">
|
||||
<div class="table-shell scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -119,21 +482,52 @@
|
||||
<form method="post" action="/accounts/{{ account.unique_id }}/retry-target">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
||||
<input type="hidden" name="target" value="{{ item.target }}">
|
||||
<button type="submit" class="ghost-button">重试此目标</button>
|
||||
<button type="submit" class="soft-button retry-button">重试此目标</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="5">暂无失败待补发目标。</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel" style="box-shadow:none; margin:0; padding:14px;">
|
||||
<h3>今日待发送</h3>
|
||||
<div class="table-shell" style="margin-top: 12px;">
|
||||
<section class="data-card">
|
||||
<div class="data-card__head">
|
||||
<div class="data-card__title warning"><i>◔</i><span>C. 今日待发送</span></div>
|
||||
</div>
|
||||
<div class="table-shell data-card__table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>目标</th>
|
||||
<th>scheduledAt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in account.pending_targets[:5] %}
|
||||
<tr>
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.scheduledAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="2">今日暂无待发送目标</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="data-card__footer">
|
||||
<button
|
||||
type="button"
|
||||
class="data-card__footer-button"
|
||||
data-expand-target="pending-{{ loop.index0 }}"
|
||||
data-total-label="查看全部({{ account.pending_targets|length }})"
|
||||
{% if account.pending_targets|length <= 5 %}hidden{% endif %}
|
||||
>查看全部({{ account.pending_targets|length }})</button>
|
||||
</div>
|
||||
<div class="data-card__extra" id="pending-{{ loop.index0 }}">
|
||||
<div class="table-shell scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -147,17 +541,48 @@
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.scheduledAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="2">暂无今日待发送目标。</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel" style="box-shadow:none; margin:0; padding:14px;">
|
||||
<h3>今日未处理</h3>
|
||||
<div class="table-shell" style="margin-top: 12px;">
|
||||
<section class="data-card">
|
||||
<div class="data-card__head">
|
||||
<div class="data-card__title info"><i>◌</i><span>D. 今日未处理</span></div>
|
||||
</div>
|
||||
<div class="table-shell data-card__table">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>目标</th>
|
||||
<th>scheduledAt</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for item in account.unprocessed_targets[:5] %}
|
||||
<tr>
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.scheduledAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="2">今日暂无未处理目标</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="data-card__footer">
|
||||
<button
|
||||
type="button"
|
||||
class="data-card__footer-button"
|
||||
data-expand-target="unprocessed-{{ loop.index0 }}"
|
||||
data-total-label="查看全部({{ account.unprocessed_targets|length }})"
|
||||
{% if account.unprocessed_targets|length <= 5 %}hidden{% endif %}
|
||||
>查看全部({{ account.unprocessed_targets|length }})</button>
|
||||
</div>
|
||||
<div class="data-card__extra" id="unprocessed-{{ loop.index0 }}">
|
||||
<div class="table-shell scrollable">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -171,15 +596,43 @@
|
||||
<td>{{ item.target }}</td>
|
||||
<td>{{ item.scheduledAt or "-" }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="2">暂无未处理目标。</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
||||
<div class="console-footer">
|
||||
<span>共 {{ send_console.accounts|length }} 个账号</span>
|
||||
<div class="console-pagination">
|
||||
<span class="console-page ghost">‹</span>
|
||||
<span class="console-page active">1</span>
|
||||
<span class="console-page">2</span>
|
||||
<span class="console-page">3</span>
|
||||
<span class="console-page ghost">›</span>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="console-empty">当前没有启用账号,暂无可展示的发送控制台数据。</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
(() => {
|
||||
document.querySelectorAll(".data-card__footer-button").forEach((button) => {
|
||||
button.addEventListener("click", () => {
|
||||
const targetId = button.dataset.expandTarget;
|
||||
if (!targetId) return;
|
||||
const panel = document.getElementById(targetId);
|
||||
if (!panel) return;
|
||||
const isOpen = panel.classList.toggle("is-open");
|
||||
button.textContent = isOpen ? "收起" : (button.getAttribute("data-total-label") || "查看全部");
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user