Files
shaguabijia-app-server/app/schemas/guide_video.py
T
zuochenyong ebacf01742 feat(新手引导): 支持十圈进度与逐圈发奖 (#200)
Co-authored-by: exinglang <exinglang@qq.com>
Reviewed-on: #200
Co-authored-by: zuochenyong <zuochenyong@wonderable.ai>
Co-committed-by: zuochenyong <zuochenyong@wonderable.ai>
2026-07-30 10:49:24 +08:00

73 lines
1.6 KiB
Python

"""客户端引导视频三阶段协议。"""
from typing import Literal
from pydantic import BaseModel, Field
GuideScene = Literal["coupon", "comparison"]
class GuideVideoPrepareIn(BaseModel):
scene: GuideScene = "coupon"
class GuideVideoPrepareOut(BaseModel):
should_play: bool
reason: str
scene: GuideScene
video_url: str | None = None
play_token: str = ""
config_version: int = 0
duration_ms: int = 0
circle_count: int = 10
circle_duration_ms: float = 0
reward_coin: int = 0
reward_per_circle: int = 0
seq: int = 0
remaining: int = 0
expires_at: str | None = None
class GuideVideoStartIn(BaseModel):
play_token: str = Field(min_length=1, max_length=64)
class GuideVideoStartOut(BaseModel):
started: bool
status: Literal["started", "already_started"]
play_token: str
scene: GuideScene
video_url: str
config_version: int
duration_ms: int
circle_count: int = 10
circle_duration_ms: float
reward_coin: int
reward_per_circle: int
seq: int
remaining: int
started_at: str
class GuideVideoRewardIn(BaseModel):
play_token: str = Field(min_length=1, max_length=64)
circle: int = Field(ge=1, le=10)
class GuideVideoRewardOut(BaseModel):
granted: bool
status: Literal[
"granted",
"already_granted",
"too_early",
"out_of_order",
"not_started",
"not_found",
"finished",
]
retryable: bool = False
retry_after_ms: int = 0
circle: int
granted_coin: int = 0
settled_circles: int = 0
coin_balance: int = 0