mirror of
https://github.com/Remik1r3n/maimaiDX-Api.git
synced 2025-05-20 01:07:28 +08:00
31 lines
917 B
Python
31 lines
917 B
Python
# 获取用户数据的 API 实现
|
|
from loguru import logger
|
|
import rapidjson as json
|
|
from API_TitleServer import apiSDGB
|
|
|
|
def implGetUser_(thing:str, userId:int, noLog=False) -> dict:
|
|
"""获取用户某些数据的 API 实现,返回 Dict"""
|
|
# 获取 Json String
|
|
result = apiGetUserThing(userId, thing, noLog)
|
|
# 转换为 Dict
|
|
userthingDict = json.loads(result)
|
|
# 返回 Dict
|
|
return userthingDict
|
|
|
|
# 已弃用
|
|
#def apiGetUserData(userId:int) -> str:
|
|
# """Now aka of implGetUser_(Data)"""
|
|
# return implGetUser_("Data", userId)
|
|
|
|
def apiGetUserThing(userId:int, thing:str, noLog=False) -> str:
|
|
"""获取用户数据的 API 请求器,返回 Json String"""
|
|
# 构建 Payload
|
|
data = json.dumps({
|
|
"userId": userId
|
|
})
|
|
# 发送请求
|
|
userthing_result = apiSDGB(data, "GetUser" + thing + "Api", userId, noLog)
|
|
# 返回响应
|
|
return userthing_result
|
|
|