Tested and fixed stupid bug

This commit is contained in:
Remik1r3n 2025-01-23 19:16:27 +08:00
parent 83da4636ac
commit 6e05b211ac
3 changed files with 14 additions and 10 deletions

View File

@ -170,7 +170,8 @@ if __name__ == "__main__":
logger.info("登录失败") logger.info("登录失败")
exit() exit()
try: try:
logger.info(implLoginBonus(userId, currentLoginTimestamp, loginResult)) # Remember to change the mode to 1 if you want to give all bonuses
logger.info(implLoginBonus(userId, currentLoginTimestamp, loginResult, 1))
logger.info(apiLogout(currentLoginTimestamp, userId)) logger.info(apiLogout(currentLoginTimestamp, userId))
except: except:
logger.info(apiLogout(currentLoginTimestamp, userId)) logger.info(apiLogout(currentLoginTimestamp, userId))

View File

@ -6,18 +6,18 @@ from Static_Settings import *
from HelperLogInOut import apiLogin, apiLogout, generateTimestamp from HelperLogInOut import apiLogin, apiLogout, generateTimestamp
from HelperUnlockThing import implUnlockThing from HelperUnlockThing import implUnlockThing
def implUnlockPartner(partnerToBeUnlocked: int, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str: def implUnlockSingleItem(itemId: int, itemKind: int, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str:
''' '''
解锁搭档 发单个东西比如搭档 10
''' '''
userItemList = [ userItemList = [
{ {
"itemKind": 10, "itemKind": itemKind,
"itemId": partnerToBeUnlocked, "itemId": itemId,
"stock": 1, "stock": 1,
"isValid": True "isValid": True
} }
], ]
unlockThingResult = implUnlockThing(userItemList, userId, currentLoginTimestamp, currentLoginResult) unlockThingResult = implUnlockThing(userItemList, userId, currentLoginTimestamp, currentLoginResult)
return unlockThingResult return unlockThingResult
@ -38,7 +38,7 @@ def implUnlockMusic(musicToBeUnlocked: int, userId: int, currentLoginTimestamp:i
"stock": 1, "stock": 1,
"isValid": True "isValid": True
}, },
], ]
unlockThingResult = implUnlockThing(userItemList, userId, currentLoginTimestamp, currentLoginResult) unlockThingResult = implUnlockThing(userItemList, userId, currentLoginTimestamp, currentLoginResult)
return unlockThingResult return unlockThingResult
@ -47,13 +47,14 @@ if __name__ == "__main__":
currentLoginTimestamp = generateTimestamp() currentLoginTimestamp = generateTimestamp()
loginResult = apiLogin(currentLoginTimestamp, userId) loginResult = apiLogin(currentLoginTimestamp, userId)
wantToUnlockItemId = 1 # Change you want item ID
wantToUnlockItemId = 11
if loginResult['returnCode'] != 1: if loginResult['returnCode'] != 1:
logger.info("登录失败") logger.info("登录失败")
exit() exit()
try: try:
# change it # Change you want to unlock music or something
logger.info(implUnlockMusic(wantToUnlockItemId, userId, currentLoginTimestamp, loginResult)) logger.info(implUnlockMusic(wantToUnlockItemId, userId, currentLoginTimestamp, loginResult))
logger.info(apiLogout(currentLoginTimestamp, userId)) logger.info(apiLogout(currentLoginTimestamp, userId))
except: except:

View File

@ -9,7 +9,7 @@ from HelperGetUserThing import implGetUser_
from HelperUploadUserPlayLog import apiUploadUserPlaylog from HelperUploadUserPlayLog import apiUploadUserPlaylog
from HelperUserAll import generateFullUserAll from HelperUserAll import generateFullUserAll
def implUnlockThing(newUserItemList:list, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str: def implUnlockThing(newUserItemList, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str:
''' '''
解锁东西的实现 解锁东西的实现
Note: itemKind 如下 Note: itemKind 如下
@ -56,6 +56,8 @@ def implUnlockThing(newUserItemList:list, userId: int, currentLoginTimestamp:int
currentUserAll['upsertUserAll']["userMusicDetailList"] = [musicDataToBeUploaded] currentUserAll['upsertUserAll']["userMusicDetailList"] = [musicDataToBeUploaded]
currentUserAll['upsertUserAll']['isNewMusicDetailList'] = "1" # Insert mode(Not overriding) currentUserAll['upsertUserAll']['isNewMusicDetailList'] = "1" # Insert mode(Not overriding)
currentUserAll['upsertUserAll']['userItemList'] = newUserItemList currentUserAll['upsertUserAll']['userItemList'] = newUserItemList
currentUserAll['upsertUserAll']['isNewItemList'] = "1" * len(newUserItemList)
data = json.dumps(currentUserAll) data = json.dumps(currentUserAll)
try: try:
currentUserAllResult = json.loads(apiSDGB(data, "UpsertUserAllApi", userId)) currentUserAllResult = json.loads(apiSDGB(data, "UpsertUserAllApi", userId))