forked from Kohaku/maimaiDX-Api
minus improvements
This commit is contained in:
parent
a714fc5655
commit
1b852dee9a
@ -59,13 +59,13 @@ class aes_pkcs7(object):
|
||||
def SDGBApiHash(api):
|
||||
return hashlib.md5((api+"MaimaiChn"+ObfuscateParam).encode()).hexdigest()
|
||||
|
||||
def apiSDGB(data:str, useApi, agentExtraData, maxRetries=5):
|
||||
def apiSDGB(data:str, useApi, agentExtraData, maxRetries=3):
|
||||
'''
|
||||
舞萌DX 2024 API 通讯用函数
|
||||
:param data: 请求数据
|
||||
:param useApi: 使用的 API
|
||||
:param agentExtraData: UA 附加信息,机台相关则为狗号(如A63E01E9564),用户相关则为 UID
|
||||
:param maxRetry: 最大重试次数, 默认为 3
|
||||
:param maxRetry: 最大重试次数,
|
||||
'''
|
||||
|
||||
# 历史遗留代码有时候会传入 int,故先全部转 str
|
||||
@ -123,7 +123,7 @@ def apiSDGB(data:str, useApi, agentExtraData, maxRetries=5):
|
||||
continue
|
||||
# 解压成功,解密请求并返回
|
||||
resultResponse = unpad(aes.decrypt(responseDecompressed), 16).decode()
|
||||
logger.info("TitleServer Response OK!")
|
||||
logger.info("TitleServer:" + useApi + " Response: " + str(responseRaw.status_code))
|
||||
logger.debug("TitleServer Response: " + str(resultResponse))
|
||||
return resultResponse
|
||||
|
||||
|
@ -11,6 +11,15 @@ from HelperGetUserThing import implGetUser_
|
||||
from HelperUploadUserPlayLog import apiUploadUserPlaylog
|
||||
from HelperUserAll import generateFullUserAll
|
||||
|
||||
def apiQueryLoginBonus(userId:int) -> str:
|
||||
'''ログインボーナスを取得する API リクエスター'''
|
||||
data = json.dumps({
|
||||
"userId": int(userId),
|
||||
"nextIndex": 0,
|
||||
"maxCount": 2000
|
||||
})
|
||||
return apiSDGB(data, "GetUserLoginBonusApi", userId)
|
||||
|
||||
def implLoginBonus(userId: int, currentLoginTimestamp:int, currentLoginResult, bonusGenerateMode=2):
|
||||
'''
|
||||
ログインボーナスデータをアップロードする
|
||||
@ -73,10 +82,10 @@ def implLoginBonus(userId: int, currentLoginTimestamp:int, currentLoginResult, b
|
||||
"nextIndex": 0,
|
||||
"maxCount": 2000
|
||||
})
|
||||
logger.debug(json.loads(apiSDGB(data, "GetUserLoginBonusApi", userId)))
|
||||
finalLoginBonusData = json.loads(apiSDGB(data, "GetUserLoginBonusApi", userId))
|
||||
###### PRODUCTION 用には、上記のコードを削除してください
|
||||
|
||||
return currentUserAllResult
|
||||
return finalLoginBonusData
|
||||
|
||||
def generateLoginBonusList(userId, generateMode=1):
|
||||
'''
|
||||
@ -88,7 +97,7 @@ def generateLoginBonusList(userId, generateMode=1):
|
||||
# HDDから、ログインボーナスデータを読み込む
|
||||
# アップデートがある場合、このファイルを更新する必要があります
|
||||
# 必ず最新のデータを使用してください
|
||||
with open('loginBonus.json') as file:
|
||||
with open('loginBonus.json', encoding='utf-8') as file:
|
||||
cache = json.load(file)
|
||||
loginBonusIdList = [item['id'] for item in cache]
|
||||
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
|
||||
|
@ -12,19 +12,6 @@ from HelperUserAll import generateFullUserAll
|
||||
def implUnlockThing(newUserItemList, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str:
|
||||
'''
|
||||
解锁东西的实现
|
||||
Note: itemKind 如下
|
||||
PLATE = 1 # 姓名框
|
||||
TITLE = 2 # 称号
|
||||
ICON = 3 # 头像
|
||||
PRESENT = 4
|
||||
MUSIC = 5 # 乐曲
|
||||
MUSIC_MASTER = 6
|
||||
MUSIC_RE_MASTER = 7
|
||||
MUSIC_STRONG = 8
|
||||
CHARACTER = 9 # 旅行伙伴
|
||||
PARTNER = 10 # 搭档
|
||||
FRAME = 11 # 背景板
|
||||
TICKET = 12 # 功能票
|
||||
'''
|
||||
# 上传上去的歌曲记录
|
||||
musicDataToBeUploaded = ({
|
||||
@ -70,3 +57,4 @@ def implUnlockThing(newUserItemList, userId: int, currentLoginTimestamp:int, cur
|
||||
|
||||
logger.info("解锁东西:结果:"+ str(currentUserAllResult))
|
||||
return currentUserAllResult
|
||||
|
||||
|
@ -5,4 +5,4 @@ placeName = "赛博时空枣庄市中店"
|
||||
clientId = "A63E01E9564"
|
||||
|
||||
# 日本精工,安全防漏
|
||||
from Private_Static_Settings import *
|
||||
#from Private_Static_Settings import *
|
||||
|
0
__init__.py
Normal file
0
__init__.py
Normal file
Loading…
x
Reference in New Issue
Block a user