Преглед изворни кода

完善上传uid文件数据判断逻辑

locky пре 3 година
родитељ
комит
05f2c3a13d
2 измењених фајлова са 11 додато и 5 уклоњено
  1. 7 3
      Controller/VPGController.py
  2. 4 2
      Object/uidManageResponseObject.py

+ 7 - 3
Controller/VPGController.py

@@ -240,13 +240,17 @@ def do_upload_uid(request):
                     init_string=init_string,
                     init_string_app=init_string_app
                 )
-                if '-' in uid:  # 尚云完整uid,eg.ACN-000005-FHCGR,VRWEDU -> ACN000005FHCGR
-                    if ',' in uid:  # 必须包含','
+                # 尚云完整uid,eg.ACN-000005-FHCGR,VRWEDU -> ACN000005FHCGR,必须包含','
+                if p2p == '尚云':
+                    if '-' in uid and ',' in uid:
                         UID.full_uid_code = uid
                         uid_split = uid.split('-')
                         uid = uid_split[0] + uid_split[1] + uid_split[2].split(',')[0]
                     else:
-                        return response.json(700)
+                        return response.json(376)
+                # tutk uid长度为14或20
+                elif len(uid) != 14 or len(uid) != 20:
+                    return response.json(376)
                 UID.uid = uid
                 bulk.append(UID)
 

+ 4 - 2
Object/uidManageResponseObject.py

@@ -47,7 +47,8 @@ class uidManageResponseObject(object):
             373: '没有相应的公司',
             374: '没有相应的地区',
             375: 'uid不足',
-            404: 'You don not have permission to access this!',
+            376: 'uid数据有误',
+            404: '没有访问权限!',
             444: '请确认参数的正确性!',
             1112: '您输入的两次密码不一致!',
             208: '只能预定当天的或者以后的!',
@@ -92,7 +93,8 @@ class uidManageResponseObject(object):
             309: 'You have no access',
             373: 'No corresponding company',
             374: 'Region does not exist',
-            375: 'uid不足',
+            375: 'Insufficient uid',
+            376: 'wrong uid data',
             404: 'You don not have permission to access this!',
             444: 'Please confirm the correctness of the parameters!',
             1112: 'The two passwords you entered do not match!',