🐛 Fix the IntegrityError caused by not executing the update command when updating player_info data

This commit is contained in:
洛水居室 2023-03-23 10:49:36 +08:00
parent d429553488
commit 064a4083c5
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -121,7 +121,7 @@ class PlayerInfoService(BaseService):
player_info_enka = await self.get_player_info_from_enka(player.player_id) player_info_enka = await self.get_player_info_from_enka(player.player_id)
if player_info_enka is None: if player_info_enka is None:
player_info.last_save_time = datetime.now() player_info.last_save_time = datetime.now()
await self._players_info_repository.update(PlayerInfoSQLModel.from_orm(player_info)) await self._players_info_repository.update(player_info)
await self.set_form_cache(player_info) await self.set_form_cache(player_info)
return player_info return player_info
player_info.nickname = player_info_enka.nickname player_info.nickname = player_info_enka.nickname
@ -130,7 +130,7 @@ class PlayerInfoService(BaseService):
player_info.hand_image = player_info_enka.avatar.id player_info.hand_image = player_info_enka.avatar.id
player_info.nickname = player_info_enka.nickname player_info.nickname = player_info_enka.nickname
player_info.last_save_time = datetime.now() player_info.last_save_time = datetime.now()
await self._players_info_repository.update(PlayerInfoSQLModel.from_orm(player_info)) await self._players_info_repository.update(player_info)
await self.set_form_cache(player_info) await self.set_form_cache(player_info)
return player_info return player_info