Files
o2o-weather/backend/router/v1/level/protocol.py
T
minaChoi 71974dcf42 feat: 계정 레벨 — 날씨각에서 한 일로 각을 모아 레벨업, 레벨로 새 콘텐츠가 열림
- 각: 출석 10, 오늘 타로 10, 날씨 사주 10, 좋아요·댓글 5씩(하루 10), 동네 이야기 글 20, 저녁 체크인 10, 공유 10, 7일 연속 50. 같은 날 같은 대상은 한 번 (point_log)
- 레벨: 모은 총량으로 이슬 0 → 햇살 30 → 산들바람 100 → 무지개 200 → 노을 400 → 은하수 700 → 별똥별 1000. 지금 있는 기능은 잠그지 않음
- API: GET /v1/level/me, POST /v1/level/attend, POST /v1/level/share
- 화면: 헤더 아바타 레벨 배지, 내 정보 레벨 카드, 내 레벨 창(오늘 받을 각·레벨별로 열리는 것), 레벨이 오르면 축하 창
- 로그인한 사람만 쌓임 (기기 기록은 조작할 수 있어 받지 않음)
2026-10-28 14:45:44 +09:00

39 lines
1.2 KiB
Python

from typing import Optional
from pydantic import Field
from common.models.gmodel import Res_WebPacketProtocol, WebPacketProtocol
class LevelAction(WebPacketProtocol):
action: str
name: str
points: int = Field(description="한 번에 주는 각")
cap: int = Field(description="하루 한도")
earned: int = Field(description="오늘 받은 각")
class LevelUnlock(WebPacketProtocol):
level: int
key: str
name: str
class LevelStep(WebPacketProtocol):
level: int
name: str
points: int = Field(description="이 레벨이 되는 각 총량")
class Res_Level(Res_WebPacketProtocol):
points: int = Field(0, description="모은 각 총량")
level: int = 1
name: Optional[str] = None
floor: int = Field(0, description="지금 레벨이 시작하는 각")
next_points: Optional[int] = Field(None, description="다음 레벨에 필요한 총량 (마지막 레벨이면 없음)")
next_name: Optional[str] = None
streak: int = Field(0, description="이어 출석한 날")
today: list[LevelAction] = []
unlocks: list[LevelUnlock] = []
levels: list[LevelStep] = Field([], description="레벨 전체 (이름·필요한 각)")