修复BUG(权限接口BUG): permission_interface_dict 字段bug
							parent
							
								
									6591b7f48e
								
							
						
					
					
						commit
						bdc87d7702
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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'):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue