优化(斗鱼预售台账): 统一命名并同步客户主页图
同步履约客户游戏主页截图,兼容 order_site 绝对 URL 与 objectKey;统一预售台账用户可见文案和保护标签;移除 CK 检测与重登前端页面入口。
This commit is contained in:
@@ -14,6 +14,7 @@ order_site 斗鱼领取页
|
||||
customerProfileUpdatedAt
|
||||
→ live-hub sync_order_snapshot 落平台履约任务
|
||||
→ 直播账号履约工作台「用户资料(order_site)」展示并比对
|
||||
→ 同步到斗鱼预售台账时,客户主页截图随单投影
|
||||
```
|
||||
|
||||
## order_site
|
||||
@@ -48,3 +49,5 @@ order_site 斗鱼领取页
|
||||
- order_site 当前必填 1 张;live-hub 接收接口兼容最多 5 张;
|
||||
- 截图只用于核对绑定,不进入斗鱼账号 CK;
|
||||
- 客户资料更新通过 outbox 快照同步,不靠客服手动转发图片。
|
||||
- 直播履约任务同步到斗鱼预售台账时,优先保存 order_site 的绝对截图 URL;
|
||||
旧数据没有 URL 时才回退 objectKey。
|
||||
|
||||
@@ -119,6 +119,7 @@ def test_protection_membership_uses_active_fulfillment_relationships(db):
|
||||
assert snapshot.group_account_ids["collab_bound"] == frozenset(
|
||||
{shared.id, collab_only.id}
|
||||
)
|
||||
assert snapshot.groups["collab_bound"]["label"] == "预售台账绑定账号"
|
||||
assert snapshot.monitored_ids == frozenset(
|
||||
{shared.id, presale_only.id, collab_only.id}
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ from tests.support.db import make_test_session
|
||||
from web.backend.models import FileAsset
|
||||
from web.backend.services.file_service import (
|
||||
FileUploadError,
|
||||
build_file_url,
|
||||
build_object_key,
|
||||
generate_image_variants,
|
||||
get_stored_object,
|
||||
@@ -105,6 +106,15 @@ class TestContentTypeAndScene:
|
||||
assert re.fullmatch(r"collab/\d{4}/\d{2}/\d{2}/[0-9a-f]{24}\.png", key)
|
||||
assert build_object_key("collab", "image/png", "a.png") != key
|
||||
|
||||
def test_file_url_keeps_external_customer_image_url(self):
|
||||
url = "https://order-site.example/files/home.png"
|
||||
|
||||
assert build_file_url(url) == url
|
||||
assert build_file_url(url, "thumb") == url
|
||||
assert build_file_url("collab/2026/11/26/home.png") == (
|
||||
"/api/files/object?key=collab%2F2026%2F11%2F26%2Fhome.png"
|
||||
)
|
||||
|
||||
|
||||
class TestImageVariants:
|
||||
def test_png_source_keeps_alpha_and_outputs_webp(self):
|
||||
|
||||
@@ -136,7 +136,7 @@ def test_run_lease_ck_refresh_calls_login_for_selected_accounts(db, monkeypatch)
|
||||
|
||||
|
||||
def test_select_due_lease_accounts_also_covers_presale_and_collab_protection(db):
|
||||
"""P1 到期前刷新不仅看生效租约,也覆盖预售与协作单绑定的履约保护账号。"""
|
||||
"""P1 到期前刷新不仅看生效租约,也覆盖预售与预售台账绑定的履约保护账号。"""
|
||||
from web.backend.models import DouyuExternalOrder, PlatformFulfillmentTask
|
||||
|
||||
now = datetime.now(UTC).replace(microsecond=0)
|
||||
|
||||
@@ -682,6 +682,7 @@ class TestFulfillmentCollabSync(_Base):
|
||||
|
||||
def test_manual_sync_creates_projected_collab_order(self):
|
||||
task = self._task_with_account()
|
||||
self.complete_customer_profile(task)
|
||||
mapping = self.session.query(PlatformCommodityMapping).one()
|
||||
mapping.goods_name = "套装-兔兔白日梦(斗鱼)"
|
||||
self.session.add(
|
||||
@@ -730,6 +731,7 @@ class TestFulfillmentCollabSync(_Base):
|
||||
assert order.required_points == 1280
|
||||
assert order.account_id == task.account_id
|
||||
assert order.account_username == "collab-sync-account"
|
||||
assert order.home_images == ["https://example.com/game-home.png"]
|
||||
assert order.bind_game_role == "已确认角色"
|
||||
assert order.bind_game_channel == "微信 / 苹果(iOS)"
|
||||
assert order.status == collab.STATUS_INCOMPLETE
|
||||
@@ -738,6 +740,8 @@ class TestFulfillmentCollabSync(_Base):
|
||||
).model_dump()
|
||||
assert payload["source_task_id"] == task.id
|
||||
assert payload["source_platform_order_id"] == task.platform_order_id
|
||||
assert payload["home_image_urls"] == ["https://example.com/game-home.png"]
|
||||
assert payload["home_image_thumb_urls"] == ["https://example.com/game-home.png"]
|
||||
assert (
|
||||
self.session.query(AccountEvent)
|
||||
.filter(AccountEvent.event_type == "collab_synced")
|
||||
@@ -768,6 +772,25 @@ class TestFulfillmentCollabSync(_Base):
|
||||
assert synced.account_id == account.id
|
||||
assert synced.account_username == account.username
|
||||
|
||||
def test_manual_sync_backfills_customer_home_images(self):
|
||||
task = self._task_with_account()
|
||||
order, _ = collab.sync_platform_fulfillment_order(
|
||||
self.session,
|
||||
self.admin,
|
||||
task,
|
||||
)
|
||||
assert not order.home_images
|
||||
|
||||
self.complete_customer_profile(task)
|
||||
synced, action = collab.sync_platform_fulfillment_order(
|
||||
self.session,
|
||||
self.admin,
|
||||
task,
|
||||
)
|
||||
|
||||
assert action == "updated"
|
||||
assert synced.home_images == ["https://example.com/game-home.png"]
|
||||
|
||||
def test_manual_sync_is_idempotent_and_preserves_human_fields(self):
|
||||
task = self._task_with_account()
|
||||
order, _ = collab.sync_platform_fulfillment_order(
|
||||
@@ -3011,7 +3034,7 @@ class TestBindingAndCompletion(_Base):
|
||||
assert task.execution_status == "manual_required"
|
||||
assert task.issue_code == "customer_role_bound_elsewhere"
|
||||
assert "role-lock-holder" in task.last_error
|
||||
assert "协作单" in task.last_error
|
||||
assert "预售台账" in task.last_error
|
||||
assert event.detail_json["roleLockAccountId"] == lock_account.id
|
||||
assert event.detail_json["roleLockAccountName"] == "role-lock-holder"
|
||||
assert event.detail_json["roleLockLeasePurpose"] == "douyu_collab"
|
||||
@@ -4418,7 +4441,7 @@ class TestBindingAndCompletion(_Base):
|
||||
)
|
||||
|
||||
assert exc_info.value.status_code == 409
|
||||
assert "外部协作单已在人工处理" in str(exc_info.value.detail)
|
||||
assert "关联预售单已在人工处理" in str(exc_info.value.detail)
|
||||
|
||||
def test_restore_rejects_terminal_source_order(self, monkeypatch):
|
||||
task = self.task()
|
||||
@@ -4559,7 +4582,7 @@ class TestBindingAndCompletion(_Base):
|
||||
self.session,
|
||||
task_id=task.id,
|
||||
current=self.admin,
|
||||
reason="以外部协作单的人工处理为准",
|
||||
reason="以斗鱼预售台账的人工处理为准",
|
||||
)
|
||||
|
||||
self.session.refresh(task)
|
||||
|
||||
@@ -901,7 +901,7 @@ class DouyuEsportsGoodsSnapshot(Base):
|
||||
|
||||
|
||||
class DouyuCollabShop(Base):
|
||||
"""斗鱼外部单协作的店铺字典(新建单时点选,历史文本自动登记)。"""
|
||||
"""斗鱼预售台账的店铺字典(新建单时点选,历史文本自动登记)。"""
|
||||
|
||||
__tablename__ = "douyu_collab_shops"
|
||||
|
||||
@@ -929,7 +929,7 @@ class DouyuCollabShop(Base):
|
||||
|
||||
|
||||
class DouyuCollabGift(Base):
|
||||
"""斗鱼外部单协作的礼包字典(管理员维护名称与所需积分)。"""
|
||||
"""斗鱼预售台账的礼包字典(管理员维护名称与所需积分)。"""
|
||||
|
||||
__tablename__ = "douyu_collab_gifts"
|
||||
|
||||
@@ -958,11 +958,11 @@ class DouyuCollabGift(Base):
|
||||
|
||||
|
||||
class DouyuExternalOrder(Base):
|
||||
"""斗鱼外部单协作台账(一行 = 一单 = 一个内部斗鱼账号)。
|
||||
"""斗鱼预售台账(一行 = 一单 = 一个内部斗鱼账号)。
|
||||
|
||||
和虎牙外部 CK 台账的关键区别:**不复制 CK**。协作单只存 ``account_id``
|
||||
和虎牙外部 CK 台账的关键区别:**不复制 CK**。预售单只存 ``account_id``
|
||||
(可空,账号删除后置空)与用户名/UID 快照,任何查询都实时读
|
||||
``accounts.cookie``。账号 CK 更新后,协作单自动使用最新凭据。
|
||||
``accounts.cookie``。账号 CK 更新后,预售单自动使用最新凭据。
|
||||
"""
|
||||
|
||||
__tablename__ = "douyu_external_orders"
|
||||
@@ -981,7 +981,7 @@ class DouyuExternalOrder(Base):
|
||||
owner_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("users.id"), nullable=True, index=True
|
||||
)
|
||||
# ---- 来源关联(手工协作单为空)----
|
||||
# ---- 来源关联(手工预售单为空)----
|
||||
source_type: Mapped[str] = mapped_column(
|
||||
String(24), nullable=False, default="manual", server_default="manual"
|
||||
)
|
||||
@@ -1030,6 +1030,7 @@ class DouyuExternalOrder(Base):
|
||||
)
|
||||
|
||||
# ---- 订单资料 ----
|
||||
# 手工上传存 live-hub object key;order_site 同步来的客户主页图存绝对 URL。
|
||||
home_images: Mapped[list | None] = mapped_column(JSON, nullable=True)
|
||||
gift_name: Mapped[str] = mapped_column(String(128), default="", server_default="")
|
||||
commodity_id: Mapped[str] = mapped_column(String(64), default="", server_default="")
|
||||
@@ -1094,7 +1095,7 @@ class DouyuExternalOrder(Base):
|
||||
"source_task_id",
|
||||
unique=True,
|
||||
),
|
||||
# 账号池排除活动协作单的 NOT EXISTS 每轮都会执行。
|
||||
# 账号池排除活动预售单的 NOT EXISTS 每轮都会执行。
|
||||
Index(
|
||||
"ix_douyu_external_orders_active_account",
|
||||
"account_id",
|
||||
@@ -1105,7 +1106,7 @@ class DouyuExternalOrder(Base):
|
||||
|
||||
|
||||
class DouyuExternalOrderMetric(Base):
|
||||
"""斗鱼协作单的鱼翅/积分/兑换记录快照(只追加,不存 CK)。"""
|
||||
"""斗鱼预售单的鱼翅/积分/兑换记录快照(只追加,不存 CK)。"""
|
||||
|
||||
__tablename__ = "douyu_external_order_metrics"
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@ PERMISSIONS = {
|
||||
# 斗鱼活动
|
||||
"douyu:task": "斗鱼任务管理",
|
||||
"douyu:config": "斗鱼配置管理",
|
||||
# 斗鱼外部单协作(订单挂内部账号,导出时实时读取账号 CK)
|
||||
"douyu:collab:view": "查看斗鱼外部单协作",
|
||||
"douyu:collab:edit": "编辑斗鱼外部单协作",
|
||||
"douyu:collab:manage": "删除斗鱼外部单协作",
|
||||
# 斗鱼预售台账(订单挂内部账号,导出时实时读取账号 CK)
|
||||
"douyu:collab:view": "查看斗鱼预售台账",
|
||||
"douyu:collab:edit": "编辑斗鱼预售台账",
|
||||
"douyu:collab:manage": "删除斗鱼预售台账",
|
||||
# CK 是凭据:导到剪贴板 = 把凭据带出系统,单独一个点,默认只给运营
|
||||
"douyu:collab:ck_export": "导出斗鱼外部单协作账号的 CK(写剪贴板)",
|
||||
"douyu:collab:ck_export": "导出斗鱼预售台账账号的 CK(写剪贴板)",
|
||||
# 直播账号履约:order_site 订单由内部斗鱼账号完成游戏角色绑定和人工兑换
|
||||
"platform_fulfillment:view": "查看直播账号履约任务",
|
||||
"platform_fulfillment:use": "分配账号、绑定角色和处理直播账号履约",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作接口。
|
||||
"""斗鱼预售台账接口。
|
||||
|
||||
页面只做参数校验、权限和异常翻译;业务规则见
|
||||
``web/backend/services/douyu_collab_service.py``。
|
||||
@@ -59,7 +59,7 @@ from ..schemas import (
|
||||
from ..services import douyu_collab_service as collab
|
||||
from ..services.douyu_collab_events import collab_events
|
||||
|
||||
router = APIRouter(prefix="/api/douyu", tags=["斗鱼外部单协作"])
|
||||
router = APIRouter(prefix="/api/douyu", tags=["斗鱼预售台账"])
|
||||
|
||||
|
||||
def _verify_batch_interval() -> float:
|
||||
@@ -457,7 +457,7 @@ def export_external_orders_ck(
|
||||
):
|
||||
"""勾选多行导出关联内部账号的 CK 明文(前端写剪贴板)。
|
||||
|
||||
斗鱼协作单不存 CK,导出的始终是关联账号的实时 ``cookie``。逐行写审计,
|
||||
斗鱼预售单不存 CK,导出的始终是关联账号的实时 ``cookie``。逐行写审计,
|
||||
但审计里只记单号/账号/CK 状态,不把 CK 本体写进审计。
|
||||
"""
|
||||
try:
|
||||
|
||||
@@ -2651,7 +2651,7 @@ class HuyaExternalOrderAuditOut(BaseModel):
|
||||
created_at: datetime | None = None
|
||||
|
||||
|
||||
# ==================== 斗鱼外部单协作 ====================
|
||||
# ==================== 斗鱼预售台账 ====================
|
||||
|
||||
|
||||
class DouyuCollabShopCreate(BaseModel):
|
||||
@@ -2951,6 +2951,7 @@ class DouyuCollabOrderOut(BaseModel):
|
||||
bind_game_channel: str = ""
|
||||
bind_snapshot_at: datetime | None = None
|
||||
|
||||
# live-hub object key 或 order_site 客户主页图的绝对 URL。
|
||||
home_images: list[str] = Field(default_factory=list)
|
||||
home_image_urls: list[str] = Field(default_factory=list)
|
||||
home_image_thumb_urls: list[str] = Field(default_factory=list)
|
||||
|
||||
@@ -77,7 +77,7 @@ EVENT_TASK_STOPPED = "task_stopped" # 斗鱼账号任务停止/中断
|
||||
EVENT_QUERY_COMPLETED = "query_completed" # 同步查询完成(含部分失败)
|
||||
EVENT_LEASE_ACQUIRED = "lease_acquired" # 分配履约账号使用权
|
||||
EVENT_LEASE_RELEASED = "lease_released" # 释放履约账号使用权
|
||||
EVENT_COLLAB_SYNCED = "collab_synced" # 直播履约任务同步到外部单协作
|
||||
EVENT_COLLAB_SYNCED = "collab_synced" # 直播履约任务同步到斗鱼预售台账
|
||||
|
||||
# 有符号金额的事件类型(用于页面「累计充值/累计消耗」):
|
||||
# 充值为正、兑换为负,其余不计入金额统计。
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
关系动态计算:
|
||||
|
||||
- ``presale_bound``:仍在履约中的预售任务所分配的账号;
|
||||
- ``collab_bound``:仍在进行中的斗鱼外部协作单所绑定的账号。
|
||||
- ``collab_bound``:仍在进行中的斗鱼预售台账订单所绑定的账号。
|
||||
|
||||
配置保存在 ``ck_health.config["protection_groups"]``。这样不需要扩容账号表,
|
||||
也不会污染高价值/普通的库存供给口径。目标数量用于预警缺口;只要组已启用,
|
||||
@@ -49,8 +49,8 @@ GROUP_DEFINITIONS: dict[str, dict[str, Any]] = {
|
||||
"auto_relogin": True,
|
||||
},
|
||||
"collab_bound": {
|
||||
"label": "协作单绑定账号",
|
||||
"description": "未归档且仍在进行中的斗鱼外部协作单所绑定账号",
|
||||
"label": "预售台账绑定账号",
|
||||
"description": "未归档且仍在进行中的斗鱼预售台账订单绑定账号",
|
||||
"enabled": True,
|
||||
"target_count": 0,
|
||||
"probe_interval_minutes": DEFAULT_PROBE_INTERVAL_MINUTES,
|
||||
|
||||
@@ -234,7 +234,7 @@ def register_default_jobs() -> None:
|
||||
JobSpec(
|
||||
key=LEASE_CK_REFRESH_KEY,
|
||||
title="履约 CK 到期前刷新",
|
||||
# 处理仍有效、但预测 24h 内到期的全部履约保护账号(预售 / 协作单 / 生效租约),
|
||||
# 处理仍有效、但预测 24h 内到期的全部履约保护账号(预售 / 预售台账 / 生效租约),
|
||||
# 提前续 CK,不参与普通失效重登的批次。
|
||||
interval_seconds=600,
|
||||
run_interval_seconds=600,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
范围:
|
||||
|
||||
- 预售履约任务分配的账号、进行中的斗鱼外部协作单绑定账号;
|
||||
- 预售履约任务分配的账号、进行中的斗鱼预售台账订单绑定账号;
|
||||
- `account_leases.status=active` 且 purpose 为 `platform_fulfillment` / `douyu_collab`;
|
||||
- `ck_check_status=valid`、有 Cookie、可自动管理、没有在途登录;
|
||||
- 预测到期时间 <= now + 24h(`ck_expected_expires_at` 或 `cookie_updated_at + 7d`);
|
||||
@@ -56,7 +56,7 @@ def due_lease_account_query(
|
||||
db: Session,
|
||||
now: datetime | None = None,
|
||||
):
|
||||
"""到期前 24h 的履约保护账号查询(预售 / 协作单 / 生效租约共用)。"""
|
||||
"""到期前 24h 的履约保护账号查询(预售 / 预售台账 / 生效租约共用)。"""
|
||||
moment = now or datetime.now(UTC)
|
||||
cutoff = moment + REFRESH_BEFORE
|
||||
protection = load_protection_snapshot(db)
|
||||
|
||||
@@ -125,7 +125,7 @@ def run_platform_fulfillment_lease_reaper(
|
||||
|
||||
# 分配并发/重试可能留下「batch_id 指向 task,但 task 实际用另一个账号/租约」
|
||||
# 的孤儿 active 租约。它不会自然过期(expires_at 常为 NULL),会永久占住账号,
|
||||
# 并让协作单接管时报“任务与租约不一致”。这里按 task 的真实归属回收。
|
||||
# 并让预售单接管时报“任务与租约不一致”。这里按 task 的真实归属回收。
|
||||
# 注意:不能在过滤孤儿前先 limit active 租约。生产有 3,900+ 条 active
|
||||
# pf 租约,先取前 500 条会被合法租约占满,后面的孤儿永远轮不到。
|
||||
# 这里直接用 SQL 关联出「task 不存在 / task 账号或租约不一致」。
|
||||
@@ -174,7 +174,7 @@ def run_platform_fulfillment_lease_reaper(
|
||||
task.lease_id = None
|
||||
task.execution_status = "manual_required"
|
||||
task.issue_code = "lease_expired_collab_handoff"
|
||||
task.last_error = "平台租约已到期,账号已转外部协作人工处理"
|
||||
task.last_error = "平台租约已到期,账号已转预售台账人工处理"
|
||||
task.updated_at = moment
|
||||
affected += 1
|
||||
if released_ids:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的礼包、商品解析与活动商品刷新。"""
|
||||
"""斗鱼预售台账的礼包、商品解析与活动商品刷新。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -225,7 +225,7 @@ def delete_gift(
|
||||
)
|
||||
if used:
|
||||
raise CollabError(
|
||||
f"还有 {used} 个协作单使用「{gift_name}」,请先停用或改名",
|
||||
f"还有 {used} 个预售单使用「{gift_name}」,请先停用或改名",
|
||||
code="gift_in_use",
|
||||
)
|
||||
record_audit(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的共享状态、校验与轻量查询。"""
|
||||
"""斗鱼预售台账的共享状态、校验与轻量查询。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作台账的进程内实时事件总线。
|
||||
"""斗鱼预售台账的进程内实时事件总线。
|
||||
|
||||
写接口提交成功后只发布「台账失效」事件,前端收到后按自己的筛选静默重拉,
|
||||
不在事件里携带整行数据。当前生产单 worker,进程内队列足够;多实例时再换 Redis。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的账号凭据与用户名导出。"""
|
||||
"""斗鱼预售台账的账号凭据与用户名导出。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -28,9 +28,9 @@ def export_cks(
|
||||
*,
|
||||
commit: bool = True,
|
||||
) -> dict[str, Any]:
|
||||
"""导出协作单关联内部账号的 **CK 明文**(前端写剪贴板用)。
|
||||
"""导出预售单关联内部账号的 **CK 明文**(前端写剪贴板用)。
|
||||
|
||||
斗鱼协作单本身不存 CK,导出的始终是关联 ``accounts.cookie`` 的实时值。
|
||||
斗鱼预售单本身不存 CK,导出的始终是关联 ``accounts.cookie`` 的实时值。
|
||||
和虎牙台账保持同一口径:
|
||||
|
||||
1. 需要独立权限点 ``douyu:collab:ck_export``;
|
||||
@@ -59,7 +59,7 @@ def export_cks(
|
||||
{
|
||||
"id": order_id,
|
||||
"order_no": "",
|
||||
"reason": "协作单不存在或已删除",
|
||||
"reason": "预售单不存在或已删除",
|
||||
}
|
||||
)
|
||||
continue
|
||||
@@ -151,7 +151,7 @@ def export_usernames(
|
||||
{
|
||||
"id": order_id,
|
||||
"order_no": "",
|
||||
"reason": "协作单不存在或已删除",
|
||||
"reason": "预售单不存在或已删除",
|
||||
}
|
||||
)
|
||||
continue
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的账号占用、平台租约接管与释放。"""
|
||||
"""斗鱼预售台账的账号占用、平台租约接管与释放。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -120,7 +120,7 @@ def _takeover_platform_lease_for_collab(
|
||||
order: DouyuExternalOrder,
|
||||
lease: AccountLease,
|
||||
) -> AccountLease:
|
||||
"""外部协作显式接管平台租约,并在同一事务内把平台任务转人工。"""
|
||||
"""预售单显式接管平台租约,并在同一事务内把平台任务转人工。"""
|
||||
if not user_has_permission(current, "platform_fulfillment:use"):
|
||||
raise CollabError(
|
||||
"没有接管平台履约账号的权限",
|
||||
@@ -136,7 +136,7 @@ def _takeover_platform_lease_for_collab(
|
||||
)
|
||||
if platform_task.execution_status in {"completed", "cancelled"}:
|
||||
raise CollabError(
|
||||
f"平台履约任务 #{platform_task.id} 已结束,不能由协作单接管",
|
||||
f"平台履约任务 #{platform_task.id} 已结束,不能由预售单接管",
|
||||
status_code=409,
|
||||
code="platform_task_not_takeoverable",
|
||||
)
|
||||
@@ -186,7 +186,7 @@ def _takeover_platform_lease_for_collab(
|
||||
db,
|
||||
account_id=int(lease.account_id),
|
||||
event_type=EVENT_LEASE_ACQUIRED,
|
||||
title=f"外部协作接管平台履约账号:{order.order_no}",
|
||||
title=f"预售单接管平台履约账号:{order.order_no}",
|
||||
category=CATEGORY_OPS,
|
||||
detail={
|
||||
"lease_id": lease.id,
|
||||
@@ -385,7 +385,7 @@ def _sync_order_lease(
|
||||
else "平台履约任务"
|
||||
)
|
||||
raise CollabError(
|
||||
f"该账号当前被{task_label}占用,请先由协作单确认接管",
|
||||
f"该账号当前被{task_label}占用,请先由预售单确认接管",
|
||||
status_code=409,
|
||||
code="account_lease_conflict",
|
||||
)
|
||||
@@ -473,7 +473,7 @@ def retain_lease_for_active_collab(
|
||||
db,
|
||||
account_id=int(account_id),
|
||||
event_type=EVENT_LEASE_ACQUIRED,
|
||||
title=f"外部协作接管账号占用:{order.order_no}",
|
||||
title=f"预售单接管账号占用:{order.order_no}",
|
||||
category=CATEGORY_OPS,
|
||||
detail={
|
||||
"lease_id": active_lease.id,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的查询、序列化、汇总与时间线。"""
|
||||
"""斗鱼预售台账的查询、序列化、汇总与时间线。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -372,7 +372,7 @@ def get_order(db: Session, order_id: int) -> DouyuExternalOrder:
|
||||
db.query(DouyuExternalOrder).filter(DouyuExternalOrder.id == order_id).first()
|
||||
)
|
||||
if order is None:
|
||||
raise CollabError("协作单不存在", status_code=404, code="order_not_found")
|
||||
raise CollabError("预售单不存在", status_code=404, code="order_not_found")
|
||||
return order
|
||||
|
||||
def serialize_one(db: Session, order: DouyuExternalOrder) -> dict[str, Any]:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# ruff: noqa: F401
|
||||
"""斗鱼外部单协作台账服务。
|
||||
"""斗鱼预售台账服务。
|
||||
|
||||
核心边界(和虎牙外部 CK 台账的区别):
|
||||
|
||||
1. **一行 = 一单 = 一个内部斗鱼账号**。协作单只存 ``account_id`` 和用户名快照,
|
||||
1. **一行 = 一单 = 一个内部斗鱼账号**。预售单只存 ``account_id`` 和用户名快照,
|
||||
**不复制 CK**;所有查询实时读 ``accounts.cookie``,账号换 CK 后自动生效。
|
||||
2. 鱼翅和手册积分是两笔资产:先充值鱼翅,再用鱼翅赠送精英令换积分。
|
||||
余额查询单独返回两笔资产,兑换记录查询不混查余额。
|
||||
@@ -385,7 +385,7 @@ def unlink_account(
|
||||
expected_version: int | None = None,
|
||||
commit: bool = True,
|
||||
) -> DouyuExternalOrder:
|
||||
"""解除协作单与账号的关联,但不删除内部账号。"""
|
||||
"""解除预售单与账号的关联,但不删除内部账号。"""
|
||||
_assert_account_replace_permission(current)
|
||||
_assert_success_account_change_allowed(current, order)
|
||||
_assert_account_replaceable(order)
|
||||
@@ -520,7 +520,7 @@ def recommend_accounts(
|
||||
work_type=WORK_STOREHOME_SYNC,
|
||||
priority=20,
|
||||
due_at=now,
|
||||
reason=f"外部协作单推荐缺少商品能力: {cid}",
|
||||
reason=f"预售台账推荐缺少商品能力: {cid}",
|
||||
payload={"commodity_id": cid, "order_id": int(order.id)},
|
||||
)
|
||||
if refresh_seeds:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""斗鱼外部单协作的店铺字典与人工别名映射。"""
|
||||
"""斗鱼预售台账的店铺字典与人工别名映射。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -229,7 +229,7 @@ def delete_shop(
|
||||
)
|
||||
if used:
|
||||
raise CollabError(
|
||||
f"还有 {used} 个协作单使用「{shop_name}」,请先改名或停用",
|
||||
f"还有 {used} 个预售单使用「{shop_name}」,请先改名或停用",
|
||||
code="shop_in_use",
|
||||
)
|
||||
record_audit(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""直播账号履约任务向斗鱼外部单协作的幂等投影。"""
|
||||
"""直播账号履约任务向斗鱼预售台账的幂等投影。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -24,6 +24,7 @@ from .douyu_binding import (
|
||||
resolve_fulfillment_binding,
|
||||
)
|
||||
from .douyu_collab_common import (
|
||||
MAX_IMAGES,
|
||||
POINTS_THRESHOLD_DEFAULT,
|
||||
SOURCE_TYPE_PLATFORM_FULFILLMENT,
|
||||
STATUS_DONE,
|
||||
@@ -79,18 +80,50 @@ def _platform_fulfillment_gift(
|
||||
|
||||
|
||||
def _platform_fulfillment_order_no(task: PlatformFulfillmentTask) -> str:
|
||||
"""外部协作单直接使用 order_site 的真实平台订单号。"""
|
||||
"""预售单直接使用 order_site 的真实平台订单号。"""
|
||||
order_no = _text(task.platform_order_id)
|
||||
if not order_no:
|
||||
raise CollabError("履约任务缺少平台订单号", code="platform_order_no_required")
|
||||
if len(order_no) > 64:
|
||||
raise CollabError(
|
||||
"平台订单号超过协作单号长度限制",
|
||||
"平台订单号超过预售单号长度限制",
|
||||
code="platform_order_no_too_long",
|
||||
)
|
||||
return order_no
|
||||
|
||||
|
||||
def _platform_fulfillment_home_images(
|
||||
task: PlatformFulfillmentTask,
|
||||
) -> list[str]:
|
||||
"""把 order_site 的客户主页截图投影成预售台账可展示的图片引用。
|
||||
|
||||
order_site 快照同时带 ``url`` 和 ``objectKey``。两者可能属于 order_site
|
||||
自己的文件桶,因此优先保存绝对 URL,live-hub 回读时直接使用;只有没有
|
||||
URL 的旧数据才退回 object key。
|
||||
"""
|
||||
images: list[str] = []
|
||||
for item in task.customer_home_images or []:
|
||||
if isinstance(item, str):
|
||||
reference = item
|
||||
elif isinstance(item, dict):
|
||||
reference = (
|
||||
item.get("url")
|
||||
or item.get("thumbnailUrl")
|
||||
or item.get("thumbnail_url")
|
||||
or item.get("objectKey")
|
||||
or item.get("object_key")
|
||||
or ""
|
||||
)
|
||||
else:
|
||||
continue
|
||||
image = _text(reference, max_length=512)
|
||||
if image and image not in images:
|
||||
images.append(image)
|
||||
if len(images) >= MAX_IMAGES:
|
||||
break
|
||||
return images
|
||||
|
||||
|
||||
def _apply_platform_fulfillment_binding(
|
||||
db: Session,
|
||||
order: DouyuExternalOrder,
|
||||
@@ -98,7 +131,7 @@ def _apply_platform_fulfillment_binding(
|
||||
*,
|
||||
overwrite: bool,
|
||||
) -> None:
|
||||
"""把履约任务已确认的本地绑定结果投影到协作单,不额外联网。"""
|
||||
"""把履约任务已确认的本地绑定结果投影到预售单,不额外联网。"""
|
||||
bind_task = (
|
||||
db.query(DouyuTask).filter(DouyuTask.id == task.bind_task_id).first()
|
||||
if task.bind_task_id
|
||||
@@ -161,7 +194,7 @@ def sync_platform_fulfillment_order(
|
||||
*,
|
||||
commit: bool = True,
|
||||
) -> tuple[DouyuExternalOrder, str]:
|
||||
"""把一条直播履约任务幂等同步为斗鱼外部协作单。"""
|
||||
"""把一条直播履约任务幂等同步为斗鱼预售台账订单。"""
|
||||
if task.source_system != "order_site":
|
||||
raise CollabError("仅支持同步 order_site 履约任务", code="source_unsupported")
|
||||
|
||||
@@ -198,6 +231,7 @@ def sync_platform_fulfillment_order(
|
||||
else None
|
||||
)
|
||||
gift_name, commodity_id, required_points = _platform_fulfillment_gift(db, task)
|
||||
home_images = _platform_fulfillment_home_images(task)
|
||||
|
||||
if order is None:
|
||||
order = DouyuExternalOrder(
|
||||
@@ -229,6 +263,8 @@ def sync_platform_fulfillment_order(
|
||||
order.gift_name = gift_name
|
||||
order.commodity_id = commodity_id
|
||||
order.required_points = required_points
|
||||
if home_images:
|
||||
order.home_images = home_images
|
||||
if account is not None and (
|
||||
created or (order.account_id is None and not order.account_username)
|
||||
):
|
||||
@@ -270,7 +306,7 @@ def sync_platform_fulfillment_order(
|
||||
account=linked_account,
|
||||
action="douyu:collab:sync_from_platform_fulfillment",
|
||||
event_type=EVENT_COLLAB_SYNCED,
|
||||
title=f"同步外部单协作:{order.order_no}",
|
||||
title=f"同步斗鱼预售台账:{order.order_no}",
|
||||
target=f"douyu_external_order:{order.id}",
|
||||
detail=audit_detail,
|
||||
)
|
||||
@@ -358,7 +394,7 @@ def sync_platform_fulfillment_orders(
|
||||
}
|
||||
)
|
||||
except Exception: # noqa: BLE001 - 批量边界需隔离单条未知故障
|
||||
logger.exception("同步直播履约任务 {} 到斗鱼外部协作失败", task_id)
|
||||
logger.exception("同步直播履约任务 {} 到斗鱼预售台账失败", task_id)
|
||||
result["failed"] += 1
|
||||
result["items"].append(
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ import secrets
|
||||
from dataclasses import dataclass
|
||||
from datetime import UTC, datetime
|
||||
from typing import Any
|
||||
from urllib.parse import quote
|
||||
from urllib.parse import quote, urlsplit
|
||||
|
||||
from loguru import logger
|
||||
from PIL import Image, ImageOps, features
|
||||
@@ -152,8 +152,19 @@ def image_variant_fallback_keys(object_key: str, variant: str) -> list[str]:
|
||||
|
||||
|
||||
def build_file_url(object_key: str, variant: str = "") -> str:
|
||||
"""文件访问地址(走后端代理,不暴露对象存储直链)。"""
|
||||
url = f"/api/files/object?key={quote(normalize_object_key(object_key), safe='')}"
|
||||
"""文件访问地址。
|
||||
|
||||
本系统上传的图片仍走 ``/api/files/object`` 代理;order_site 已在客户资料
|
||||
快照里提供绝对 URL 的图片则原样返回,避免把外部地址误当成 live-hub 的
|
||||
object key 再包一层查询参数。
|
||||
"""
|
||||
raw = str(object_key or "").strip()
|
||||
parsed = urlsplit(raw)
|
||||
if parsed.scheme.lower() in {"http", "https"} and parsed.netloc:
|
||||
return raw
|
||||
if raw.startswith("/") and not raw.startswith("//"):
|
||||
return raw
|
||||
url = f"/api/files/object?key={quote(normalize_object_key(raw), safe='')}"
|
||||
if variant:
|
||||
url = f"{url}&variant={quote(variant, safe='')}"
|
||||
return url
|
||||
|
||||
@@ -31,7 +31,7 @@ CATEGORY_MANUAL = "manual_login"
|
||||
CATEGORY_ONBOARDING = "onboarding"
|
||||
CATEGORY_RELOGIN_HIGH = "relogin_high_value"
|
||||
CATEGORY_RELOGIN_ORDINARY = "relogin_ordinary"
|
||||
#: 履约保护目标(预售/协作单/生效租约绑定账号)的失效重登:独立分类与配额保护,
|
||||
#: 履约保护目标(预售/预售台账/生效租约绑定账号)的失效重登:独立分类与配额保护,
|
||||
#: 不被全库普通重登吃干当天登录次数。
|
||||
CATEGORY_RELOGIN_PROTECTED = "relogin_protected"
|
||||
CATEGORY_ACCOUNT_CHECK = "account_check"
|
||||
|
||||
@@ -494,7 +494,7 @@ def _allocate_task_from_capability(
|
||||
elif retry_reason == "account_pool_busy":
|
||||
task.issue_code = "account_pool_busy"
|
||||
task.last_error = (
|
||||
"已有具备兑换资格的账号,但当前被租约或外部协作单占用;"
|
||||
"已有具备兑换资格的账号,但当前被租约或预售台账占用;"
|
||||
"后台正在继续补充可用账号"
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -693,7 +693,7 @@ def restore_cancelled_task(
|
||||
):
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail="关联外部协作单已在人工处理,请继续使用外部协作单",
|
||||
detail="关联预售单已在人工处理,请继续使用斗鱼预售台账",
|
||||
)
|
||||
|
||||
mapping = _mapping_for_sku(db, task.internal_sku_key)
|
||||
@@ -745,12 +745,12 @@ def prepare_platform_task_for_collab_takeover(
|
||||
current: User,
|
||||
collab_order_no: str,
|
||||
) -> None:
|
||||
"""把平台履约任务转为人工,但不提交事务;由协作单接管流程原子提交。"""
|
||||
"""把平台履约任务转为人工,但不提交事务;由预售单接管流程原子提交。"""
|
||||
if task.execution_status in {"completed", "cancelled"}:
|
||||
raise HTTPException(status_code=409, detail="已结束的履约任务不能被协作单接管")
|
||||
raise HTTPException(status_code=409, detail="已结束的履约任务不能被预售单接管")
|
||||
account_id = task.account_id
|
||||
lease_id = task.lease_id
|
||||
reason = f"外部协作单 {collab_order_no} 人工接管账号"
|
||||
reason = f"预售单 {collab_order_no} 人工接管账号"
|
||||
task.account_id = None
|
||||
task.lease_id = None
|
||||
task.bind_task_id = None
|
||||
@@ -791,7 +791,7 @@ def release_task_to_manual(
|
||||
task = _load_task(db, task_id)
|
||||
if task.execution_status in {"completed", "cancelled"}:
|
||||
raise HTTPException(status_code=409, detail="已结束任务不能转人工")
|
||||
manual_reason = reason.strip()[:2000] or "以外部单协作人工处理为准"
|
||||
manual_reason = reason.strip()[:2000] or "以斗鱼预售台账人工处理为准"
|
||||
account_id = task.account_id
|
||||
lease_id = task.lease_id
|
||||
lease = (
|
||||
|
||||
@@ -58,7 +58,7 @@ def _retain_lease_for_active_collab(
|
||||
current: User,
|
||||
reason: str,
|
||||
) -> AccountLease | None:
|
||||
"""平台释放账号前,把仍在活动的协作单占用接续到同一租约。"""
|
||||
"""平台释放账号前,把仍在活动的预售单占用接续到同一租约。"""
|
||||
if lease is None or not task.account_id:
|
||||
return None
|
||||
from ..douyu_collab_service import retain_lease_for_active_collab
|
||||
|
||||
@@ -36,7 +36,7 @@ ROLE_LOCK_WINDOW = timedelta(days=7)
|
||||
_BEIJING = ZoneInfo("Asia/Shanghai")
|
||||
|
||||
_LEASE_PURPOSE_LABELS = {
|
||||
"douyu_collab": "协作单",
|
||||
"douyu_collab": "预售台账",
|
||||
"platform_fulfillment": "履约单",
|
||||
"exchange": "兑换单",
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ def _apply_task_lease_policy(
|
||||
return active_lease
|
||||
|
||||
if str(task.execution_status or "") in {"completed", "cancelled"}:
|
||||
# 终态释放前先检查活动外部协作单。若账号仍被协作单使用,租约转换为
|
||||
# 终态释放前先检查活动预售单。若账号仍被预售单使用,租约转换为
|
||||
# douyu_collab 并保持无限,不能被平台 TTL 抢走。
|
||||
from ..douyu_collab_service import retain_lease_for_active_collab
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ const PlatformFulfillmentPage = lazy(() => import('./pages/PlatformFulfillmentPa
|
||||
const AutomationPage = lazy(() => import('./pages/AutomationPage'));
|
||||
const UsersPage = lazy(() => import('./pages/UsersPage'));
|
||||
const CookiePage = lazy(() => import('./pages/CookiePage'));
|
||||
const CookieOperationsPage = lazy(() => import('./pages/CookieOperationsPage'));
|
||||
const DouyuTasksPage = lazy(() => import('./pages/DouyuTasksPage'));
|
||||
const DouyuCollabPage = lazy(() => import('./pages/DouyuCollabPage'));
|
||||
const HuyaAccountsPage = lazy(() => import('./pages/HuyaAccountsPage'));
|
||||
@@ -94,7 +93,6 @@ function AppContent() {
|
||||
<Route path="assignments" element={lazyRoute(<AssignmentsPage />)} />
|
||||
<Route path="login-tasks" element={lazyRoute(<LoginTasksPage />)} />
|
||||
<Route path="cookies" element={lazyRoute(<CookiePage />)} />
|
||||
<Route path="cookie-operations" element={lazyRoute(<CookieOperationsPage />)} />
|
||||
<Route path="douyu/tasks" element={<Navigate to="/douyu/elite" replace />} />
|
||||
<Route path="douyu/elite" element={lazyRoute(<DouyuTasksPage key="elite" handbook="elite" />)} />
|
||||
<Route path="douyu/esports" element={lazyRoute(<DouyuTasksPage key="esports" handbook="esports" />)} />
|
||||
|
||||
@@ -234,7 +234,7 @@ export default function DouyuCollabGiftModal({
|
||||
canManage ? (
|
||||
<Popconfirm
|
||||
title={`删除礼包「${row.name}」?`}
|
||||
description="仍有协作单使用该礼包时会被拒绝,可改用停用"
|
||||
description="仍有预售单使用该礼包时会被拒绝,可改用停用"
|
||||
onConfirm={() => void remove(row)}
|
||||
disabled={busy}
|
||||
>
|
||||
@@ -258,7 +258,7 @@ export default function DouyuCollabGiftModal({
|
||||
>
|
||||
<Space direction="vertical" size={10} style={{ width: '100%' }}>
|
||||
<Text type="secondary">
|
||||
先在这里维护标准礼包名和所需积分,新建协作单时直接选择。礼包名请按兑换记录里的名称填写;
|
||||
先在这里维护标准礼包名和所需积分,新建预售单时直接选择。礼包名请按兑换记录里的名称填写;
|
||||
停用只是不再出现在新建选择里,历史订单不受影响;改名会同步已有订单,改积分只影响之后新建的单。
|
||||
</Text>
|
||||
{canManage && (
|
||||
@@ -336,7 +336,7 @@ export default function DouyuCollabGiftModal({
|
||||
onChange={(event) => setEditRemark(event.target.value)}
|
||||
/>
|
||||
<Text type="secondary">
|
||||
改名会同步已有协作单上的礼包名;修改积分只影响之后新建的协作单,不会改变历史订单。
|
||||
改名会同步已有预售单上的礼包名;修改积分只影响之后新建的预售单,不会改变历史订单。
|
||||
</Text>
|
||||
</Space>
|
||||
</Modal>
|
||||
|
||||
@@ -23,7 +23,7 @@ import { getErrorMessage } from '../utils/error';
|
||||
const { Text } = Typography;
|
||||
|
||||
/**
|
||||
* 斗鱼店铺管理:先维护好店铺,新建协作单时直接点选。
|
||||
* 斗鱼店铺管理:先维护好店铺,新建预售单时直接点选。
|
||||
*
|
||||
* - 停用后不再出现在新建下拉里,历史订单不受影响;
|
||||
* - 重命名会自动同步已有订单上的店铺名,避免筛选出现新旧两个名字;
|
||||
@@ -233,7 +233,7 @@ export default function DouyuCollabShopModal({
|
||||
canManage ? (
|
||||
<Popconfirm
|
||||
title={`删除店铺「${row.name}」?`}
|
||||
description="仍有协作单使用该店铺时会被拒绝,避免误删历史归属"
|
||||
description="仍有预售单使用该店铺时会被拒绝,避免误删历史归属"
|
||||
onConfirm={() => void remove(row)}
|
||||
disabled={busy}
|
||||
>
|
||||
@@ -257,7 +257,7 @@ export default function DouyuCollabShopModal({
|
||||
>
|
||||
<Space direction="vertical" size={10} style={{ width: '100%' }}>
|
||||
<Text type="secondary">
|
||||
先在这里定义店铺,新建协作单时可以直接点选。停用只是不再出现在新建选择里,历史订单不受影响;
|
||||
先在这里定义店铺,新建预售单时可以直接点选。停用不再出现在新建选择里,历史订单不受影响;
|
||||
完整名称/别名只按这里手工维护的映射归并平台同步店铺;筛选仍使用规范简称。
|
||||
重命名会自动同步已有订单,已有订单仍在使用的店铺不能删除。
|
||||
</Text>
|
||||
@@ -306,7 +306,7 @@ export default function DouyuCollabShopModal({
|
||||
onChange={(event) => setRenameValue(event.target.value)}
|
||||
onPressEnter={() => void submitRename()}
|
||||
/>
|
||||
<Text type="secondary">保存后会同时更新已有协作单上的店铺名。</Text>
|
||||
<Text type="secondary">保存后会同时更新已有预售单上的店铺名。</Text>
|
||||
</Space>
|
||||
</Modal>
|
||||
</>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/**
|
||||
* 新建协作单时的「主页截图」上传(先传 OSS 拿 object_key,随表单一起提交)。
|
||||
* 新建预售单时的「主页截图」上传(先传 OSS 拿 object_key,随表单一起提交)。
|
||||
*
|
||||
* - 第一张就是封面(列表和详情都按第一张当封面);
|
||||
* - 新建时还没落库,所以预览用的地址来自上传接口返回的 thumbnail_url / url;
|
||||
* - 放进 `Form.Item name="home_images"`,值就是 object_key 数组;
|
||||
* - 放进 `Form.Item name="home_images"`,值通常是 object_key 数组;
|
||||
* - 从 order_site 同步来的图片已是绝对 URL,编辑时直接按原地址预览。
|
||||
* - 支持点击选择、拖拽,以及剪贴板里的截图直接 Ctrl/Cmd+V 粘贴。
|
||||
*/
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
@@ -22,6 +23,12 @@ const ACCEPT_ATTR = ACCEPTED_IMAGE_TYPES.join(',');
|
||||
|
||||
type Preview = Pick<FileUploadResult, 'url' | 'thumbnail_url'>;
|
||||
|
||||
function imagePreviewUrl(value: string, variant = ''): string {
|
||||
if (value.startsWith('/') || /^https?:\/\//i.test(value)) return value;
|
||||
const suffix = variant ? `&variant=${encodeURIComponent(variant)}` : '';
|
||||
return `/api/files/object?key=${encodeURIComponent(value)}${suffix}`;
|
||||
}
|
||||
|
||||
/** 从剪贴板里取图片文件;items 拿不到时退回 files。 */
|
||||
function clipboardImageFiles(data: DataTransfer | null): File[] {
|
||||
if (!data) return [];
|
||||
@@ -146,7 +153,7 @@ export default function HuyaCollabHomeImageUploader({
|
||||
</Text>
|
||||
) : (
|
||||
<Image.PreviewGroup
|
||||
items={keys.map((key) => previews[key]?.url || `/api/files/object?key=${encodeURIComponent(key)}`)}
|
||||
items={keys.map((key) => previews[key]?.url || imagePreviewUrl(key))}
|
||||
>
|
||||
<Space wrap size={12}>
|
||||
{keys.map((key, index) => (
|
||||
@@ -156,7 +163,7 @@ export default function HuyaCollabHomeImageUploader({
|
||||
src={
|
||||
previews[key]?.thumbnail_url
|
||||
|| previews[key]?.url
|
||||
|| `/api/files/object?key=${encodeURIComponent(key)}&variant=thumb`
|
||||
|| imagePreviewUrl(key, 'thumb')
|
||||
}
|
||||
width={88}
|
||||
height={88}
|
||||
|
||||
@@ -21,7 +21,7 @@ html[data-theme='dark'] body {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* 新建协作单弹窗:表单项间距压紧一点,配合紧凑布局尽量不出现滚动条 */
|
||||
/* 新建预售单弹窗:表单项间距压紧一点,配合紧凑布局尽量不出现滚动条 */
|
||||
.huya-collab-create .ant-form-item {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
@@ -74,9 +74,6 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) {
|
||||
if (can('cookie:view')) {
|
||||
douyuItems.push({ key: '/cookies', label: 'Cookie 管理', icon: <KeyOutlined /> });
|
||||
}
|
||||
if (can('cookie:operate')) {
|
||||
douyuItems.push({ key: '/cookie-operations', label: 'CK 检测与重登', icon: <SafetyCertificateOutlined /> });
|
||||
}
|
||||
if (can('automation:view')) {
|
||||
douyuItems.push({ key: '/automation', label: '斗鱼自动化', icon: <RobotOutlined /> });
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ const EVENT_STYLE: Record<string, { label: string; color: string }> = {
|
||||
task_stopped: { label: '任务停止', color: 'orange' },
|
||||
query_completed: { label: '查询完成', color: 'blue' },
|
||||
lease_acquired: { label: '账号占用', color: 'cyan' },
|
||||
collab_synced: { label: '外部协作同步', color: 'geekblue' },
|
||||
collab_synced: { label: '预售台账同步', color: 'geekblue' },
|
||||
lease_released: { label: '账号释放', color: 'default' },
|
||||
};
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ const JOB_UI: Record<string, JobUiSpec> = {
|
||||
showConcurrency: false,
|
||||
},
|
||||
lease_ck_refresh: {
|
||||
description: "对仍有效、但预测 24 小时内到期的履约保护账号提前登录续 CK;覆盖预售、协作单和生效租约。",
|
||||
description: "对仍有效、但预测 24 小时内到期的履约保护账号提前登录续 CK;覆盖预售台账和生效租约。",
|
||||
core: true,
|
||||
showRecheck: false,
|
||||
showConcurrency: true,
|
||||
@@ -714,7 +714,7 @@ export default function AutomationPage() {
|
||||
showIcon
|
||||
style={{ marginBottom: 12 }}
|
||||
message="严格按 P0 > P1 > P2 > P3 > P4 顺序预留与调度"
|
||||
description="当剩余小时/日配额紧张时,低优先级类别会自动为高优先级类别让路;其中 P0/P1 涵盖预售、协作单和生效租约全部履约保护目标。"
|
||||
description="当剩余小时/日配额紧张时,低优先级类别会自动为高优先级类别让路;其中 P0/P1 涵盖预售台账和生效租约全部履约保护目标。"
|
||||
/>
|
||||
<Table
|
||||
rowKey="category"
|
||||
|
||||
@@ -1,312 +0,0 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Button, Input, Popconfirm, Select, Space, Table, Tag, Typography } from 'antd';
|
||||
import { message } from '../utils/antdMessage';
|
||||
import { LoadingOutlined, ReloadOutlined, SearchOutlined, StopOutlined } from '@ant-design/icons';
|
||||
import { cookieApi, type CookieOperationCheckResult, type CookieOperationItem } from '../api/modules';
|
||||
import { formatTime } from '../utils/time';
|
||||
import { getErrorMessage } from '../utils/error';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
export default function CookieOperationsPage() {
|
||||
const [items, setItems] = useState<CookieOperationItem[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [search, setSearch] = useState('');
|
||||
const [tagFilter, setTagFilter] = useState('');
|
||||
const [tags, setTags] = useState<string[]>([]);
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
const [checkingIds, setCheckingIds] = useState<Set<number>>(new Set());
|
||||
const [reloginIds, setReloginIds] = useState<Set<number>>(new Set());
|
||||
const [checkResults, setCheckResults] = useState<Map<number, CookieOperationCheckResult>>(new Map());
|
||||
const [total, setTotal] = useState(0);
|
||||
const [pageSize, setPageSize] = useState(() => {
|
||||
const value = localStorage.getItem('cookie_operations_page_size');
|
||||
return value ? Number(value) || 20 : 20;
|
||||
});
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
|
||||
const loadItems = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const data = await cookieApi.listOperations({
|
||||
page: currentPage,
|
||||
page_size: pageSize,
|
||||
search: search.trim() || undefined,
|
||||
tag: tagFilter || undefined,
|
||||
});
|
||||
setItems(data.items);
|
||||
setTotal(data.total);
|
||||
setCheckResults((previous) => {
|
||||
const next = new Map(previous);
|
||||
for (const item of data.items) {
|
||||
if (!item.ck_check_status) continue;
|
||||
next.set(item.id, {
|
||||
id: item.id,
|
||||
valid: item.ck_check_status === 'valid',
|
||||
checked_at: item.ck_checked_at ?? '',
|
||||
});
|
||||
}
|
||||
return next;
|
||||
});
|
||||
} catch (error: unknown) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [currentPage, pageSize, search, tagFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
void loadItems();
|
||||
}, [loadItems]);
|
||||
|
||||
const hasActiveRelogin = items.some((item) => (
|
||||
item.relogin_status === 'relogin_pending' || item.relogin_status === 'relogin_running'
|
||||
));
|
||||
const activeReloginBatchIds = Array.from(new Set(items
|
||||
.filter((item) => item.relogin_status === 'relogin_pending' || item.relogin_status === 'relogin_running')
|
||||
.map((item) => item.relogin_batch_id)
|
||||
.filter(Boolean)));
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasActiveRelogin) return;
|
||||
const timer = window.setInterval(() => void loadItems(), 2000);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [hasActiveRelogin, loadItems]);
|
||||
|
||||
useEffect(() => {
|
||||
cookieApi.listOperationTags().then(setTags).catch(() => {
|
||||
// 标签加载失败不影响 CK 检测与重登。
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleCheck = async (ids: number[]) => {
|
||||
if (ids.length === 0) return;
|
||||
setCheckingIds((previous) => new Set([...previous, ...ids]));
|
||||
try {
|
||||
const response = await cookieApi.checkOperations(ids);
|
||||
setCheckResults((previous) => {
|
||||
const next = new Map(previous);
|
||||
response.results.forEach((item) => next.set(item.id, item));
|
||||
return next;
|
||||
});
|
||||
message.success(`检测完成:${response.results.filter((item) => item.valid).length}/${response.results.length} 条有效`);
|
||||
void loadItems();
|
||||
} catch (error: unknown) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setCheckingIds((previous) => {
|
||||
const next = new Set(previous);
|
||||
ids.forEach((id) => next.delete(id));
|
||||
return next;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleRelogin = async (ids: number[]) => {
|
||||
if (ids.length === 0) return;
|
||||
setReloginIds((previous) => new Set([...previous, ...ids]));
|
||||
try {
|
||||
const response = await cookieApi.reloginOperations(ids);
|
||||
const skipped = response.skipped ? `,${response.skipped} 条因缺少登录凭据跳过` : '';
|
||||
message.success(`已开始重登 ${response.count} 个账号${skipped}`);
|
||||
setSelectedRowKeys([]);
|
||||
window.setTimeout(() => void loadItems(), 1000);
|
||||
} catch (error: unknown) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setReloginIds((previous) => {
|
||||
const next = new Set(previous);
|
||||
ids.forEach((id) => next.delete(id));
|
||||
return next;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleReloginInvalid = async () => {
|
||||
try {
|
||||
const response = await cookieApi.reloginInvalidOperations({
|
||||
search: search.trim() || undefined,
|
||||
tag: tagFilter || undefined,
|
||||
});
|
||||
const skipped = response.skipped ? `,${response.skipped} 条因缺少登录凭据跳过` : '';
|
||||
message.success(`已开始重登 ${response.count} 个失效账号${skipped}`);
|
||||
setSelectedRowKeys([]);
|
||||
void loadItems();
|
||||
} catch (error: unknown) {
|
||||
message.error(getErrorMessage(error));
|
||||
}
|
||||
};
|
||||
|
||||
const handleStopRelogin = async () => {
|
||||
if (activeReloginBatchIds.length === 0) return;
|
||||
try {
|
||||
await Promise.all(activeReloginBatchIds.map((batchId) => cookieApi.stopOperationRelogin(batchId)));
|
||||
message.success('已发送停止信号');
|
||||
void loadItems();
|
||||
} catch (error: unknown) {
|
||||
message.error(getErrorMessage(error));
|
||||
}
|
||||
};
|
||||
|
||||
const resultFor = (item: CookieOperationItem) => checkResults.get(item.id);
|
||||
const selectedIds = selectedRowKeys.map((key) => Number(key));
|
||||
const reloginStatus = (item: CookieOperationItem) => {
|
||||
if (item.relogin_status === 'relogin_pending') return <Tag color="processing">重登排队中</Tag>;
|
||||
if (item.relogin_status === 'relogin_running') return <Tag color="processing" icon={<LoadingOutlined />}>重登中</Tag>;
|
||||
if (item.relogin_status === 'relogin_failed') return <Tag color="error">重登失败</Tag>;
|
||||
if (item.relogin_message.startsWith('重新登录成功')) return <Tag color="success">重登成功</Tag>;
|
||||
return <Text type="secondary">-</Text>;
|
||||
};
|
||||
const columns = [
|
||||
{ title: '账号', dataIndex: 'account_username', ellipsis: true },
|
||||
{
|
||||
title: '标签',
|
||||
dataIndex: 'tag',
|
||||
width: 140,
|
||||
ellipsis: true,
|
||||
render: (tag: string) => tag ? <Tag color="blue">{tag}</Tag> : <Text type="secondary">-</Text>,
|
||||
},
|
||||
{
|
||||
title: '有效性',
|
||||
width: 110,
|
||||
render: (_: unknown, item: CookieOperationItem) => {
|
||||
if (checkingIds.has(item.id)) return <Tag color="processing" icon={<LoadingOutlined />}>检测中</Tag>;
|
||||
const result = resultFor(item);
|
||||
if (!result) return <Text type="secondary">未检测</Text>;
|
||||
return <Tag color={result.valid ? 'success' : 'error'}>{result.valid ? '有效' : '无效'}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '检测时间',
|
||||
width: 180,
|
||||
render: (_: unknown, item: CookieOperationItem) => {
|
||||
const checkedAt = resultFor(item)?.checked_at || item.ck_checked_at;
|
||||
return checkedAt ? formatTime(checkedAt) : <Text type="secondary">-</Text>;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '重登状态',
|
||||
width: 130,
|
||||
render: (_: unknown, item: CookieOperationItem) => (
|
||||
<Space direction="vertical" size={0}>
|
||||
{reloginStatus(item)}
|
||||
{item.relogin_status === 'relogin_failed' && item.relogin_message ? (
|
||||
<Text type="secondary" ellipsis style={{ maxWidth: 180, fontSize: 12 }} title={item.relogin_message}>
|
||||
{item.relogin_message}
|
||||
</Text>
|
||||
) : null}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 190,
|
||||
render: (_: unknown, item: CookieOperationItem) => (
|
||||
<Space size={4}>
|
||||
<Button
|
||||
size="small"
|
||||
loading={checkingIds.has(item.id)}
|
||||
disabled={checkingIds.has(item.id) || item.relogin_status === 'relogin_pending' || item.relogin_status === 'relogin_running'}
|
||||
onClick={() => void handleCheck([item.id])}
|
||||
>
|
||||
检测
|
||||
</Button>
|
||||
<Popconfirm title="将使用已保存的账号信息重新登录并替换 CK,确认继续?" onConfirm={() => void handleRelogin([item.id])}>
|
||||
<Button
|
||||
size="small"
|
||||
icon={<ReloadOutlined />}
|
||||
loading={reloginIds.has(item.id)}
|
||||
disabled={reloginIds.has(item.id) || item.relogin_status === 'relogin_pending' || item.relogin_status === 'relogin_running'}
|
||||
>
|
||||
重登
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div style={{ marginBottom: 16, display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: 12 }}>
|
||||
<h2 style={{ margin: 0 }}>CK 检测与重登</h2>
|
||||
<Space wrap>
|
||||
<Button loading={checkingIds.size > 0} disabled={selectedIds.length === 0} onClick={() => void handleCheck(selectedIds)}>
|
||||
检测选中 {selectedIds.length > 0 ? `(${selectedIds.length})` : ''}
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title={`将重新登录选中的 ${selectedIds.length} 个账号并替换 CK,确认继续?`}
|
||||
disabled={selectedIds.length === 0}
|
||||
onConfirm={() => void handleRelogin(selectedIds)}
|
||||
>
|
||||
<Button icon={<ReloadOutlined />} disabled={selectedIds.length === 0}>
|
||||
重登选中 {selectedIds.length > 0 ? `(${selectedIds.length})` : ''}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
<Popconfirm
|
||||
title="将重新登录当前筛选范围内所有已检测为无效的账号,并在成功后替换旧 CK,确认继续?"
|
||||
onConfirm={() => void handleReloginInvalid()}
|
||||
>
|
||||
<Button icon={<ReloadOutlined />}>
|
||||
批量重登失效账号
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{activeReloginBatchIds.length > 0 ? (
|
||||
<Popconfirm title="确认停止当前重登任务?旧 CK 会保留。" onConfirm={() => void handleStopRelogin()}>
|
||||
<Button danger icon={<StopOutlined />}>停止重登</Button>
|
||||
</Popconfirm>
|
||||
) : null}
|
||||
</Space>
|
||||
</div>
|
||||
<Space wrap style={{ marginBottom: 12 }}>
|
||||
<Select
|
||||
allowClear
|
||||
showSearch
|
||||
placeholder="按标签筛选"
|
||||
style={{ width: 160 }}
|
||||
value={tagFilter || undefined}
|
||||
onChange={(value) => {
|
||||
setTagFilter(value || '');
|
||||
setCurrentPage(1);
|
||||
setSelectedRowKeys([]);
|
||||
}}
|
||||
options={tags.map((tag) => ({ value: tag, label: tag }))}
|
||||
/>
|
||||
<Input.Search
|
||||
allowClear
|
||||
prefix={<SearchOutlined />}
|
||||
placeholder="搜索账号或标签"
|
||||
style={{ width: 280 }}
|
||||
value={search}
|
||||
onChange={(event) => {
|
||||
setSearch(event.target.value);
|
||||
setCurrentPage(1);
|
||||
setSelectedRowKeys([]);
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
<Table
|
||||
rowKey="id"
|
||||
size="small"
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={items}
|
||||
rowSelection={{ selectedRowKeys, onChange: setSelectedRowKeys, preserveSelectedRowKeys: true }}
|
||||
pagination={{
|
||||
current: currentPage,
|
||||
pageSize,
|
||||
total,
|
||||
showSizeChanger: true,
|
||||
showTotal: (count) => `共 ${count} 条`,
|
||||
onChange: (page, size) => {
|
||||
setCurrentPage(size === pageSize ? page : 1);
|
||||
if (size !== pageSize) {
|
||||
setPageSize(size);
|
||||
localStorage.setItem('cookie_operations_page_size', String(size));
|
||||
}
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -656,13 +656,13 @@ export default function DouyuCollabPage() {
|
||||
if (updated.status === 'incomplete' && updated.missing_fields?.length) {
|
||||
message.warning(`资料已保存,但仍缺:${updated.missing_fields.join('、')}`);
|
||||
} else if (editing.status === 'incomplete') {
|
||||
message.success('资料已补齐,协作单已自动进入待充值');
|
||||
message.success('资料已补齐,预售单已自动进入待充值');
|
||||
} else {
|
||||
message.success('协作单已更新');
|
||||
message.success('预售单已更新');
|
||||
}
|
||||
} else {
|
||||
message.success(
|
||||
updated.status === 'incomplete' ? '已创建待补资料协作单' : '协作单已创建',
|
||||
updated.status === 'incomplete' ? '已创建待补资料预售单' : '预售单已创建',
|
||||
);
|
||||
}
|
||||
setCreateOpen(false);
|
||||
@@ -678,7 +678,7 @@ export default function DouyuCollabPage() {
|
||||
setSubmitting(false);
|
||||
modal.confirm({
|
||||
title: '平台履约账号需要转人工',
|
||||
content: `${getErrorMessage(error)}。确认后平台履约任务会转为人工,并由当前协作单接管账号。`,
|
||||
content: `${getErrorMessage(error)}。确认后平台履约任务会转为人工,并由当前预售单接管账号。`,
|
||||
okText: '确认接管并转人工',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
@@ -935,7 +935,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const openBatchStatus = () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setStatusTarget(null);
|
||||
@@ -1010,7 +1010,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const batchQueryBalances = async () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setBalanceQuerying(true);
|
||||
@@ -1028,7 +1028,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const batchQueryRecords = async () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setRecordQuerying(true);
|
||||
@@ -1049,7 +1049,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const batchVerify = async () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -1084,7 +1084,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const openCkExport = async () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setCkExporting(true);
|
||||
@@ -1114,7 +1114,7 @@ export default function DouyuCollabPage() {
|
||||
}
|
||||
};
|
||||
|
||||
/** 单行复制:斗鱼协作单不存 CK,这里实时读取关联内部账号的 cookie。 */
|
||||
/** 单行复制:斗鱼预售单不存 CK,这里实时读取关联内部账号的 cookie。 */
|
||||
const copyOneCk = async (row: DouyuCollabOrder) => {
|
||||
setCkCopyingId(row.id);
|
||||
try {
|
||||
@@ -1147,7 +1147,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const openUsernameExport = async () => {
|
||||
if (selectedIds.length === 0) {
|
||||
message.warning('请先勾选协作单');
|
||||
message.warning('请先勾选预售单');
|
||||
return;
|
||||
}
|
||||
setUsernameExporting(true);
|
||||
@@ -1241,7 +1241,7 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const deleteOrder = (order: DouyuCollabOrder) => {
|
||||
modal.confirm({
|
||||
title: `删除协作单 ${order.order_no}?`,
|
||||
title: `删除预售单 ${order.order_no}?`,
|
||||
content: '只删除这一行台账,不会删除内部斗鱼账号,也不会清理已上传图片。',
|
||||
okButtonProps: { danger: true },
|
||||
onOk: async () => {
|
||||
@@ -2039,7 +2039,7 @@ export default function DouyuCollabPage() {
|
||||
)}
|
||||
{canEdit && (
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={openCreate}>
|
||||
新建协作单
|
||||
新建预售单
|
||||
</Button>
|
||||
)}
|
||||
</Space>
|
||||
@@ -2151,7 +2151,7 @@ export default function DouyuCollabPage() {
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={editing ? `编辑协作单 ${editing.order_no}` : '新建协作单'}
|
||||
title={editing ? `编辑预售单 ${editing.order_no}` : '新建预售单'}
|
||||
open={createOpen}
|
||||
width={820}
|
||||
onCancel={() => setCreateOpen(false)}
|
||||
@@ -2431,7 +2431,7 @@ export default function DouyuCollabPage() {
|
||||
type="warning"
|
||||
showIcon
|
||||
message={`将解除账号「${form.account_username || '-'}」与本单的关联`}
|
||||
description="不会删除内部账号。账号身份、角色、鱼翅和积分快照会清空,订单回到待补资料;如果账号仍被履约任务或其他活动协作单占用,不会释放其租约。"
|
||||
description="不会删除内部账号。账号身份、角色、鱼翅和积分快照会清空,订单回到待补资料;如果账号仍被履约任务或其他预售单占用,不会释放其租约。"
|
||||
/>
|
||||
<Input.TextArea
|
||||
rows={3}
|
||||
@@ -2468,7 +2468,7 @@ export default function DouyuCollabPage() {
|
||||
type="info"
|
||||
showIcon
|
||||
message="推荐结果不会预占账号"
|
||||
description="选择后会再次实时校验 CK、租约、活动协作单和换绑冷却。未绑定账号优先;关闭下方开关后只搜索未绑定账号。"
|
||||
description="选择后会再次实时校验 CK、租约、活动预售单和换绑冷却。未绑定账号优先;关闭下方开关后只搜索未绑定账号。"
|
||||
/>
|
||||
<Space>
|
||||
<Switch
|
||||
@@ -2734,7 +2734,7 @@ export default function DouyuCollabPage() {
|
||||
type="warning"
|
||||
showIcon
|
||||
message="账号、密码、CK 都是凭据"
|
||||
description="格式与「CK 管理」一致:账号----密码----CK,每行一条。斗鱼协作单不存 CK,这里导出的是关联内部账号当前的 CK。复制后请勿发群 / 截图外传;每次导出都会写审计,审计里不存凭据本体。"
|
||||
description="格式与「CK 管理」一致:账号----密码----CK,每行一条。斗鱼预售单不存 CK,这里导出的是关联内部账号当前的 CK。复制后请勿发群 / 截图外传;每次导出都会写审计,审计里不存凭据本体。"
|
||||
/>
|
||||
{ckExport && ckExport.skipped.length > 0 && (
|
||||
<Text type="warning" style={{ fontSize: 12 }}>
|
||||
@@ -2791,7 +2791,7 @@ export default function DouyuCollabPage() {
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
'协作单详情'
|
||||
'预售单详情'
|
||||
)
|
||||
}
|
||||
open={detailOpen}
|
||||
|
||||
@@ -144,7 +144,7 @@ export const CK_META: Record<string, { label: string; color: string }> = {
|
||||
};
|
||||
|
||||
export const COLLAB_ACTION_LABELS: Record<string, string> = {
|
||||
'douyu:collab:create': '新建协作单',
|
||||
'douyu:collab:create': '新建预售单',
|
||||
'douyu:collab:update': '编辑订单资料',
|
||||
'douyu:collab:account': '更换账号',
|
||||
'douyu:collab:account_unlink': '解除账号关联',
|
||||
@@ -250,7 +250,7 @@ export const COLLAB_DETAIL_VALUE_LABELS: Record<string, string> = {
|
||||
balance_batch: '批量查询鱼翅与积分',
|
||||
batch: '批量查询',
|
||||
platform_fulfillment: '直播账号履约',
|
||||
douyu_collab: '外部单协作',
|
||||
douyu_collab: '斗鱼预售台账',
|
||||
};
|
||||
|
||||
export const COLLAB_DETAIL_PREFERRED_KEYS = Object.keys(COLLAB_DETAIL_LABELS);
|
||||
|
||||
@@ -333,7 +333,7 @@ function eventDescription(event: { eventType: string; detail: Record<string, unk
|
||||
eligible ? `具备资格账号 ${eligible}` : '',
|
||||
roleCooldown ? `换绑冷却 ${roleCooldown}` : '',
|
||||
leased ? `任务租约占用 ${leased}` : '',
|
||||
collab ? `协作单占用 ${collab}` : '',
|
||||
collab ? `预售台账占用 ${collab}` : '',
|
||||
].filter(Boolean);
|
||||
return summary.length
|
||||
? `${summary.join(';')},当前没有空闲账号`
|
||||
|
||||
@@ -16,7 +16,7 @@ const { Text } = Typography;
|
||||
|
||||
const SUPPLY_ROLE_LABELS: Record<string, string> = {
|
||||
fulfillment_protected: '履约保护',
|
||||
collab_protected: '协作保护',
|
||||
collab_protected: '预售台账保护',
|
||||
onboarding: '待首次登录',
|
||||
repair: '待重登',
|
||||
supply_high: '高价值供给',
|
||||
|
||||
@@ -671,7 +671,7 @@ export default function AccountPlatformStatusPanel() {
|
||||
<Space orientation="vertical" size={2} style={{ width: '100%', marginTop: 20 }}>
|
||||
<Text strong>履约保护目标</Text>
|
||||
<Text type="secondary">
|
||||
保持预售与外部协作单绑定账号的 CK 有效,失效后优先进入自动重登队列
|
||||
保持预售及预售台账绑定账号的 CK 有效,失效后优先进入自动重登队列
|
||||
</Text>
|
||||
</Space>
|
||||
<Table
|
||||
|
||||
Reference in New Issue
Block a user