解小黑屋现可投入测试
This commit is contained in:
@@ -9,12 +9,19 @@ import json
|
||||
from loguru import logger
|
||||
import time
|
||||
from datetime import datetime
|
||||
import asyncio
|
||||
|
||||
def isUserLoggedIn(userId):
|
||||
isLogin = json.loads(apiGetUserPreview(userId))['isLogin']
|
||||
logger.info(f"用户 {userId} 是否登录: {isLogin}")
|
||||
isLogin = json.loads(apiGetUserPreview(userId, True))['isLogin']
|
||||
logger.debug(f"用户 {userId} 是否登录: {isLogin}")
|
||||
return isLogin
|
||||
|
||||
def getHumanReadableTime(unixTime):
|
||||
'''将 Unix 时间戳转换为人类可读的时间'''
|
||||
# 减一个小时,因为舞萌貌似是 UTC+9
|
||||
timestamp = int(unixTime) - 3600
|
||||
return datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
def getMaimaiUNIXTime(mmddhhmmss, year=2025):
|
||||
"""
|
||||
解析用户输入的 MMDDHHMMSS 格式的时间,返回 Unix 时间戳
|
||||
@@ -37,7 +44,7 @@ def logOut(userId, Timestamp):
|
||||
"""极其简单的登出实现,成功返回 True,失败返回 False
|
||||
注意:不会检查用户是否真的登出了,只会尝试登出"""
|
||||
try:
|
||||
if apiLogout(Timestamp, userId)['returnCode'] == 1:
|
||||
if apiLogout(Timestamp, userId, True)['returnCode'] == 1:
|
||||
# 成功送出了登出请求
|
||||
logger.debug(f"已成功尝试登出用户 {userId}")
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user