mirror of
https://github.com/Lost-MSth/Arcaea-server.git
synced 2025-12-14 08:06:23 +08:00
[Enhance][Bug fix] User settings & /user/me/setting error
- Add a new settings 'mp_notification_enabled' - Fix a bug that user can not change online settings. (Show Potential/Stamina Notification/Invite Notification)
This commit is contained in:
@@ -305,6 +305,7 @@ class UserInfo(User):
|
||||
self.recent_score = Score()
|
||||
self.favorite_character = None
|
||||
self.max_stamina_notification_enabled = False
|
||||
self.mp_notification_enabled = False
|
||||
self.prog_boost: int = 0
|
||||
self.beyond_boost_gauge: float = 0
|
||||
self.kanae_stored_prog: float = 0
|
||||
@@ -495,7 +496,8 @@ class UserInfo(User):
|
||||
"settings": {
|
||||
"favorite_character": favorite_character_id,
|
||||
"is_hide_rating": self.is_hide_rating,
|
||||
"max_stamina_notification_enabled": self.max_stamina_notification_enabled
|
||||
"max_stamina_notification_enabled": self.max_stamina_notification_enabled,
|
||||
"mp_notification_enabled": self.mp_notification_enabled
|
||||
},
|
||||
"user_id": self.user_id,
|
||||
"name": self.name,
|
||||
@@ -560,6 +562,7 @@ class UserInfo(User):
|
||||
self.favorite_character = None if x[23] == - \
|
||||
1 else UserCharacter(self.c, x[23])
|
||||
self.max_stamina_notification_enabled = x[24] == 1
|
||||
self.mp_notification_enabled = x[37] == 1
|
||||
self.current_map = Map(x[25]) if x[25] is not None else Map('')
|
||||
self.ticket = x[26]
|
||||
self.prog_boost = x[27] if x[27] is not None else 0
|
||||
@@ -661,6 +664,20 @@ class UserInfo(User):
|
||||
self.rating_ptt = x[1]
|
||||
self.is_hide_rating = x[2] == 1
|
||||
|
||||
def select_user_about_settings(self) -> None:
|
||||
'''
|
||||
查询 user 表有关设置的信息
|
||||
'''
|
||||
self.c.execute(
|
||||
'''select is_hide_rating, max_stamina_notification_enabled, mp_notification_enabled from user where user_id=?''', (self.user_id,)
|
||||
x = self.c.fetchone()
|
||||
if not x:
|
||||
raise NoData('No user.', 108, -3)
|
||||
|
||||
self.is_hide_rating = x[0] == 1
|
||||
self.max_stamina_notification_enabled = x[1] == 1
|
||||
self.mp_notification_enabled = x[2] == 1
|
||||
|
||||
@property
|
||||
def global_rank(self) -> int:
|
||||
'''用户世界排名,如果超过设定最大值,返回0'''
|
||||
|
||||
@@ -35,7 +35,8 @@ max_stamina_ts int,
|
||||
stamina int,
|
||||
world_mode_locked_end_ts int,
|
||||
beyond_boost_gauge real default 0,
|
||||
kanae_stored_prog real default 0
|
||||
kanae_stored_prog real default 0,
|
||||
mp_notification_enabled int
|
||||
);
|
||||
create table if not exists login(access_token text,
|
||||
user_id int,
|
||||
|
||||
@@ -157,7 +157,8 @@ def sys_set(user_id, set_arg):
|
||||
user.change_favorite_character(int(value))
|
||||
else:
|
||||
value = 'true' == value
|
||||
if set_arg in ('is_hide_rating', 'max_stamina_notification_enabled'):
|
||||
if set_arg in ('is_hide_rating', 'max_stamina_notification_enabled', 'mp_notification_enabled'):
|
||||
user.select_user_about_settings()
|
||||
user.update_user_one_column(set_arg, value)
|
||||
return success_return(user.to_dict())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user