|
@@ -545,6 +545,10 @@ class SerialNumberView(View):
|
|
return response.json(13)
|
|
return response.json(13)
|
|
|
|
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
|
|
+ # 记录操作日志
|
|
|
|
+ ip = CommonService.get_ip_address(request)
|
|
|
|
+ content = json.loads(json.dumps(request_dict))
|
|
|
|
+
|
|
serial = serial_number[0:6]
|
|
serial = serial_number[0:6]
|
|
company_serial_qs = CompanySerialModel.objects.filter(serial_number=serial).values('status')
|
|
company_serial_qs = CompanySerialModel.objects.filter(serial_number=serial).values('status')
|
|
if not company_serial_qs.exists():
|
|
if not company_serial_qs.exists():
|
|
@@ -572,11 +576,20 @@ class SerialNumberView(View):
|
|
uid = uid_serial.uid.uid
|
|
uid = uid_serial.uid.uid
|
|
# 写入序列号解绑uid表
|
|
# 写入序列号解绑uid表
|
|
SerialUnbindUID.objects.create(serial=serial, uid=uid, created_time=now_time, updated_time=now_time)
|
|
SerialUnbindUID.objects.create(serial=serial, uid=uid, created_time=now_time, updated_time=now_time)
|
|
|
|
+ end_time = int(time.time())
|
|
|
|
+ # 记录操作日志
|
|
|
|
+ log = {
|
|
|
|
+ 'ip': ip,
|
|
|
|
+ 'user_id': 1,
|
|
|
|
+ 'status': 200,
|
|
|
|
+ 'time': now_time,
|
|
|
|
+ 'content': json.dumps(content),
|
|
|
|
+ 'url': 'serialNumber/detachUID',
|
|
|
|
+ 'operation': '序列号{}加入解绑队列uid:{}:{}秒'.format(serial, uid, end_time-now_time),
|
|
|
|
+ }
|
|
|
|
+ LogModel.objects.create(**log)
|
|
return response.json(0)
|
|
return response.json(0)
|
|
except Exception as e:
|
|
except Exception as e:
|
|
- # 记录操作日志
|
|
|
|
- ip = CommonService.get_ip_address(request)
|
|
|
|
- content = json.loads(json.dumps(request_dict))
|
|
|
|
log = {
|
|
log = {
|
|
'ip': ip,
|
|
'ip': ip,
|
|
'user_id': 1,
|
|
'user_id': 1,
|
|
@@ -584,7 +597,7 @@ class SerialNumberView(View):
|
|
'time': now_time,
|
|
'time': now_time,
|
|
'content': json.dumps(content) + '异常:{}'.format(repr(e)),
|
|
'content': json.dumps(content) + '异常:{}'.format(repr(e)),
|
|
'url': 'serialNumber/detachUID',
|
|
'url': 'serialNumber/detachUID',
|
|
- 'operation': '序列号{}解绑uid{}异常'.format(serial, uid),
|
|
|
|
|
|
+ 'operation': '序列号{}解绑uid异常'.format(serial),
|
|
}
|
|
}
|
|
LogModel.objects.create(**log)
|
|
LogModel.objects.create(**log)
|
|
return response.json(176, str(e))
|
|
return response.json(176, str(e))
|