Pārlūkot izejas kodu

Merge remote-tracking branch 'remotes/origin/locky' into test

Ansjer 9 mēneši atpakaļ
vecāks
revīzija
0918ab6e5b

+ 6 - 1
Controller/SerialNumberController.py

@@ -205,6 +205,11 @@ class SerialNumberView(View):
                             count += 1
                             continue
 
+                        # 判断序列号是否已绑定过uid
+                        company_serial_qs = UIDCompanySerialModel.objects.filter(company_serial_id=company_serial.id)
+                        if company_serial_qs.exists():
+                            return response.json(380)
+
                         # UID关联【企业关联序列号】表创建数据
                         UIDCompanySerialModel.objects.create(uid_id=uid.id, company_serial_id=company_serial.id,
                                                              add_time=now_time, update_time=now_time)
@@ -237,7 +242,7 @@ class SerialNumberView(View):
                             'ip': ip,
                             'user_id': 1,
                             'status': 200,
-                            'time': now_time,
+                            'time': int(time.time()),
                             'content': json.dumps(content),
                             'url': 'serialNumber/attachUID',
                             'operation': '序列号{}绑定uid: {}'.format(serial, uid.uid),

+ 2 - 0
Object/uidManageResponseObject.py

@@ -54,6 +54,7 @@ class uidManageResponseObject(object):
             377: 'uid已使用',
             378: '更新序列号状态失败',
             379: '序列号不存在',
+            380: '序列号已使用',
             404: '没有访问权限!',
             414: '请确认请求url!',
             444: '请确认参数的正确性!',
@@ -109,6 +110,7 @@ class uidManageResponseObject(object):
             377: 'uid used',
             378: 'Failed to update serial number status',
             379: 'Serial number does not exist',
+            380: 'Serial number used',
             404: 'You don not have permission to access this!',
             414: 'Please confirm the request url!',
             444: 'Please confirm the correctness of the parameters!',