mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2026-02-11 18:47:26 +08:00
[Enhance] Self account delete
- Add support for users destroy their own accounts
This commit is contained in:
@@ -2,7 +2,7 @@ import os
|
||||
import time
|
||||
|
||||
from core.init import FileChecker
|
||||
from core.operation import RefreshAllScoreRating, RefreshSongFileCache, SaveUpdateScore, UnlockUserItem
|
||||
from core.operation import RefreshAllScoreRating, RefreshSongFileCache, SaveUpdateScore, UnlockUserItem, DeleteUserScore
|
||||
from core.rank import RankList
|
||||
from core.sql import Connect
|
||||
from core.user import User
|
||||
@@ -1366,7 +1366,10 @@ def delete_user_score():
|
||||
user_id = c.fetchone()
|
||||
if user_id:
|
||||
user_id = user_id[0]
|
||||
web.system.clear_user_score(c, user_id)
|
||||
c.execute('''update user set rating_ptt=0, song_id='', difficulty=0, score=0, shiny_perfect_count=0, perfect_count=0, near_count=0, miss_count=0, health=0, time_played=0, rating=0, world_rank_score=0 where user_id=:a''', {
|
||||
'a': user_id})
|
||||
c.connection.commit()
|
||||
DeleteUserScore().set_params(user_id=user_id).run()
|
||||
flash("用户成绩删除成功 Successfully delete the user's scores.")
|
||||
|
||||
else:
|
||||
|
||||
@@ -261,12 +261,3 @@ def ban_one_user(c, user_id):
|
||||
{'a': user_id})
|
||||
c.execute('''delete from login where user_id=:a''', {'a': user_id})
|
||||
return
|
||||
|
||||
|
||||
def clear_user_score(c, user_id):
|
||||
# 清除用户所有成绩,包括best_score和recent30,以及recent数据,但不包括云端存档
|
||||
c.execute('''update user set rating_ptt=0, song_id='', difficulty=0, score=0, shiny_perfect_count=0, perfect_count=0, near_count=0, miss_count=0, health=0, time_played=0, rating=0, world_rank_score=0 where user_id=:a''',
|
||||
{'a': user_id})
|
||||
c.execute('''delete from best_score where user_id=:a''', {'a': user_id})
|
||||
c.execute('''delete from recent30 where user_id=:a''', {'a': user_id})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user