Files
weibo_signin/frontend/templates/account_detail.html

172 lines
7.7 KiB
HTML
Raw Normal View History

2026-03-09 16:10:29 +08:00
{% extends "base.html" %}
{% block title %}Account Detail - Weibo-HotSign{% endblock %}
{% block content %}
<div style="max-width: 1000px; margin: 0 auto;">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
<h1>{{ account.weibo_user_id }}</h1>
<div style="display: flex; gap: 10px;">
<a href="{{ url_for('edit_account', account_id=account.id) }}" class="btn btn-secondary">Edit</a>
<form method="POST" action="{{ url_for('delete_account', account_id=account.id) }}" style="display: inline;" onsubmit="return confirm('Are you sure?');">
<button type="submit" class="btn btn-danger">Delete</button>
</form>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px;">
<div class="card">
<div class="card-header">Account Info</div>
<table>
<tr>
<td style="font-weight: 500; width: 30%;">Status</td>
<td>
{% if account.status == 'active' %}
<span class="badge badge-success">Active</span>
{% elif account.status == 'pending' %}
<span class="badge badge-warning">Pending</span>
{% elif account.status == 'invalid_cookie' %}
<span class="badge badge-danger">Invalid Cookie</span>
{% elif account.status == 'banned' %}
<span class="badge badge-danger">Banned</span>
{% endif %}
</td>
</tr>
<tr>
<td style="font-weight: 500;">Remark</td>
<td>{{ account.remark or '-' }}</td>
</tr>
<tr>
<td style="font-weight: 500;">Created</td>
<td>{{ account.created_at[:10] }}</td>
</tr>
<tr>
<td style="font-weight: 500;">Last Checked</td>
<td>{{ account.last_checked_at[:10] if account.last_checked_at else '-' }}</td>
</tr>
</table>
</div>
<div class="card">
<div class="card-header">Quick Actions</div>
<div style="display: flex; flex-direction: column; gap: 10px;">
<a href="{{ url_for('add_task', account_id=account.id) }}" class="btn btn-primary" style="text-align: center;">+ Add Task</a>
<a href="{{ url_for('edit_account', account_id=account.id) }}" class="btn btn-secondary" style="text-align: center;">Update Cookie</a>
</div>
</div>
</div>
<div class="card">
<div class="card-header">Tasks</div>
{% if tasks %}
<table>
<thead>
<tr>
<th>Cron Expression</th>
<th>Status</th>
<th>Created</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td>{{ task.cron_expression }}</td>
<td>
{% if task.is_enabled %}
<span class="badge badge-success">Enabled</span>
{% else %}
<span class="badge badge-warning">Disabled</span>
{% endif %}
</td>
<td>{{ task.created_at[:10] }}</td>
<td>
<form method="POST" action="{{ url_for('toggle_task', task_id=task.id) }}" style="display: inline;">
<input type="hidden" name="account_id" value="{{ account.id }}">
<input type="hidden" name="is_enabled" value="{{ task.is_enabled|lower }}">
<button type="submit" class="btn btn-secondary" style="padding: 6px 12px; font-size: 12px;">
{% if task.is_enabled %}Disable{% else %}Enable{% endif %}
</button>
</form>
<form method="POST" action="{{ url_for('delete_task', task_id=task.id) }}" style="display: inline;" onsubmit="return confirm('Are you sure?');">
<input type="hidden" name="account_id" value="{{ account.id }}">
<button type="submit" class="btn btn-danger" style="padding: 6px 12px; font-size: 12px;">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p style="color: #999; text-align: center; padding: 20px;">No tasks yet</p>
{% endif %}
</div>
<div class="card">
<div class="card-header">Signin Logs</div>
{% if logs.items %}
<table>
<thead>
<tr>
<th>Topic</th>
<th>Status</th>
<th>Reward</th>
<th>Time</th>
</tr>
</thead>
<tbody>
{% for log in logs.items %}
<tr>
<td>{{ log.topic_title or '-' }}</td>
<td>
{% if log.status == 'success' %}
<span class="badge badge-success">Success</span>
{% elif log.status == 'failed_already_signed' %}
<span class="badge badge-info">Already Signed</span>
{% elif log.status == 'failed_network' %}
<span class="badge badge-warning">Network Error</span>
{% elif log.status == 'failed_banned' %}
<span class="badge badge-danger">Banned</span>
{% endif %}
</td>
<td>
{% if log.reward_info %}
{{ log.reward_info.get('points', '-') }} pts
{% else %}
-
{% endif %}
</td>
<td>{{ log.signed_at[:10] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if logs.total > logs.size %}
<div class="pagination">
{% if logs.page > 1 %}
<a href="?page=1">First</a>
<a href="?page={{ logs.page - 1 }}">Previous</a>
{% endif %}
{% for p in range(max(1, logs.page - 2), min(logs.total // logs.size + 2, logs.page + 3)) %}
{% if p == logs.page %}
<span class="active">{{ p }}</span>
{% else %}
<a href="?page={{ p }}">{{ p }}</a>
{% endif %}
{% endfor %}
{% if logs.page < logs.total // logs.size + 1 %}
<a href="?page={{ logs.page + 1 }}">Next</a>
<a href="?page={{ logs.total // logs.size + 1 }}">Last</a>
{% endif %}
</div>
{% endif %}
{% else %}
<p style="color: #999; text-align: center; padding: 20px;">No signin logs yet</p>
{% endif %}
</div>
</div>
{% endblock %}