|
@@ -986,56 +986,66 @@ class testView(View):
|
|
|
if not serial_number:
|
|
|
return response.json(0)
|
|
|
results_data = []
|
|
|
- if not CONFIG_INFO == 'cn':
|
|
|
+ if not CONFIG_INFO == "cn":
|
|
|
return response.json(0, results_data)
|
|
|
local_response = cls.getSerialNumberInfo(request_dict, response)
|
|
|
res = json.loads(local_response.content)
|
|
|
- res['result']['server'] = 1
|
|
|
- res['result']['serverName'] = '中国服'
|
|
|
- res['result']['domainName'] = 'https://www.zositechc.cn'
|
|
|
- results_data.append(res['result'])
|
|
|
- res1 = requests.post("http://www.dvema.com/testApi/getSerialNumberInfo",
|
|
|
- data={'serialNumber': serial_number}, timeout=15)
|
|
|
+ res["result"]["server"] = 1
|
|
|
+ res["result"]["serverName"] = "中国服"
|
|
|
+ res["result"]["domainName"] = "https://www.zositechc.cn"
|
|
|
+ results_data.append(res["result"])
|
|
|
+
|
|
|
+ res1 = requests.post("https://www.dvema.com/testApi/getSerialNumberInfo",
|
|
|
+ data={"serialNumber": serial_number}, timeout=15)
|
|
|
results1 = json.loads(res1.text)
|
|
|
- results1['result']['server'] = 2
|
|
|
- results1['result']['serverName'] = '美国服'
|
|
|
- results1['result']['domainName'] = 'https://www.dvema.com'
|
|
|
- results_data.append(results1['result'])
|
|
|
+ results1["result"]["server"] = 2
|
|
|
+ results1["result"]["serverName"] = "美国服"
|
|
|
+ results1["result"]["domainName"] = "https://www.dvema.com"
|
|
|
+ results_data.append(results1["result"])
|
|
|
+
|
|
|
res2 = requests.post("https://api.zositeche.com/testApi/getSerialNumberInfo",
|
|
|
data={'serialNumber': serial_number}, timeout=15)
|
|
|
results2 = json.loads(res2.text)
|
|
|
results2['result']['server'] = 3
|
|
|
- results2['result']['serverName'] = '欧洲服'
|
|
|
- results2['result']['domainName'] = 'https://api.zositeche.com'
|
|
|
+ results2["result"]["serverName"] = "欧洲服"
|
|
|
+ results2["result"]["domainName"] = "https://api.zositeche.com"
|
|
|
results_data.append(results2['result'])
|
|
|
+
|
|
|
+ res3 = requests.post("https://test.zositechc.cn/testApi/getSerialNumberInfo",
|
|
|
+ data={'serialNumber': serial_number}, timeout=15)
|
|
|
+ results3 = json.loads(res3.text)
|
|
|
+ results3['result']['server'] = 4
|
|
|
+ results3["result"]["serverName"] = "测试服"
|
|
|
+ results3["result"]["domainName"] = "https://test.zositeche.cn"
|
|
|
+ results_data.append(results3['result'])
|
|
|
+
|
|
|
is_ok = True
|
|
|
- operation = ''
|
|
|
- status_log = ''
|
|
|
+ operation = ""
|
|
|
+ status_log = ""
|
|
|
for item in results_data:
|
|
|
- if item['status'] == '绑定uid':
|
|
|
+ if item["status"] == "绑定uid":
|
|
|
is_ok = False
|
|
|
- operation = '{}序列号已绑定UID'.format(serial_number)
|
|
|
- LOGGER.info('序列号检测状态已绑定:{}'.format(serial_number))
|
|
|
+ operation = "检测{}序列号已绑定UID".format(serial_number)
|
|
|
+ LOGGER.info("序列号检测状态已绑定:{}".format(serial_number))
|
|
|
break
|
|
|
- elif item['status'] == '已占用':
|
|
|
- status_log = '序列号检测状态已占用:{}'.format(serial_number)
|
|
|
+ elif item["status"] == "已占用":
|
|
|
+ status_log = "序列号检测状态已占用:{}".format(serial_number)
|
|
|
if is_ok:
|
|
|
LOGGER.info(status_log)
|
|
|
- LOGGER.info('序列号检测状态正常{}'.format(serial_number))
|
|
|
+ LOGGER.info("序列号检测状态正常{}".format(serial_number))
|
|
|
return response.json(0, results_data)
|
|
|
log = {
|
|
|
- 'ip': CommonService.get_ip_address(request),
|
|
|
- 'user_id': 1,
|
|
|
- 'status': 200,
|
|
|
- 'time': int(time.time()),
|
|
|
- 'operation': operation,
|
|
|
- 'url': 'testApi/get-serial-details',
|
|
|
+ "ip": CommonService.get_ip_address(request),
|
|
|
+ "user_id": 1,
|
|
|
+ "status": 200,
|
|
|
+ "time": int(time.time()),
|
|
|
+ "operation": operation,
|
|
|
+ "url": "testApi/get-serial-details",
|
|
|
}
|
|
|
LogModel.objects.create(**log)
|
|
|
return response.json(0, results_data)
|
|
|
except Exception as e:
|
|
|
- LOGGER.info('扫码检测序列号异常详情,errLine:{}, errMsg:{}'
|
|
|
- .format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ LOGGER.info("异常详情,errLine:{}, errMsg:{}".format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
return response.json(500)
|
|
|
|
|
|
@staticmethod
|