{% extends "admin_layout.html" %} {% block active_nav %}cards{% endblock %} {% block title %}卡密管理 · 管理后台{% endblock %} {% block content %}

🔑 卡密管理

{# 1110 免费试用:开关 + 天数 + 已试用统计(默认关闭=前台不显示,存量零影响) #}

🎁 免费试用

未开通会员的机器/账号可在「设置 → 卡密购买激活」免费试用 {{ trial_cfg.days }} 天, 每台机器/账号3 个月可领取一次(服务器台账记录,重装/删数据不能重置)。试用不消耗卡密,到期后引导购买/激活。

关闭后前台立即不显示试用入口;已领取的试用不受影响。

已试用:{{ trial_count }} 台/个(台账保留 3 个月,超期自动清理可重领)。

生成卡密

每张卡密对应「有效天数」;用户激活后,有效期 = 当前有效期(未到期)向后顺延该天数。

快捷:

{% if generated %}
本次生成 {{ generated | length }} 张(每张 {{ generated[0].duration_days }} 天)

复制后可直接分发;卡密一经复制请妥善保管,泄露即可能被抢先激活。

{% endif %}

卡密列表(共 {{ total }} 张)

{% if status != 'active' or q or batch or remark %}清空筛选{% endif %}
已选 0 张
{% if rows %}
{% for c in rows %} {% endfor %}
卡密来源购买者购买时间激活时间时长状态创建时间 绑定账号绑定设备到期时间操作
{{ c.code }} {% if c.batch == '线上购买' %}🛒 线上购买 {% else %}-{% endif %} {{ c.buyer_display or '-' }} {{ (c.paid_at or '').replace('T', ' ') or '-' }} {{ (c.activated_at or '').replace('T', ' ') or '-' }} {{ c.duration_days }} 天 {% if c.expired %}已过期 {% elif c.status == 'unused' %}未使用 {% elif c.status == 'used' %} {% if c.bound_account or c.bound_machine %}已绑定 {% else %}已使用未绑定{% endif %} {% else %}已禁用{% endif %} {{ (c.created_at or '')[:10] or '-' }} {{ c.bound_account or '-' }} {{ c.bound_machine or '-' }} {{ (c.expires_at or '')[:10] or '-' }} {% if c.status == 'unused' %}
{% elif c.status == 'disabled' %}
{% elif c.status == 'used' and (c.bound_account or c.bound_machine) %} {% if c.bound_account %}
{% endif %} {% if c.bound_machine %}
{% endif %}
{% endif %}
{% if total_pages > 1 %} {% endif %} {% else %}

没有符合条件的卡密。

{% endif %}
{# 1111 试用名单弹窗(自带样式,不依赖全局 modal 组件;只能 ✕ 关闭,不做点遮罩关闭) #}

🎁 试用名单(共 {{ trial_entries | length }} 条)

当天试用 {{ trial_stats.today }} 近 7 天 {{ trial_stats.d7 }} 近 30 天 {{ trial_stats.d30 }}
{% if trial_entries %}
{% for e in trial_entries %} {% endfor %}
用户 / 机器渠道天数领取时间到期状态
{% if e.username %}{{ e.username }}{% else %}{{ e.machine or '(未记录机器名)' }}{% endif %} {% if not e.username %}
{{ e.uid }}{% if e.machine_id %} · {{ e.machine_id[:12] }}{% endif %}
{% endif %}
{{ e.source }} {{ e.days }} {{ e.started_at[:16] }} {{ e.expires_at }} {{ e.status }}
{% else %}

暂无试用记录。

{% endif %}
{% endblock %}