Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/apps/system/crud/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from common.core.sqlbot_cache import cache, clear_cache
from common.utils.locale import I18n
from common.utils.utils import SQLBotLogUtil
from ..models.user import UserModel
from ..models.user import UserModel, UserPlatformModel
from common.core.security import verify_md5pwd
import re

Expand Down Expand Up @@ -69,6 +69,9 @@ async def single_delete(session: SessionDep, id: int):
user_model: UserModel = get_db_user(session = session, user_id = id)
del_stmt = sqlmodel_delete(UserWsModel).where(UserWsModel.uid == id)
session.exec(del_stmt)
if user_model and user_model.origin and user_model.origin != 0:
platform_del_stmt = sqlmodel_delete(UserPlatformModel).where(UserPlatformModel.uid == id)
session.exec(platform_del_stmt)
session.delete(user_model)
session.commit()

Expand Down