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