3
2
forked from Dniel97/artemis

ongeki: fix handle_upsert_client_setting_api_request

This commit is contained in:
Hay1tsme 2023-12-04 11:40:20 -05:00
parent 936316f129
commit 262155f83f
2 changed files with 7 additions and 6 deletions

View File

@ -268,7 +268,9 @@ class OngekiBase:
client_id = data["clientId"] client_id = data["clientId"]
client_setting_data = data["clientSetting"] client_setting_data = data["clientSetting"]
self.data.static.put_client_setting_data(client_id, client_setting_data) cab = self.data.arcade.get_machine(client_id)
if cab is not None:
self.data.static.put_client_setting_data(cab['id'], client_setting_data)
return {"returnCode": 1, "apiName": "UpsertClientSettingApi"} return {"returnCode": 1, "apiName": "UpsertClientSettingApi"}
def handle_upsert_client_testmode_api_request(self, data: Dict) -> Dict: def handle_upsert_client_testmode_api_request(self, data: Dict) -> Dict:

View File

@ -486,13 +486,12 @@ class OngekiStaticData(BaseData):
return None return None
return result.lastrowid return result.lastrowid
def put_client_setting_data(self, client_id: str, client_setting_data: Dict) -> Optional[List[Dict]]: def put_client_setting_data(self, machine_id: int, client_setting_data: Dict) -> Optional[List[Dict]]:
sql = insert(machine).values(data=client_setting_data) sql = machine.update(machine.c.id == machine_id).values(data=client_setting_data)
conflict = sql.on_duplicate_key_update(serial=client_id)
result = self.execute(conflict) result = self.execute(sql)
if result is None: if result is None:
self.logger.warning(f"clientId: {client_id} Failed to update ClientSetting data"), self.logger.warning(f"machine_id: {machine_id} Failed to update ClientSetting data"),
return None return None
return result.lastrowid return result.lastrowid