!16 紧急bug修复

Merge pull request !16 from 李强/dvadmin-dev
pull/16/MERGE
李强 2021-04-02 02:25:13 +08:00 committed by Gitee
commit 15ae4e86ad
3 changed files with 6 additions and 3 deletions

View File

@ -327,4 +327,4 @@ CELERYBEAT_SCHEDULER = 'django_celery_beat.schedulers.DatabaseScheduler' # Back
# ************** 其他配置 ************** #
# ================================================= #
# 接口权限
INTERFACE_PERMISSION = {locals().get("INTERFACE_PERMISSION", False)}
INTERFACE_PERMISSION = locals().get("INTERFACE_PERMISSION", False)

View File

@ -41,7 +41,10 @@ class Menu(CoreModel):
获取所有接口列表
:return:
"""
interface_dict = cache.get('permission_interface_dict', {})
try:
interface_dict = cache.get('permission_interface_dict', {})
except:
interface_dict = {}
if not interface_dict:
for ele in Menu.objects.filter(~Q(interface_path=''), ~Q(interface_path=None), status='1', ).values(
'interface_path', 'interface_method'):

View File

@ -28,7 +28,7 @@ class UserProfile(AbstractUser, CoreModel):
@property
def get_user_interface_dict(self):
interface_dict = cache.get(f'permission_interface_dict{self.username}', {})
interface_dict = cache.get(f'permission_interface_dict_{self.username}', {})
if not interface_dict:
for ele in self.role.filter(status='1', menu__status='1').values('menu__interface_path',
'menu__interface_method').distinct():