MCPcopy Create free account
hub / github.com/Loping151/RoverSign / WavesUser

Class WavesUser

RoverSign/utils/database/models.py:47–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46
47class WavesUser(User, table=True):
48 __table_args__: Dict[str, Any] = {"extend_existing": True}
49 cookie: str = Field(default="", title="Cookie")
50 uid: str = Field(default=None, title="鸣潮UID")
51 platform: str = Field(default="", title="ck平台")
52 stamina_bg_value: str = Field(default="", title="体力背景")
53 hide_uid_self_value: str = Field(default="", title="隐藏UID")
54 bbs_sign_switch: str = Field(default="off", title="自动社区签到")
55 bat: str = Field(default="", title="bat")
56 did: str = Field(default="", title="did")
57 game_id: int = Field(default=3, title="GameID")
58 is_login: bool = Field(default=False, title="是否waves登录")
59 created_time: Optional[int] = Field(default=None, title="创建时间")
60 last_used_time: Optional[int] = Field(default=None, title="最后使用时间")
61
62 @classmethod
63 @with_lock
64 @with_session
65 async def mark_cookie_invalid(
66 cls: Type[T_WavesUser], session: AsyncSession, uid: str, cookie: str, mark: str
67 ):
68 sql = (
69 update(cls)
70 .where(col(cls.uid) == uid)
71 .where(col(cls.cookie) == cookie)
72 .values(status=mark)
73 )
74 await session.execute(sql)
75 return True
76
77 @classmethod
78 @with_session
79 async def select_cookie(
80 cls: Type[T_WavesUser],
81 session: AsyncSession,
82 uid: str,
83 user_id: str,
84 bot_id: str,
85 ) -> Optional[str]:
86 sql = select(cls).where(
87 cls.user_id == user_id,
88 cls.uid == uid,
89 cls.bot_id == bot_id,
90 )
91 result = await session.execute(sql)
92 data = result.scalars().all()
93 return data[0].cookie if data else None
94
95 @classmethod
96 @with_session
97 async def select_waves_user(
98 cls: Type[T_WavesUser],
99 session: AsyncSession,
100 uid: str,
101 user_id: str,
102 bot_id: str,
103 game_id: Optional[int] = None,
104 ) -> Optional[T_WavesUser]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected