fix upsert

This commit is contained in:
2025-07-07 01:35:52 +08:00
parent f53dfef7ca
commit b02ce11ea4
3 changed files with 134 additions and 116 deletions

View File

@@ -28,7 +28,7 @@ def auth_lite_decrypt(ciphertext: bytes) -> str:
content = decrypted_data[16:] # 去除头部的16字节 content = decrypted_data[16:] # 去除头部的16字节
return content.decode('utf-8').strip() return content.decode('utf-8').strip()
def getRawDelivery(title_ver:str="1.50"): def getRawDelivery(title_ver:str="1.51"):
encrypted = auth_lite_encrypt(f'title_id=SDGB&title_ver={title_ver}&client_id=A63E01C2805') encrypted = auth_lite_encrypt(f'title_id=SDGB&title_ver={title_ver}&client_id=A63E01C2805')
r = httpx.post( r = httpx.post(
'http://at.sys-allnet.cn/net/delivery/instruction', 'http://at.sys-allnet.cn/net/delivery/instruction',
@@ -120,7 +120,7 @@ def parseUpdateIni(iniText):
return final_message return final_message
if __name__ == '__main__': if __name__ == '__main__':
urlList = parseRawDelivery(getRawDelivery("1.40")) urlList = parseRawDelivery(getRawDelivery("1.51"))
for url in urlList: for url in urlList:
iniText = getUpdateIniFromURL(url) iniText = getUpdateIniFromURL(url)
message = parseUpdateIni(iniText) message = parseUpdateIni(iniText)

View File

@@ -19,120 +19,122 @@ def apiUploadUserPlaylog(userId:int, musicDataToBeUploaded, currentUserData2, lo
# 构建一个 PlayLog # 构建一个 PlayLog
data = json.dumps({ data = json.dumps({
"userId": int(userId), "userId": int(userId),
"userPlaylog": { "userPlaylogList": [
"userId": 0, {
"orderId": 0, "userId": 0,
"playlogId": loginId, "orderId": 0,
"version": 1050000, "playlogId": loginId,
"placeId": placeId, "version": 1050000,
"placeName": placeName, "placeId": placeId,
"loginDate": int(time.time()), #似乎和登录timestamp不同 "placeName": placeName,
"playDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d'), "loginDate": int(time.time()), #似乎和登录timestamp不同
"userPlayDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S') + '.0', "playDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d'),
"type": 0, "userPlayDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S') + '.0',
"musicId": int(musicDataToBeUploaded['musicId']), "type": 0,
"level": int(musicDataToBeUploaded['level']), "musicId": int(musicDataToBeUploaded['musicId']),
"trackNo": 1, "level": int(musicDataToBeUploaded['level']),
"vsMode": 0, "trackNo": 1,
"vsUserName": "", "vsMode": 0,
"vsStatus": 0, "vsUserName": "",
"vsUserRating": 0, "vsStatus": 0,
"vsUserAchievement": 0, "vsUserRating": 0,
"vsUserGradeRank": 0, "vsUserAchievement": 0,
"vsRank": 0, "vsUserGradeRank": 0,
"playerNum": 1, "vsRank": 0,
"playedUserId1": 0, "playerNum": 1,
"playedUserName1": "", "playedUserId1": 0,
"playedMusicLevel1": 0, "playedUserName1": "",
"playedUserId2": 0, "playedMusicLevel1": 0,
"playedUserName2": "", "playedUserId2": 0,
"playedMusicLevel2": 0, "playedUserName2": "",
"playedUserId3": 0, "playedMusicLevel2": 0,
"playedUserName3": "", "playedUserId3": 0,
"playedMusicLevel3": 0, "playedUserName3": "",
"characterId1": currentUserData2['charaSlot'][0], "playedMusicLevel3": 0,
"characterLevel1": random.randint(1000,6500), "characterId1": currentUserData2['charaSlot'][0],
"characterAwakening1": 5, "characterLevel1": random.randint(1000,6500),
"characterId2": currentUserData2['charaSlot'][1], "characterAwakening1": 5,
"characterLevel2": random.randint(1000,6500), "characterId2": currentUserData2['charaSlot'][1],
"characterAwakening2": 5, "characterLevel2": random.randint(1000,6500),
"characterId3": currentUserData2['charaSlot'][2], "characterAwakening2": 5,
"characterLevel3": random.randint(1000,6500), "characterId3": currentUserData2['charaSlot'][2],
"characterAwakening3": 5, "characterLevel3": random.randint(1000,6500),
"characterId4": currentUserData2['charaSlot'][3], "characterAwakening3": 5,
"characterLevel4": random.randint(1000,6500), "characterId4": currentUserData2['charaSlot'][3],
"characterAwakening4": 5, "characterLevel4": random.randint(1000,6500),
"characterId5": currentUserData2['charaSlot'][4], "characterAwakening4": 5,
"characterLevel5": random.randint(1000,6500), "characterId5": currentUserData2['charaSlot'][4],
"characterAwakening5": 5, "characterLevel5": random.randint(1000,6500),
"achievement": int(musicDataToBeUploaded['achievement']), "characterAwakening5": 5,
"deluxscore": int(musicDataToBeUploaded['deluxscoreMax']), "achievement": int(musicDataToBeUploaded['achievement']),
"scoreRank": int(musicDataToBeUploaded['scoreRank']), "deluxscore": int(musicDataToBeUploaded['deluxscoreMax']),
"maxCombo": 0, "scoreRank": int(musicDataToBeUploaded['scoreRank']),
"totalCombo": random.randint(700,900), "maxCombo": 0,
"maxSync": 0, "totalCombo": random.randint(700,900),
"totalSync": 0, "maxSync": 0,
"tapCriticalPerfect": 0, "totalSync": 0,
"tapPerfect": 0, "tapCriticalPerfect": 0,
"tapGreat": 0, "tapPerfect": 0,
"tapGood": 0, "tapGreat": 0,
"tapMiss": random.randint(1,10), "tapGood": 0,
"holdCriticalPerfect": 0, "tapMiss": random.randint(1,10),
"holdPerfect": 0, "holdCriticalPerfect": 0,
"holdGreat": 0, "holdPerfect": 0,
"holdGood": 0, "holdGreat": 0,
"holdMiss": random.randint(1,15), "holdGood": 0,
"slideCriticalPerfect": 0, "holdMiss": random.randint(1,15),
"slidePerfect": 0, "slideCriticalPerfect": 0,
"slideGreat": 0, "slidePerfect": 0,
"slideGood": 0, "slideGreat": 0,
"slideMiss": random.randint(1,15), "slideGood": 0,
"touchCriticalPerfect": 0, "slideMiss": random.randint(1,15),
"touchPerfect": 0, "touchCriticalPerfect": 0,
"touchGreat": 0, "touchPerfect": 0,
"touchGood": 0, "touchGreat": 0,
"touchMiss": random.randint(1,15), "touchGood": 0,
"breakCriticalPerfect": 0, "touchMiss": random.randint(1,15),
"breakPerfect": 0, "breakCriticalPerfect": 0,
"breakGreat": 0, "breakPerfect": 0,
"breakGood": 0, "breakGreat": 0,
"breakMiss": random.randint(1,15), "breakGood": 0,
"isTap": True, "breakMiss": random.randint(1,15),
"isHold": True, "isTap": True,
"isSlide": True, "isHold": True,
"isTouch": True, "isSlide": True,
"isBreak": True, "isTouch": True,
"isCriticalDisp": True, "isBreak": True,
"isFastLateDisp": True, "isCriticalDisp": True,
"fastCount": 0, "isFastLateDisp": True,
"lateCount": 0, "fastCount": 0,
"isAchieveNewRecord": True, "lateCount": 0,
"isDeluxscoreNewRecord": True, "isAchieveNewRecord": True,
"comboStatus": 0, "isDeluxscoreNewRecord": True,
"syncStatus": 0, "comboStatus": 0,
"isClear": False, "syncStatus": 0,
'beforeRating': currentUserData2['playerRating'], "isClear": False,
'afterRating': currentUserData2['playerRating'], "beforeRating": currentUserData2['playerRating'],
"beforeGrade": 0, "afterRating": currentUserData2['playerRating'],
"afterGrade": 0, "beforeGrade": 0,
"afterGradeRank": 1, "afterGrade": 0,
'beforeDeluxRating': currentUserData2['playerRating'], "afterGradeRank": 1,
'afterDeluxRating': currentUserData2['playerRating'], "beforeDeluxRating": currentUserData2['playerRating'],
"isPlayTutorial": False, "afterDeluxRating": currentUserData2['playerRating'],
"isEventMode": False, "isPlayTutorial": False,
"isFreedomMode": False, "isEventMode": False,
"playMode": 0, "isFreedomMode": False,
"isNewFree": False, "playMode": 0,
"trialPlayAchievement": -1, "isNewFree": False,
"extNum1": 0, "trialPlayAchievement": -1,
"extNum2": 0, "extNum1": 0,
"extNum4": 3020, "extNum2": 0,
"extBool1": False "extNum4": 3020,
"extBool1": False,
"extBool2": False
} }
}) ]
})
# 发送请求 # 发送请求
result = apiSDGB(data, "UploadUserPlaylogApi", userId) result = apiSDGB(data, "UploadUserPlaylogListApi", userId)
logger.info("上传游玩记录:结果:"+ str(result)) logger.info("上传游玩记录:结果:"+ str(result))
# 返回响应 # 返回响应
return result return result

View File

@@ -53,6 +53,9 @@ def generateFullUserAll(userId, currentLoginResult, currentLoginTimestamp, curre
def generateUserAllData(userId, currentLoginResult, currentLoginTimestamp, currentUserData2, currentPlaySpecial): def generateUserAllData(userId, currentLoginResult, currentLoginTimestamp, currentUserData2, currentPlaySpecial):
"""构建一个非常基础的 UserAll 数据,必须手动填充一些数据""" """构建一个非常基础的 UserAll 数据,必须手动填充一些数据"""
# 我不知道放在哪里好了,你修改一下 TwT
currentUserMission = implGetUser_("MissionData", userId, True)
data = { data = {
"userId": userId, "userId": userId,
"playlogId": currentLoginResult['loginId'], "playlogId": currentLoginResult['loginId'],
@@ -64,6 +67,8 @@ def generateUserAllData(userId, currentLoginResult, currentLoginTimestamp, curre
"accessCode": "", "accessCode": "",
"userName": currentUserData2['userName'], "userName": currentUserData2['userName'],
"isNetMember": 1, "isNetMember": 1,
"point": currentUserData2['point'],
"totalPoint": currentUserData2['totalPoint'],
"iconId": currentUserData2['iconId'], "iconId": currentUserData2['iconId'],
"plateId": currentUserData2['plateId'], "plateId": currentUserData2['plateId'],
"titleId": currentUserData2['titleId'], "titleId": currentUserData2['titleId'],
@@ -157,6 +162,8 @@ def generateUserAllData(userId, currentLoginResult, currentLoginTimestamp, curre
"userChargeList": [], #需要填上 "userChargeList": [], #需要填上
"userFavoriteList": [], "userFavoriteList": [],
"userActivityList": [], #需要填上 "userActivityList": [], #需要填上
"userMissionDataList": [],
"userWeeklyData": currentUserMission['userWeeklyData'],
"userGamePlaylogList": [ "userGamePlaylogList": [
{ {
"playlogId": currentLoginResult['loginId'], "playlogId": currentLoginResult['loginId'],
@@ -191,7 +198,16 @@ def generateUserAllData(userId, currentLoginResult, currentLoginTimestamp, curre
"isNewMusicDetailList": "", #可选但经常要填上 "isNewMusicDetailList": "", #可选但经常要填上
"isNewCourseList": "0", "isNewCourseList": "0",
"isNewFavoriteList": "", "isNewFavoriteList": "",
"isNewFriendSeasonRankingList": "" "isNewFriendSeasonRankingList": "",
"userIntimateList": [],
"userShopItemStockList": [],
"userGetPointList": [],
"userTradeItemList": [],
"userFavoritemusicList": [],
"userKaleidxScopeList": [],
"isNewUserIntimateList": "",
"isNewFavoritemusicList": "",
"isNewKaleidxScopeList": ""
} }
} }
return data return data