From b57fe16e0c527f07167e577fc238671eed0ca670 Mon Sep 17 00:00:00 2001 From: yml Date: Sun, 22 Nov 2026 01:08:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(douyu):=20=E4=BF=AE=E5=A4=8D=E4=BE=9B?= =?UTF-8?q?=E7=BB=99=E7=9B=AE=E6=A0=87=E7=BC=BA=E5=B0=91=20target=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_account_supply_service.py | 2 ++ web/backend/routers/douyu.py | 1 + web/backend/schemas.py | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tests/test_account_supply_service.py b/tests/test_account_supply_service.py index b3e8186..0efd961 100644 --- a/tests/test_account_supply_service.py +++ b/tests/test_account_supply_service.py @@ -218,8 +218,10 @@ def test_supply_target_configuration_route_returns_inventory(db): listed = list_supply_targets(db=db, current=user) assert created.id > 0 + assert created.target_id == created.id assert created.covered_shortage == 12 assert listed[0].id == created.id + assert listed[0].target_id == created.id assert listed[0].needs_replenishment is True diff --git a/web/backend/routers/douyu.py b/web/backend/routers/douyu.py index b92aa3f..27b5fc6 100644 --- a/web/backend/routers/douyu.py +++ b/web/backend/routers/douyu.py @@ -698,6 +698,7 @@ def _supply_target_out( inventory = evaluate_supply_target(db, target) return DouyuSupplyTargetOut( id=int(target.id), + target_id=int(target.id), platform=target.platform, scope=target.scope, commodity_id=target.commodity_id, diff --git a/web/backend/schemas.py b/web/backend/schemas.py index 0118998..c400b9d 100644 --- a/web/backend/schemas.py +++ b/web/backend/schemas.py @@ -1603,6 +1603,8 @@ class DouyuSupplyTargetUpdate(BaseModel): class DouyuSupplyTargetOut(BaseModel): id: int + # 2026-11-22:平台状态接口使用 target_id,配置列表使用 id;同时返回兼容两者。 + target_id: int platform: str scope: str commodity_id: str