Initial restarted commit
This commit is contained in:
146
HelperUploadUserPlayLog.py
Normal file
146
HelperUploadUserPlayLog.py
Normal file
@@ -0,0 +1,146 @@
|
||||
# 上传一个占位用的游玩记录的 API 实现
|
||||
|
||||
import json
|
||||
import pytz
|
||||
import time
|
||||
import random
|
||||
from datetime import datetime
|
||||
from loguru import logger
|
||||
|
||||
from API_TitleServer import apiSDGB
|
||||
from Static_Settings import *
|
||||
|
||||
def apiUploadUserPlaylog(userId:int, musicDataToBeUploaded, currentUserData2, loginId:int) -> str:
|
||||
'''返回 Json String。'''
|
||||
|
||||
# 暂存,优化可读性(迫真)
|
||||
musicId = musicDataToBeUploaded['musicId']
|
||||
level = musicDataToBeUploaded['level']
|
||||
#playCount = musicDataToBeUploaded['playCount']
|
||||
achievement = musicDataToBeUploaded['achievement']
|
||||
#comboStatus = musicDataToBeUploaded['comboStatus']
|
||||
#syncStatus = musicDataToBeUploaded['syncStatus']
|
||||
deluxscoreMax = musicDataToBeUploaded['deluxscoreMax']
|
||||
scoreRank = musicDataToBeUploaded['scoreRank']
|
||||
#extNum1 = musicDataToBeUploaded['extNum1']
|
||||
|
||||
# 构建一个 PlayLog
|
||||
data = json.dumps({
|
||||
"userId": int(userId),
|
||||
"userPlaylog": {
|
||||
"userId": 0,
|
||||
"orderId": 0,
|
||||
"playlogId": loginId,
|
||||
"version": 1041000,
|
||||
"placeId": placeId,
|
||||
"placeName": placeName,
|
||||
"loginDate": int(time.time()), #似乎和登录timestamp不同,暂时不作更改
|
||||
"playDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d'),
|
||||
"userPlayDate": datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S') + '.0',
|
||||
"type": 0,
|
||||
"musicId": int(musicId),
|
||||
"level": int(level),
|
||||
"trackNo": 1,
|
||||
"vsMode": 0,
|
||||
"vsUserName": "",
|
||||
"vsStatus": 0,
|
||||
"vsUserRating": 0,
|
||||
"vsUserAchievement": 0,
|
||||
"vsUserGradeRank": 0,
|
||||
"vsRank": 0,
|
||||
"playerNum": 1,
|
||||
"playedUserId1": 0,
|
||||
"playedUserName1": "",
|
||||
"playedMusicLevel1": 0,
|
||||
"playedUserId2": 0,
|
||||
"playedUserName2": "",
|
||||
"playedMusicLevel2": 0,
|
||||
"playedUserId3": 0,
|
||||
"playedUserName3": "",
|
||||
"playedMusicLevel3": 0,
|
||||
"characterId1": currentUserData2['charaSlot'][0],
|
||||
"characterLevel1": random.randint(1000,6500),
|
||||
"characterAwakening1": 5,
|
||||
"characterId2": currentUserData2['charaSlot'][1],
|
||||
"characterLevel2": random.randint(1000,6500),
|
||||
"characterAwakening2": 5,
|
||||
"characterId3": currentUserData2['charaSlot'][2],
|
||||
"characterLevel3": random.randint(1000,6500),
|
||||
"characterAwakening3": 5,
|
||||
"characterId4": currentUserData2['charaSlot'][3],
|
||||
"characterLevel4": random.randint(1000,6500),
|
||||
"characterAwakening4": 5,
|
||||
"characterId5": currentUserData2['charaSlot'][4],
|
||||
"characterLevel5": random.randint(1000,6500),
|
||||
"characterAwakening5": 5,
|
||||
"achievement": int(achievement),
|
||||
"deluxscore": int(deluxscoreMax),
|
||||
"scoreRank": int(scoreRank),
|
||||
"maxCombo": 0,
|
||||
"totalCombo": random.randint(700,900),
|
||||
"maxSync": 0,
|
||||
"totalSync": 0,
|
||||
"tapCriticalPerfect": 0,
|
||||
"tapPerfect": 0,
|
||||
"tapGreat": 0,
|
||||
"tapGood": 0,
|
||||
"tapMiss": random.randint(1,10),
|
||||
"holdCriticalPerfect": 0,
|
||||
"holdPerfect": 0,
|
||||
"holdGreat": 0,
|
||||
"holdGood": 0,
|
||||
"holdMiss": random.randint(1,15),
|
||||
"slideCriticalPerfect": 0,
|
||||
"slidePerfect": 0,
|
||||
"slideGreat": 0,
|
||||
"slideGood": 0,
|
||||
"slideMiss": random.randint(1,15),
|
||||
"touchCriticalPerfect": 0,
|
||||
"touchPerfect": 0,
|
||||
"touchGreat": 0,
|
||||
"touchGood": 0,
|
||||
"touchMiss": random.randint(1,15),
|
||||
"breakCriticalPerfect": 0,
|
||||
"breakPerfect": 0,
|
||||
"breakGreat": 0,
|
||||
"breakGood": 0,
|
||||
"breakMiss": random.randint(1,15),
|
||||
"isTap": True,
|
||||
"isHold": True,
|
||||
"isSlide": True,
|
||||
"isTouch": True,
|
||||
"isBreak": True,
|
||||
"isCriticalDisp": True,
|
||||
"isFastLateDisp": True,
|
||||
"fastCount": 0,
|
||||
"lateCount": 0,
|
||||
"isAchieveNewRecord": True,
|
||||
"isDeluxscoreNewRecord": True,
|
||||
"comboStatus": 0,
|
||||
"syncStatus": 0,
|
||||
"isClear": False,
|
||||
'beforeRating': currentUserData2['playerRating'],
|
||||
'afterRating': currentUserData2['playerRating'],
|
||||
"beforeGrade": 0,
|
||||
"afterGrade": 0,
|
||||
"afterGradeRank": 1,
|
||||
'beforeDeluxRating': currentUserData2['playerRating'],
|
||||
'afterDeluxRating': currentUserData2['playerRating'],
|
||||
"isPlayTutorial": False,
|
||||
"isEventMode": False,
|
||||
"isFreedomMode": False,
|
||||
"playMode": 0,
|
||||
"isNewFree": False,
|
||||
"trialPlayAchievement": -1,
|
||||
"extNum1": 0,
|
||||
"extNum2": 0,
|
||||
"extNum4": 3020,
|
||||
"extBool1": False
|
||||
}
|
||||
})
|
||||
# 发送请求
|
||||
result = apiSDGB(data, "UploadUserPlaylogApi", userId)
|
||||
logger.info("上传游玩记录:结果:"+ str(result))
|
||||
# 返回响应
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user