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

Method get_active_waves_user

RoverSign/utils/database/models.py:174–204  ·  view source on GitHub ↗

获取活跃用户(在指定天数内有使用记录) Args: active_days: 活跃认定天数 Returns: 活跃用户列表

(
        cls: Type[T_WavesUser],
        session: AsyncSession,
        active_days: int,
    )

Source from the content-addressed store, hash-verified

172 @classmethod
173 @with_session
174 async def get_active_waves_user(
175 cls: Type[T_WavesUser],
176 session: AsyncSession,
177 active_days: int,
178 ) -> List[T_WavesUser]:
179 """
180 获取活跃用户(在指定天数内有使用记录)
181
182 Args:
183 active_days: 活跃认定天数
184
185 Returns:
186 活跃用户列表
187 """
188 import time
189
190 current_time = int(time.time())
191 threshold_time = current_time - (active_days * 24 * 60 * 60)
192
193 sql = (
194 select(cls)
195 .where(cls.cookie != null())
196 .where(cls.cookie != "")
197 .where(cls.user_id != null())
198 .where(cls.user_id != "")
199 .where(cls.last_used_time != null())
200 .where(cls.last_used_time >= threshold_time)
201 )
202 result = await session.execute(sql)
203 data = result.scalars().all()
204 return list(data)
205
206 @classmethod
207 @with_lock

Callers 1

rover_auto_sign_taskFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected