bugfix
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user