This commit is contained in:
Your Name 2025-02-02 22:46:39 +08:00
commit c2fa4e7770
3 changed files with 19 additions and 16 deletions

View File

@ -1,9 +1,16 @@
# 100% Standalone 的国服 AimeDB 通讯实现
import hashlib
import time
import requests
import json
import re
# 常量
CHIP_ID = "A63E-01E68606624"
COMMON_KEY = "XcW5FW4cPArBXEk4vzKz3CIrMuA5EVVW"
API_URL = "http://ai.sys-allnet.cn/wc_aime/api/get_data"
# 计算 SHA256
def getSHA256(input_str):
"""SHA256计算"""
@ -21,15 +28,11 @@ def calcSEGAAimeDBAuthKey(varString:str, timestamp:str, commonKey:str="XcW5FW4cP
def apiAimeDB(qrCode):
"""AimeDB 扫码 API 实现"""
CHIP_ID = "A63E-01E68606624"
COMMON_KEY = "XcW5FW4cPArBXEk4vzKz3CIrMuA5EVVW"
API_URL = "http://ai.sys-allnet.cn/wc_aime/api/get_data"
# 生成一个时间戳
timestamp = generateSEGATimestamp()
# 使用时间戳计算 key
currentKey = calcSEGAAimeDBAuthKey(qrCode, timestamp, COMMON_KEY)
currentKey = calcSEGAAimeDBAuthKey(CHIP_ID, timestamp, COMMON_KEY)
# 构造请求数据
payload = {

View File

@ -138,7 +138,7 @@ def apiSDGB(data:str, useApi, agentExtraData, noLog=False):
except Exception as e:
logger.warning(f"Request Failed! Will now retry.. {e}")
retries += 1
time.sleep(4)
time.sleep(3)
else:
# 重试次数用尽WahlapServerBoomedError
raise WahlapServerBoomedError("重试多次仍然不能成功请求")

View File

@ -23,21 +23,21 @@ def apiBuyTicket(userId:int, ticketType:int, price:int, playerRating:int, playCo
# 构造请求数据 Payload
data = json.dumps({
"userId": userId,
"userChargelog": {
"chargeId": ticketType,
"price": price,
"purchaseDate": (datetime.now(pytz.timezone('Asia/Shanghai')) - timedelta(hours=1)).strftime("%Y-%m-%d %H:%M:%S.0"),
"playCount": playCount,
"playerRating": playerRating,
"placeId": placeId,
"regionId": regionId,
"clientId": clientId
},
"userCharge": {
"chargeId": ticketType,
"stock": 1,
"purchaseDate": (datetime.now(pytz.timezone('Asia/Shanghai')) - timedelta(hours=1)).strftime("%Y-%m-%d %H:%M:%S.0"),
"validDate": (datetime.now(pytz.timezone('Asia/Shanghai')) - timedelta(hours=1) + timedelta(days=90)).replace(hour=4, minute=0, second=0).strftime("%Y-%m-%d %H:%M:%S")
},
"userChargelog": {
"chargeId": ticketType,
"price": price,
"purchaseDate": (datetime.now(pytz.timezone('Asia/Shanghai')) - timedelta(hours=1)).strftime("%Y-%m-%d %H:%M:%S.0"),
"playcount": playCount,
"playerRating": playerRating,
"placeId": placeId,
"regionId": regionId,
"clientId": clientId
}
})
# 发送请求,返回最终得到的 Json String 回执