Initial restarted commit

This commit is contained in:
Remik1r3n
2025-01-23 18:52:09 +08:00
commit 83da4636ac
18 changed files with 1753 additions and 0 deletions

36
HelperGetUserThing.py Normal file
View File

@@ -0,0 +1,36 @@
# 获取用户数据的 API 实现
from loguru import logger
import json
from API_TitleServer import apiSDGB
def apiGetUserData(userId:int) -> str:
'''已弃用,将逐步淘汰'''
logger.warning("apiGetUserData 已弃用,将逐步淘汰。")
# 构建 Payload
data = json.dumps({
"userId": userId
})
# 发送请求
userdata_result = apiSDGB(data, "GetUserDataApi", userId)
# 返回响应
return userdata_result
def apiGetUserThing(userId:int, thing:str) -> str:
'''获取用户数据的 API 请求器,返回 Json String'''
# 构建 Payload
data = json.dumps({
"userId": userId
})
# 发送请求
userthing_result = apiSDGB(data, "GetUser" + thing + "Api", userId)
# 返回响应
return userthing_result
def implGetUser_(thing:str, userId:int) -> dict:
'''获取用户数据的 API 实现,返回 Dict'''
# 获取 Json String
userthing_result = apiGetUserThing(userId, thing)
# 转换为 Dict
userthing_dict = json.loads(userthing_result)
# 返回 Dict
return userthing_dict