|
@@ -231,8 +231,22 @@ class SerialNumberView(View):
|
|
|
|
|
|
return response.json(0, res)
|
|
|
return response.json(5)
|
|
|
- elif company_serial.status == 2: # 不返回uid
|
|
|
- return response.json(0)
|
|
|
+ elif company_serial.status == 2: # 返回uid
|
|
|
+ res = self.get_uid_info_by_serial(company_serial.id)
|
|
|
+ # 记录操作日志
|
|
|
+ ip = CommonService.get_ip_address(request)
|
|
|
+ content = json.loads(json.dumps(request_dict))
|
|
|
+ log = {
|
|
|
+ 'ip': ip,
|
|
|
+ 'user_id': 1,
|
|
|
+ 'status': 200,
|
|
|
+ 'time': now_time,
|
|
|
+ 'content': json.dumps(content),
|
|
|
+ 'url': 'serialNumber/attachUID',
|
|
|
+ 'operation': '序列号{}获取uid: {}'.format(serial, res['uid']),
|
|
|
+ }
|
|
|
+ LogModel.objects.create(**log)
|
|
|
+ return response.json(0, res)
|
|
|
elif company_serial.status == 3: # 已占用
|
|
|
sync_success = self.sync_serial_data_and_log(request, company_serial.id, serial_number, now_time)
|
|
|
if not sync_success:
|