发票适配2025
This commit is contained in:
@@ -46,13 +46,16 @@ def apiQueryTicket(userId:int) -> str:
|
||||
|
||||
def apiBuyTicket(userId:int, ticketType:int, price:int, playerRating:int, playCount:int) -> str:
|
||||
'''倍票购买 API 的请求器'''
|
||||
|
||||
nowTime = datetime.now(pytz.timezone('Asia/Shanghai'))
|
||||
|
||||
# 构造请求数据 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"),
|
||||
"purchaseDate": nowTime.strftime("%Y-%m-%d %H:%M:%S.0"),
|
||||
"playCount": playCount,
|
||||
"playerRating": playerRating,
|
||||
"placeId": placeId,
|
||||
@@ -62,8 +65,8 @@ def apiBuyTicket(userId:int, ticketType:int, price:int, playerRating:int, playCo
|
||||
"userCharge": {
|
||||
"chargeId": ticketType,
|
||||
"stock": 0,
|
||||
"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")
|
||||
"purchaseDate": nowTime.strftime("%Y-%m-%d %H:%M:%S.0"),
|
||||
"validDate": nowTime + timedelta(days=90).replace(hour=4, minute=0, second=0).strftime("%Y-%m-%d %H:%M:%S")
|
||||
}
|
||||
})
|
||||
# 发送请求,返回最终得到的 Json String 回执
|
||||
|
||||
Reference in New Issue
Block a user