fix(fulfillment): 对齐客户确认状态并展示角色接口日志
- 客户页 bindReadyForConfirm 与平台任务 role_ready 对齐 - 详情返回 douyu_role_api_logs 最近 40 条 - 详情页增加角色接口日志诊断表 - 补充客户确认、日志读取回归测试 - 文档记录 11.22 成功 HAR 与角色日志时间线
This commit is contained in:
@@ -21,6 +21,7 @@ from web.backend.models import (
|
||||
AutomationJob,
|
||||
DouyuExternalOrder,
|
||||
DouyuGoodsSnapshot,
|
||||
DouyuRoleApiLog,
|
||||
DouyuTask,
|
||||
IntegrationOutbox,
|
||||
PlatformCommodityMapping,
|
||||
@@ -2913,6 +2914,57 @@ class TestBindingAndCompletion(_Base):
|
||||
assert evidence["targetRole"] == "同对角色"
|
||||
assert evidence["confirmable"] is False
|
||||
|
||||
def test_task_detail_includes_binding_role_api_logs(self):
|
||||
task = self._allocated()
|
||||
qr_task = DouyuTask(
|
||||
batch_id="role-log-qr",
|
||||
account_id=task.account_id,
|
||||
account_assigned_to=self.admin_id,
|
||||
task_type="get_bind_qr",
|
||||
handbook_scope="elite",
|
||||
status="success",
|
||||
platform_task_id=task.id,
|
||||
result={"bind_ready_for_confirm": True, "bind_phase": "role_ready"},
|
||||
created_by=self.admin_id,
|
||||
)
|
||||
self.session.add(qr_task)
|
||||
self.session.flush()
|
||||
task.bind_task_id = qr_task.id
|
||||
task.binding_status = "role_ready"
|
||||
task.execution_status = "role_ready"
|
||||
self.session.add(
|
||||
DouyuRoleApiLog(
|
||||
account_id=task.account_id,
|
||||
task_id=qr_task.id,
|
||||
scope="elite",
|
||||
stage="binding_poll.legacy_changed",
|
||||
source="douyu_task.get_bind_qr",
|
||||
act_alias="cjm",
|
||||
role_name="雨佑佑",
|
||||
area_name="手Q",
|
||||
plat_name="苹果(iOS)",
|
||||
is_bound_act=False,
|
||||
is_bound_role=True,
|
||||
need_bind_act=False,
|
||||
need_bind_role=True,
|
||||
change_role_wait_time=0,
|
||||
response_json={"error": 0, "msg": "请求正常"},
|
||||
created_at=NOW,
|
||||
)
|
||||
)
|
||||
self.session.commit()
|
||||
|
||||
detail = service.get_task_detail(self.session, task.id)
|
||||
|
||||
assert detail["bindingLogs"]
|
||||
log = detail["bindingLogs"][0]
|
||||
assert log["stage"] == "binding_poll.legacy_changed"
|
||||
assert log["actAlias"] == "cjm"
|
||||
assert log["roleName"] == "雨佑佑"
|
||||
assert log["bindAct"] is False
|
||||
assert log["error"] == 0
|
||||
assert log["message"] == "请求正常"
|
||||
|
||||
def test_binding_evidence_does_not_treat_baseline_as_scanned(self):
|
||||
task = self._allocated()
|
||||
account = self.session.get(Account, task.account_id)
|
||||
|
||||
Reference in New Issue
Block a user