فهرست منبع

Merge branch 'test' of http://192.168.136.99:3000/servers/ASJServer

locky 3 سال پیش
والد
کامیت
53ee574274

+ 4 - 1
AdminController/DeviceManagementController.py

@@ -65,6 +65,7 @@ class DeviceManagement(View):
         pageNo = request_dict.get('pageNo', None)
         pageSize = request_dict.get('pageSize', None)
         UID = request_dict.get('UID', None)
+        serialNumber = request_dict.get('serialNumber', None)
         NickName = request_dict.get('NickName', None)
         username = request_dict.get('username', None)
 
@@ -75,9 +76,11 @@ class DeviceManagement(View):
         line = int(pageSize)
 
         try:
-            if UID or NickName or username:    # 条件查询
+            if UID or serialNumber or NickName or username:    # 条件查询
                 if UID:
                     device_info_qs = Device_Info.objects.filter(UID__contains=UID)
+                if serialNumber:
+                    device_info_qs = Device_Info.objects.filter(serial_number__contains=serialNumber)
                 if NickName:
                     device_info_qs = Device_Info.objects.filter(NickName__contains=NickName)
                 if username:

+ 2 - 1
Controller/DeviceConfirmRegion.py

@@ -109,11 +109,12 @@ class ConfirmRegionV2(TemplateView):
                 api = RegionModel.objects.filter(continent_code='NA').values('api')[0]['api']
 
             # 更新或创建设备域名数据
+            data_dict['api'] = api
             if device_domain_qs.exists():
                 device_domain_qs.update(**data_dict)
             else:
                 device_domain_qs.create(**data_dict)
-            return response.json(0, {"request_api_url": api})
+            return response.json(0, {'request_api_url': api})
         except Exception as e:
             print(e)
             return response.json(500, repr(e))

+ 11 - 4
Controller/VPGController.py

@@ -240,10 +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
-                    UID.full_uid_code = uid
-                    uid_split = uid.split('-')
-                    uid = uid_split[0] + uid_split[1] + uid_split[2].split(',')[0]
+                # 尚云完整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(376)
+                # tutk uid长度为14或20
+                elif len(uid) != 14 and len(uid) != 20:
+                    return response.json(376)
                 UID.uid = uid
                 bulk.append(UID)
 

+ 1 - 0
Model/models.py

@@ -1903,6 +1903,7 @@ class DeviceDomainModel(models.Model):
     serial_number = models.CharField(max_length=9, default='', unique=True, db_index=True, verbose_name='序列号')
     ip = models.CharField(default='', max_length=32, verbose_name='ip')
     country_name = models.CharField(max_length=20, default='', verbose_name='国家名')
+    api = models.CharField(max_length=50, default='', verbose_name='使用的域名')
     add_time = models.DateTimeField(blank=True, auto_now_add=True, verbose_name=u'添加时间')
     update_time = models.DateTimeField(blank=True, auto_now=True, verbose_name=u'更新时间')
 

+ 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!',