3f7b5167fa
Co-authored-by: guke <guke@wonderable.ai> Co-authored-by: 左辰勇 <exinglang@gmail.com> Reviewed-on: #167 Co-authored-by: zuochenyong <zuochenyong@wonderable.ai> Co-committed-by: zuochenyong <zuochenyong@wonderable.ai>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""新手引导视频(领券等候浮层前 N 次替代广告)的客户端请求/响应契约。"""
|
|
from __future__ import annotations
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class GuideVideoStartIn(BaseModel):
|
|
"""开播询问。scene 目前只有 coupon(领券浮层);预留给日后比价等场景。"""
|
|
|
|
scene: str = Field(default="coupon", max_length=16)
|
|
|
|
|
|
class GuideVideoStartOut(BaseModel):
|
|
"""should_play=False 时客户端照旧走广告链路,其余字段无意义。"""
|
|
|
|
should_play: bool
|
|
video_url: str | None = None # 相对地址 /media/...;客户端自行拼 BASE_URL
|
|
play_token: str = "" # 发奖幂等键
|
|
reward_coin: int = 0 # 播完/中途关闭都发的固定金币
|
|
seq: int = 0 # 本账号第几次
|
|
remaining: int = 0 # 发完这次还剩几次
|
|
|
|
|
|
class GuideVideoRewardIn(BaseModel):
|
|
"""播完或中途关闭都调这个;completed 只做留痕,两者都发币。"""
|
|
|
|
play_token: str = Field(min_length=1, max_length=64)
|
|
completed: bool = False
|
|
|
|
|
|
class GuideVideoRewardOut(BaseModel):
|
|
"""granted=True 表示本次调用真的入账(重复上报为 False,coin 是已发金额)。"""
|
|
|
|
granted: bool
|
|
coin: int
|
|
status: str
|