mirror of
https://github.com/Remik1r3n/maimaiDX-Api.git
synced 2025-05-20 04:17:28 +08:00
bugfix
This commit is contained in:
parent
3710a42112
commit
8a91b15fea
@ -5,7 +5,11 @@ from datetime import datetime, timedelta
|
||||
|
||||
from Config import *
|
||||
from API_TitleServer import apiSDGB
|
||||
from HelperGetUserThing import apiGetUserData
|
||||
from HelperGetUserThing import implGetUser_
|
||||
|
||||
from loguru import logger
|
||||
from HelperLogInOut import apiLogin, apiLogout, generateTimestamp
|
||||
|
||||
|
||||
def apiQueryTicket(userId:int) -> str:
|
||||
'''查询已有票的 API 请求器,返回 Json String。'''
|
||||
@ -50,7 +54,7 @@ def implBuyTicket(userId:int, ticketType:int):
|
||||
返回服务器响应的 Json string。
|
||||
'''
|
||||
# 先使用 GetUserData API 请求器,取得 rating 和 pc 数
|
||||
currentUserData = json.loads(apiGetUserData(userId))
|
||||
currentUserData = implGetUser_("Data", userId)
|
||||
if currentUserData:
|
||||
playerRating = currentUserData['userData']['playerRating']
|
||||
playCount = currentUserData['userData'].get('playCount', 0)
|
||||
@ -63,7 +67,15 @@ def implBuyTicket(userId:int, ticketType:int):
|
||||
|
||||
if __name__ == "__main__":
|
||||
userId = testUid2
|
||||
ticketType = 3
|
||||
|
||||
print(implBuyTicket(userId, ticketType))
|
||||
print(apiQueryTicket(userId))
|
||||
currentLoginTimestamp = generateTimestamp()
|
||||
loginResult = apiLogin(currentLoginTimestamp, userId)
|
||||
|
||||
if loginResult['returnCode'] != 1:
|
||||
logger.info("登录失败")
|
||||
exit()
|
||||
try:
|
||||
logger.info(implBuyTicket(userId, 2))
|
||||
logger.info(apiLogout(currentLoginTimestamp, userId))
|
||||
finally:
|
||||
logger.info(apiLogout(currentLoginTimestamp, userId))
|
||||
#logger.warning("Error")
|
||||
|
@ -12,9 +12,10 @@ def implGetUser_(thing:str, userId:int, noLog=False) -> dict:
|
||||
# 返回 Dict
|
||||
return userthingDict
|
||||
|
||||
def apiGetUserData(userId:int) -> str:
|
||||
"""Now aka of implGetUser_(Data)"""
|
||||
return implGetUser_("Data", userId)
|
||||
# 已弃用
|
||||
#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"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user