mirror of
https://github.com/Remik1r3n/maimaiDX-Api.git
synced 2025-05-20 07:27:28 +08:00
minus improvements
This commit is contained in:
parent
a714fc5655
commit
1b852dee9a
@ -59,13 +59,13 @@ class aes_pkcs7(object):
|
|||||||
def SDGBApiHash(api):
|
def SDGBApiHash(api):
|
||||||
return hashlib.md5((api+"MaimaiChn"+ObfuscateParam).encode()).hexdigest()
|
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 通讯用函数
|
舞萌DX 2024 API 通讯用函数
|
||||||
:param data: 请求数据
|
:param data: 请求数据
|
||||||
:param useApi: 使用的 API
|
:param useApi: 使用的 API
|
||||||
:param agentExtraData: UA 附加信息,机台相关则为狗号(如A63E01E9564),用户相关则为 UID
|
:param agentExtraData: UA 附加信息,机台相关则为狗号(如A63E01E9564),用户相关则为 UID
|
||||||
:param maxRetry: 最大重试次数, 默认为 3
|
:param maxRetry: 最大重试次数,
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# 历史遗留代码有时候会传入 int,故先全部转 str
|
# 历史遗留代码有时候会传入 int,故先全部转 str
|
||||||
@ -123,7 +123,7 @@ def apiSDGB(data:str, useApi, agentExtraData, maxRetries=5):
|
|||||||
continue
|
continue
|
||||||
# 解压成功,解密请求并返回
|
# 解压成功,解密请求并返回
|
||||||
resultResponse = unpad(aes.decrypt(responseDecompressed), 16).decode()
|
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))
|
logger.debug("TitleServer Response: " + str(resultResponse))
|
||||||
return resultResponse
|
return resultResponse
|
||||||
|
|
||||||
|
@ -11,6 +11,15 @@ from HelperGetUserThing import implGetUser_
|
|||||||
from HelperUploadUserPlayLog import apiUploadUserPlaylog
|
from HelperUploadUserPlayLog import apiUploadUserPlaylog
|
||||||
from HelperUserAll import generateFullUserAll
|
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):
|
def implLoginBonus(userId: int, currentLoginTimestamp:int, currentLoginResult, bonusGenerateMode=2):
|
||||||
'''
|
'''
|
||||||
ログインボーナスデータをアップロードする
|
ログインボーナスデータをアップロードする
|
||||||
@ -73,10 +82,10 @@ def implLoginBonus(userId: int, currentLoginTimestamp:int, currentLoginResult, b
|
|||||||
"nextIndex": 0,
|
"nextIndex": 0,
|
||||||
"maxCount": 2000
|
"maxCount": 2000
|
||||||
})
|
})
|
||||||
logger.debug(json.loads(apiSDGB(data, "GetUserLoginBonusApi", userId)))
|
finalLoginBonusData = json.loads(apiSDGB(data, "GetUserLoginBonusApi", userId))
|
||||||
###### PRODUCTION 用には、上記のコードを削除してください
|
###### PRODUCTION 用には、上記のコードを削除してください
|
||||||
|
|
||||||
return currentUserAllResult
|
return finalLoginBonusData
|
||||||
|
|
||||||
def generateLoginBonusList(userId, generateMode=1):
|
def generateLoginBonusList(userId, generateMode=1):
|
||||||
'''
|
'''
|
||||||
@ -88,7 +97,7 @@ def generateLoginBonusList(userId, generateMode=1):
|
|||||||
# HDDから、ログインボーナスデータを読み込む
|
# HDDから、ログインボーナスデータを読み込む
|
||||||
# アップデートがある場合、このファイルを更新する必要があります
|
# アップデートがある場合、このファイルを更新する必要があります
|
||||||
# 必ず最新のデータを使用してください
|
# 必ず最新のデータを使用してください
|
||||||
with open('loginBonus.json') as file:
|
with open('loginBonus.json', encoding='utf-8') as file:
|
||||||
cache = json.load(file)
|
cache = json.load(file)
|
||||||
loginBonusIdList = [item['id'] for item in cache]
|
loginBonusIdList = [item['id'] for item in cache]
|
||||||
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
|
logger.debug(f"ログインボーナスIDリスト: {loginBonusIdList}")
|
||||||
|
@ -12,19 +12,6 @@ from HelperUserAll import generateFullUserAll
|
|||||||
def implUnlockThing(newUserItemList, userId: int, currentLoginTimestamp:int, currentLoginResult) -> str:
|
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 = ({
|
musicDataToBeUploaded = ({
|
||||||
@ -70,3 +57,4 @@ def implUnlockThing(newUserItemList, userId: int, currentLoginTimestamp:int, cur
|
|||||||
|
|
||||||
logger.info("解锁东西:结果:"+ str(currentUserAllResult))
|
logger.info("解锁东西:结果:"+ str(currentUserAllResult))
|
||||||
return currentUserAllResult
|
return currentUserAllResult
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@ placeName = "赛博时空枣庄市中店"
|
|||||||
clientId = "A63E01E9564"
|
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