🐛 Fix instance PlayerInfoSQLModel is not persisted

This commit is contained in:
洛水居室 2023-03-17 17:45:11 +08:00
parent 72154924be
commit 15f50253a3
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 5 additions and 3 deletions

View File

@ -180,5 +180,5 @@ class PlayerInfoService(BaseService):
async def add(self, player_info: PlayerInfo): async def add(self, player_info: PlayerInfo):
await self._players_info_repository.add(PlayerInfoSQLModel.from_orm(player_info)) await self._players_info_repository.add(PlayerInfoSQLModel.from_orm(player_info))
async def delete(self, player_info: PlayerInfo): async def delete(self, player_info: PlayerInfoSQLModel):
await self._players_info_repository.delete(PlayerInfoSQLModel.from_orm(player_info)) await self._players_info_repository.delete(player_info)

View File

@ -218,7 +218,9 @@ class PlayersManagesPlugin(Plugin):
cookies = await self.cookies_service.get(player.user_id, player.account_id, player.region) cookies = await self.cookies_service.get(player.user_id, player.account_id, player.region)
if cookies: if cookies:
await self.cookies_service.delete(cookies) await self.cookies_service.delete(cookies)
await self.player_info_service.delete(player_info) player_info = await self.player_info_service.get_form_sql(player)
if player_info is not None:
await self.player_info_service.delete(player_info)
await callback_query.edit_message_text( await callback_query.edit_message_text(
f"成功删除 {player.player_id} ", reply_markup=InlineKeyboardMarkup(buttons) f"成功删除 {player.player_id} ", reply_markup=InlineKeyboardMarkup(buttons)
) )