feat(weibo): 增加外部单协作台账

This commit is contained in:
yml2213
2026-11-08 11:41:54 +08:00
parent a0afa430ec
commit 79cfd4a634
16 changed files with 5217 additions and 4 deletions
+265
View File
@@ -629,6 +629,271 @@ class WeiboPaymentStatusOut(BaseModel):
sub_status: str = ""
# ==================== 微博外部单协作 ====================
class WeiboCollabShopCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=64)
remark: str = Field("", max_length=255)
class WeiboCollabShopUpdate(BaseModel):
name: str | None = Field(None, min_length=1, max_length=64)
sort_order: int | None = None
is_active: bool | None = None
remark: str | None = Field(None, max_length=255)
class WeiboCollabShopOut(BaseModel):
id: int
name: str
sort_order: int = 0
is_active: bool = True
remark: str = ""
created_by: int | None = None
updated_by: int | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
class WeiboCollabGoodsCreate(BaseModel):
name: str = Field(..., min_length=1, max_length=128)
price: int = Field(..., ge=0)
goods_id: int | None = Field(None, gt=0)
goods_image: str = Field("", max_length=512)
remark: str = Field("", max_length=255)
class WeiboCollabGoodsUpdate(BaseModel):
name: str | None = Field(None, min_length=1, max_length=128)
price: int | None = Field(None, ge=0)
goods_id: int | None = Field(None, gt=0)
goods_image: str | None = Field(None, max_length=512)
sort_order: int | None = None
is_active: bool | None = None
remark: str | None = Field(None, max_length=255)
class WeiboCollabGoodsOut(BaseModel):
id: int
name: str
price: int = 0
goods_id: int | None = None
goods_image: str = ""
sort_order: int = 0
is_active: bool = True
remark: str = ""
created_by: int | None = None
updated_by: int | None = None
created_at: datetime | None = None
updated_at: datetime | None = None
class WeiboCollabLiveGoodsOut(BaseModel):
id: int
goods_name: str = ""
goods_image: str = ""
price: int = 0
remain_count: int | None = None
is_sold_out: bool = False
class WeiboCollabAccountLookupRequest(BaseModel):
account_id: int = Field(..., gt=0)
with_goods: bool = True
class WeiboCollabAccountOptionOut(BaseModel):
id: int
uid: str = ""
nickname: str = ""
game_role_name: str = ""
weidou_balance: int | None = None
ck_check_status: str = ""
class WeiboCollabAccountLookupOut(BaseModel):
ok: bool = False
message: str = ""
account_id: int
uid: str = ""
nickname: str = ""
is_enabled: bool = True
ck_check_status: str = ""
ck_check_message: str = ""
is_bound: bool | None = None
game_role_name: str = ""
weidou_balance: int | None = None
goods: list[WeiboCollabLiveGoodsOut] = Field(default_factory=list)
orders_using_account: list[dict[str, Any]] = Field(default_factory=list)
class WeiboCollabOrderCreate(BaseModel):
order_no: str = Field(..., min_length=1, max_length=64)
shop: str = Field("", max_length=64)
owner_id: int | None = None
account_id: int | None = None
goods_id: int | None = Field(None, gt=0)
goods_name: str = Field("", max_length=128)
goods_image: str = Field("", max_length=512)
required_weidou: int | None = Field(None, ge=0)
home_images: list[str] = Field(default_factory=list)
remark: str = Field("", max_length=512)
draft: bool = False
require_verified: bool = True
class WeiboCollabOrderUpdate(BaseModel):
order_no: str | None = Field(None, max_length=64)
shop: str | None = Field(None, max_length=64)
owner_id: int | None = None
goods_id: int | None = Field(None, gt=0)
goods_name: str | None = Field(None, max_length=128)
goods_image: str | None = Field(None, max_length=512)
required_weidou: int | None = Field(None, ge=0)
home_images: list[str] | None = None
remark: str | None = Field(None, max_length=512)
expected_version: int | None = None
class WeiboCollabAccountRequest(BaseModel):
account_id: int = Field(..., gt=0)
expected_version: int | None = None
class WeiboCollabStatusRequest(BaseModel):
status: str = Field(..., min_length=1, max_length=20)
reason: str = Field("", max_length=256)
rollback: bool = False
expected_version: int | None = None
class WeiboCollabStatusBatchRequest(BaseModel):
ids: list[int] = Field(default_factory=list)
status: str = Field(..., min_length=1, max_length=20)
reason: str = Field("", max_length=256)
rollback: bool = False
class WeiboCollabBalanceCheckRequest(BaseModel):
ids: list[int] = Field(default_factory=list)
threshold: int = Field(100, ge=0, le=1_000_000)
class WeiboCollabExchangeCheckRequest(BaseModel):
ids: list[int] = Field(default_factory=list)
class WeiboCollabArchiveRequest(BaseModel):
ids: list[int] = Field(default_factory=list)
reason: str = Field("", max_length=256)
class WeiboCollabOrderOut(BaseModel):
id: int
order_no: str
shop: str = ""
owner_id: int | None = None
owner_name: str = ""
account_id: int | None = None
account_uid: str = ""
account_nickname: str = ""
account_exists: bool = False
account_enabled: bool = False
account_ck_status: str = ""
account_ck_message: str = ""
account_is_bound: bool | None = None
game_role_name: str = ""
bind_snapshot_at: datetime | None = None
goods_id: int | None = None
goods_name: str = ""
goods_image: str = ""
required_weidou: int | None = None
home_images: list[str] = Field(default_factory=list)
remark: str = ""
status: str = "incomplete"
status_label: str = ""
next_status: str | None = None
missing_fields: list[str] = Field(default_factory=list)
weidou_balance: int | None = None
weidou_required_total: int | None = None
weidou_surplus: int | None = None
weidou_threshold: int | None = None
weidou_checked_at: datetime | None = None
weidou_check_reason: str = ""
weidou_check_message: str = ""
weidou_check_detail: dict[str, Any] | None = None
exchange_started_at: datetime | None = None
exchange_checked_at: datetime | None = None
exchange_record_key: str = ""
exchange_record_snapshot: dict[str, Any] | None = None
exchange_verdict: str = ""
exchange_message: str = ""
recharged_at: datetime | None = None
done_at: datetime | None = None
void_reason: str = ""
is_archived: bool = False
archived_at: datetime | None = None
archived_by: int | None = None
archived_by_name: str = ""
archive_reason: str = ""
created_by: int | None = None
created_by_name: str = ""
updated_by: int | None = None
updated_by_name: str = ""
version: int = 0
created_at: datetime | None = None
updated_at: datetime | None = None
account_cluster: dict[str, Any] | None = None
last_metric_at: datetime | None = None
last_metric_message: str = ""
class WeiboCollabOrderListOut(BaseModel):
items: list[WeiboCollabOrderOut]
total: int
page: int
page_size: int
class WeiboCollabSummaryOut(BaseModel):
total: int
by_status: dict[str, int]
account_missing: int = 0
account_disabled: int = 0
ck_invalid: int = 0
archived_total: int = 0
class WeiboCollabOwnerOut(BaseModel):
id: int
username: str
class WeiboCollabMetricOut(BaseModel):
id: int
order_id: int
order_no: str = ""
account_uid: str = ""
weidou_balance: int | None = None
weidou_required_total: int | None = None
weidou_surplus: int | None = None
records_total: int = 0
records_matched: int = 0
verdict: str = ""
verdict_label: str = ""
message: str = ""
source: str = ""
created_at: datetime | None = None
class WeiboCollabTimelineOut(BaseModel):
id: int
action: str
username: str = ""
detail: str = ""
success: bool | None = None
created_at: datetime | None = None
# ---- 虎牙 ----
class HuyaCookieImport(BaseModel):
"""批量导入虎牙 Cookie。支持纯 CK 或 账号----密码----CK。"""