feat(fulfillment): 自动选号并补充精英宝典操作

- 增加直播履约自动选号 worker、重试与任务扫描
- 履约详情复用斗鱼任务能力开通宝典、充值和兑换皮肤
- 补充自动选号与精英宝典操作测试
This commit is contained in:
yml
2026-11-18 10:59:20 +08:00
parent bba3d9dac9
commit 8ba6379687
6 changed files with 501 additions and 6 deletions
+62
View File
@@ -524,6 +524,68 @@ class TestBindingAndCompletion(_Base):
assert detail["task"]["issueCode"] == ""
assert detail["task"]["lastError"] == ""
def test_refresh_binding_classifies_customer_role_cooldown(self):
task = self._allocated()
bind_task = DouyuTask(
batch_id="bind-customer-cooldown",
account_id=task.account_id,
account_assigned_to=self.admin_id,
task_type="confirm_bind",
handbook_scope="elite",
status="failed",
message="待绑定游戏账号(测试角色)未到换绑时间,请重新换账号扫码绑定",
result={
"bind_phase": "confirm_failed",
"role_name": "测试角色",
"bind_ready_for_confirm": True,
"bind_confirmed": False,
},
created_by=self.admin_id,
)
self.session.add(bind_task)
self.session.flush()
task.bind_task_id = bind_task.id
task.binding_status = "role_ready"
task.execution_status = "role_ready"
self.session.commit()
detail = service.refresh_binding(self.session, task_id=task.id)
assert detail["task"]["issueCode"] == "customer_role_cooldown"
assert detail["task"]["bindingStatus"] == "failed"
assert detail["task"]["executionStatus"] == "manual_required"
assert "截图" in detail["task"]["lastError"]
assert "联系客服" in detail["task"]["lastError"]
def test_refresh_binding_classifies_account_role_cooldown(self):
task = self._allocated()
bind_task = DouyuTask(
batch_id="bind-account-cooldown",
account_id=task.account_id,
account_assigned_to=self.admin_id,
task_type="get_bind_qr",
handbook_scope="elite",
status="failed",
message="当前角色 暂不能换绑,剩余 3天",
result={
"bind_phase": "change_waiting",
"change_role_wait_time": 259200,
},
created_by=self.admin_id,
)
self.session.add(bind_task)
self.session.flush()
task.bind_task_id = bind_task.id
task.binding_status = "preparing"
task.execution_status = "waiting_bind"
self.session.commit()
detail = service.refresh_binding(self.session, task_id=task.id)
assert detail["task"]["issueCode"] == "account_role_cooldown"
assert detail["task"]["executionStatus"] == "manual_required"
assert "截图" in detail["task"]["lastError"]
def test_list_hides_qr_but_detail_returns_it(self):
task = self._allocated()
bind_task = DouyuTask(