feat: 重做协作台账状态机并支持充值核账
This commit is contained in:
+56
-2
@@ -1141,7 +1141,7 @@ class HuyaCollabBuyerOrderOut(BaseModel):
|
||||
shop: str = ""
|
||||
gift_name: str = ""
|
||||
uid: str = ""
|
||||
status: str = "pending"
|
||||
status: str = "incomplete"
|
||||
status_label: str = ""
|
||||
created_at: datetime | None = None
|
||||
|
||||
@@ -1183,6 +1183,7 @@ class HuyaExternalOrderCreate(BaseModel):
|
||||
ck_text: str = ""
|
||||
bind_douyu_account: str = Field("", max_length=128)
|
||||
gift_name: str = Field("", max_length=128)
|
||||
required_points: int | None = Field(None, ge=0)
|
||||
# 主页截图(object_key 数组,第一张作封面)。绑定图不再收:绑定关系由探针自动读,
|
||||
# 人工截图没有意义(2026-10-16 用户拍板)。
|
||||
home_images: list[str] = Field(default_factory=list)
|
||||
@@ -1198,6 +1199,7 @@ class HuyaExternalOrderUpdate(BaseModel):
|
||||
bind_douyu_account: str | None = Field(None, max_length=128)
|
||||
bind_douyu_uid: str | None = Field(None, max_length=32)
|
||||
gift_name: str | None = Field(None, max_length=128)
|
||||
required_points: int | None = Field(None, ge=0)
|
||||
remark: str | None = Field(None, max_length=512)
|
||||
# 乐观锁:客户端拿到的版本号。不一致说明别人先改了 → 409。
|
||||
expected_version: int | None = None
|
||||
@@ -1325,6 +1327,49 @@ class HuyaExternalOrderStatusBatchOut(BaseModel):
|
||||
results: list[HuyaExternalOrderStatusBatchItemOut] = Field(default_factory=list)
|
||||
|
||||
|
||||
class HuyaExternalOrderRechargeRequest(BaseModel):
|
||||
"""充值核账请求:按绑定账号整组核账,阈值默认 100。"""
|
||||
|
||||
ids: list[int] = Field(default_factory=list)
|
||||
threshold: int = Field(100, ge=0, le=1_000_000)
|
||||
|
||||
|
||||
class HuyaExternalOrderRechargeOrderOut(BaseModel):
|
||||
id: int
|
||||
order_no: str = ""
|
||||
status: str = ""
|
||||
status_label: str = ""
|
||||
|
||||
|
||||
class HuyaExternalOrderRechargeGroupOut(BaseModel):
|
||||
group_key: str = ""
|
||||
status: str = ""
|
||||
status_label: str = ""
|
||||
balance: int | None = None
|
||||
required_total: int | None = None
|
||||
surplus: int | None = None
|
||||
threshold: int = 100
|
||||
reason: str = ""
|
||||
message: str = ""
|
||||
order_ids: list[int] = Field(default_factory=list)
|
||||
orders: list[HuyaExternalOrderRechargeOrderOut] = Field(default_factory=list)
|
||||
|
||||
|
||||
class HuyaExternalOrderRechargeFailureOut(BaseModel):
|
||||
id: int
|
||||
order_no: str = ""
|
||||
message: str = ""
|
||||
|
||||
|
||||
class HuyaExternalOrderRechargeOut(BaseModel):
|
||||
total: int
|
||||
updated: int
|
||||
failed: int
|
||||
threshold: int = 100
|
||||
groups: list[HuyaExternalOrderRechargeGroupOut] = Field(default_factory=list)
|
||||
failures: list[HuyaExternalOrderRechargeFailureOut] = Field(default_factory=list)
|
||||
|
||||
|
||||
class HuyaExternalOrderArchiveItemOut(BaseModel):
|
||||
"""归档/取消归档里的一行结论。"""
|
||||
|
||||
@@ -1534,15 +1579,24 @@ class HuyaExternalOrderOut(BaseModel):
|
||||
home_image_thumb_urls: list[str] = Field(default_factory=list)
|
||||
|
||||
gift_name: str = ""
|
||||
required_points: int | None = None
|
||||
remark: str = ""
|
||||
|
||||
status: str = "pending"
|
||||
status: str = "incomplete"
|
||||
status_label: str = ""
|
||||
next_status: str | None = None
|
||||
bound_at: datetime | None = None
|
||||
recharged_at: datetime | None = None
|
||||
scripted_at: datetime | None = None
|
||||
done_at: datetime | None = None
|
||||
points_checked_at: datetime | None = None
|
||||
points_balance: int | None = None
|
||||
points_required_total: int | None = None
|
||||
points_surplus: int | None = None
|
||||
points_threshold: int | None = None
|
||||
points_check_reason: str = ""
|
||||
points_check_message: str = ""
|
||||
points_check_detail: dict[str, Any] | None = None
|
||||
void_reason: str = ""
|
||||
|
||||
# 归档是可见性状态,不影响上面的业务状态。
|
||||
|
||||
Reference in New Issue
Block a user