allnet: fix playhistory
This commit is contained in:
@ -611,12 +611,13 @@ class BillingServlet:
|
|||||||
"playlimit": req.playlimit,
|
"playlimit": req.playlimit,
|
||||||
"messages": []
|
"messages": []
|
||||||
}
|
}
|
||||||
|
playhist = "000000/0:000000/0:000000/0"
|
||||||
|
|
||||||
if machine is not None:
|
if machine is not None:
|
||||||
if self.config.allnet.save_billing:
|
if self.config.allnet.save_billing:
|
||||||
lastcredit = await self.data.arcade.billing_get_credit(machine['id'], req.gameid)
|
lastcredit = await self.data.arcade.billing_get_last_playcount(machine['id'], req.gameid)
|
||||||
if lastcredit is not None:
|
if lastcredit is not None:
|
||||||
last_playct = lastcredit['playcount']
|
last_playct = lastcredit['playct']
|
||||||
else:
|
else:
|
||||||
last_playct = 0
|
last_playct = 0
|
||||||
|
|
||||||
@ -630,15 +631,9 @@ class BillingServlet:
|
|||||||
if plays is not None and len(plays) > 0:
|
if plays is not None and len(plays) > 0:
|
||||||
playhist = ""
|
playhist = ""
|
||||||
|
|
||||||
for x in range(len(plays), 0, -1): playhist += f"{plays[x]['year']:04d}{plays[x]['month']:02d}/{plays[x]['playct']}:"
|
for x in range(len(plays) - 1, -1, -1): playhist += f"{plays[x]['year']:04d}{plays[x]['month']:02d}/{plays[x]['playct']}:"
|
||||||
playhist = playhist[:-1]
|
playhist = playhist[:-1]
|
||||||
|
|
||||||
else:
|
|
||||||
playhist = "000000/0:000000/0:000000/0"
|
|
||||||
|
|
||||||
else:
|
|
||||||
playhist = "000000/0:000000/0:000000/0"
|
|
||||||
|
|
||||||
for x in range(1, len(req_dict)):
|
for x in range(1, len(req_dict)):
|
||||||
if not req_dict[x]:
|
if not req_dict[x]:
|
||||||
continue
|
continue
|
||||||
@ -693,7 +688,7 @@ class BillingServlet:
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
f"Credit Trace from {req.keychipid}: {tmp.operation_type} mode, {tmp.credit_rate} coins per credit, Consumed {tmp.credit0} | {tmp.credit1} | {tmp.credit2} | {tmp.credit3} | {tmp.credit4} | {tmp.credit5} | {tmp.credit6} | {tmp.credit7} | "
|
f"Credit Trace from {req.keychipid}: {tmp.operation_type} mode, {tmp.credit_rate} coins per credit, breakdown: {tmp.credit0} | {tmp.credit1} | {tmp.credit2} | {tmp.credit3} | {tmp.credit4} | {tmp.credit5} | {tmp.credit6} | {tmp.credit7} | "
|
||||||
)
|
)
|
||||||
|
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
|
@ -426,7 +426,7 @@ class ArcadeData(BaseData):
|
|||||||
product_code=product_code,
|
product_code=product_code,
|
||||||
product_count=product_count,
|
product_count=product_count,
|
||||||
func_type=func_type,
|
func_type=func_type,
|
||||||
player_num=player_num
|
player_number=player_num
|
||||||
))
|
))
|
||||||
|
|
||||||
if result is None:
|
if result is None:
|
||||||
@ -434,6 +434,13 @@ class ArcadeData(BaseData):
|
|||||||
return None
|
return None
|
||||||
return result.lastrowid
|
return result.lastrowid
|
||||||
|
|
||||||
|
async def billing_get_last_charge(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||||
|
result = await self.execute(billing_charge.select(
|
||||||
|
and_(billing_charge.c.machine == machine_id, billing_charge.c.game_id == game_id)
|
||||||
|
).order_by(billing_charge.c.id.desc()).limit(3))
|
||||||
|
if result:
|
||||||
|
return result.fetchone()
|
||||||
|
|
||||||
async def billing_set_credit(self, machine_id: int, game_id: str, chute_type: int, service_type: int, op_mode: int, coin_rate0: int, coin_rate1: int,
|
async def billing_set_credit(self, machine_id: int, game_id: str, chute_type: int, service_type: int, op_mode: int, coin_rate0: int, coin_rate1: int,
|
||||||
bonus_adder: int, coin_to_credit_rate: int, coin_count_slot0: int, coin_count_slot1: int, coin_count_slot2: int, coin_count_slot3: int,
|
bonus_adder: int, coin_to_credit_rate: int, coin_count_slot0: int, coin_count_slot1: int, coin_count_slot2: int, coin_count_slot3: int,
|
||||||
coin_count_slot4: int, coin_count_slot5: int, coin_count_slot6: int, coin_count_slot7: int) -> Optional[int]:
|
coin_count_slot4: int, coin_count_slot5: int, coin_count_slot6: int, coin_count_slot7: int) -> Optional[int]:
|
||||||
@ -483,7 +490,9 @@ class ArcadeData(BaseData):
|
|||||||
return result.lastrowid
|
return result.lastrowid
|
||||||
|
|
||||||
async def billing_get_credit(self, machine_id: int, game_id: str) -> Optional[Row]:
|
async def billing_get_credit(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||||
result = await self.execute(billing_credit.select(billing_credit.c.machine == machine_id))
|
result = await self.execute(billing_credit.select(
|
||||||
|
and_(billing_credit.c.machine == machine_id, billing_credit.c.game_id == game_id)
|
||||||
|
))
|
||||||
if result:
|
if result:
|
||||||
return result.fetchone()
|
return result.fetchone()
|
||||||
|
|
||||||
@ -512,6 +521,15 @@ class ArcadeData(BaseData):
|
|||||||
if result is not None:
|
if result is not None:
|
||||||
return result.fetchall()
|
return result.fetchall()
|
||||||
|
|
||||||
|
async def billing_get_last_playcount(self, machine_id: int, game_id: str) -> Optional[Row]:
|
||||||
|
result = await self.execute(billing_playct.select(and_(
|
||||||
|
billing_playct.c.machine == machine_id,
|
||||||
|
billing_playct.c.game_id == game_id
|
||||||
|
)).order_by(billing_playct.c.year.desc(), billing_playct.c.month.desc()).limit(1))
|
||||||
|
|
||||||
|
if result is not None:
|
||||||
|
return result.fetchone()
|
||||||
|
|
||||||
def format_serial(
|
def format_serial(
|
||||||
self, platform_code: str, platform_rev: int, serial_letter: str, serial_num: int, append: int, dash: bool = False
|
self, platform_code: str, platform_rev: int, serial_letter: str, serial_num: int, append: int, dash: bool = False
|
||||||
) -> str:
|
) -> str:
|
||||||
|
Reference in New Issue
Block a user