Jelajahi Sumber

设置子账号分配限制

peng 2 tahun lalu
induk
melakukan
4b91eb6b7f

+ 3 - 0
Controller/SerialNumberController.py

@@ -404,6 +404,9 @@ class SerialNumberView(View):
         if not allot_user_qs.exists():
             return response.json(444, 'username')
 
+        if allot_user_qs[0].permission != '2':
+            return response.json(109)
+
         # 取出对应区域可用的UID分配给allot_user
         sn_qs = SerialNumberModel.objects.filter(use_status=3)[0:quantity]
         sns = []

+ 3 - 0
Controller/UIDController.py

@@ -150,6 +150,9 @@ class UIDView(View):
         if not allot_user_qs.exists():
             return response.json(444, 'username')
 
+        if allot_user_qs[0].permission != '1':
+            return response.json(109)
+
         # 取出对应区域可用的UID分配给allot_user
         uid_qs = UIDModel.objects.filter(area=area, status=0)
         count = uid_qs.count()

+ 2 - 0
Object/ResponseObject.py

@@ -35,6 +35,7 @@ class ResponseObject(object):
             104: '邮箱用户帐户不存在!',
             107: '用户名格式不符合规则!',
             108: '邮箱格式不符合规则!',
+            109: '该账号无法分配!',
             110: '因为用户未激活,用户是无效用户!',
             111: '您输入的密码不正确!',
             120: '验证码已过期或不存在、请重新获得验证码!',
@@ -76,6 +77,7 @@ class ResponseObject(object):
             104: 'The mailbox user account does not exist!',
             107: 'The username format does not conform to the rules!',
             108: 'The mailbox format does not conform to the rules! ',
+            109: 'The account cannot be allocated!',
             110: 'Because the user is not activated, the user is an invalid user!',
             111: 'The password you entered is incorrect!',
             120: 'The captcha has expired or does not exist, please obtain the captcha again!',