|
@@ -44,7 +44,7 @@ from django.contrib.auth.hashers import make_password # 对密码加密模块
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, \
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, AWS_ACCESS_KEY_ID, \
|
|
AWS_SECRET_ACCESS_KEY, SERVER_TYPE, AWS_SES_ACCESS_REGION
|
|
AWS_SECRET_ACCESS_KEY, SERVER_TYPE, AWS_SES_ACCESS_REGION
|
|
from Model.models import Order_Model, Store_Meal, DeviceLogModel, VodBucketModel, \
|
|
from Model.models import Order_Model, Store_Meal, DeviceLogModel, VodBucketModel, \
|
|
- TestSerialRepetition
|
|
|
|
|
|
+ TestSerialRepetition, UIDCompanySerialModel, CompanySerialModel
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.TokenObject import TokenObject
|
|
from Object.TokenObject import TokenObject
|
|
from Service.CommonService import CommonService
|
|
from Service.CommonService import CommonService
|
|
@@ -160,6 +160,8 @@ class testView(View):
|
|
elif operation == 'serial-repetition': # 用与测试序列号重复接口
|
|
elif operation == 'serial-repetition': # 用与测试序列号重复接口
|
|
response = ResponseObject('cn')
|
|
response = ResponseObject('cn')
|
|
return self.serial_repetition_test(request_dict, response)
|
|
return self.serial_repetition_test(request_dict, response)
|
|
|
|
+ if operation == 'getSerialNumberInfo': # 序列号信息查询
|
|
|
|
+ return self.getSerialNumberInfo(request_dict, response)
|
|
else:
|
|
else:
|
|
return 123
|
|
return 123
|
|
|
|
|
|
@@ -854,3 +856,47 @@ class testView(View):
|
|
except Exception as e:
|
|
except Exception as e:
|
|
print(e)
|
|
print(e)
|
|
return response.json(500, repr(e))
|
|
return response.json(500, repr(e))
|
|
|
|
+
|
|
|
|
+ @staticmethod
|
|
|
|
+ def getSerialNumberInfo(request_dict, response):
|
|
|
|
+ logger = logging.getLogger('info')
|
|
|
|
+ serial_number = request_dict.get("serialNumber", None)
|
|
|
|
+ if not serial_number:
|
|
|
|
+ return response.json(444)
|
|
|
|
+ serial_number = serial_number[:6]
|
|
|
|
+ try:
|
|
|
|
+ # url = 'https://www.zositechc.cn/testApi/getSerialNumberInfo'
|
|
|
|
+ # url = 'http://www.dvema.com/testApi/getSerialNumberInfo'
|
|
|
|
+ company_serial_qs = CompanySerialModel.objects.filter(serial_number=serial_number).values('id', 'status')
|
|
|
|
+ if company_serial_qs[0]['status'] == 0:
|
|
|
|
+ return response.json(0, {'contents': '序列号未分配'})
|
|
|
|
+ uid_company_serial_qs = UIDCompanySerialModel.objects.filter(
|
|
|
|
+ company_serial_id=company_serial_qs[0]['id']).values('uid__uid','uid__status','company_serial__serial_number')
|
|
|
|
+ if not uid_company_serial_qs.exists():
|
|
|
|
+ return response.json(173)
|
|
|
|
+ count = uid_company_serial_qs.count()
|
|
|
|
+ data = {}
|
|
|
|
+ for uid_company_serial in uid_company_serial_qs:
|
|
|
|
+ data = {
|
|
|
|
+ 'uid': uid_company_serial['uid__uid'],
|
|
|
|
+ 'serialNumber': uid_company_serial['company_serial__serial_number'],
|
|
|
|
+ 'status': uid_company_serial['uid__status'],
|
|
|
|
+ }
|
|
|
|
+ device_info_qs = Device_Info.objects.filter(UID=uid_company_serial_qs[0]['uid__uid']).values('UID',
|
|
|
|
+ 'serial_number',
|
|
|
|
+ 'userID_id',
|
|
|
|
+ 'NickName',
|
|
|
|
+ 'isShare')
|
|
|
|
+ for device_info in device_info_qs:
|
|
|
|
+ uid_binding_message = {
|
|
|
|
+ 'uid': device_info['UID'],
|
|
|
|
+ 'serialNumber': device_info['serial_number'],
|
|
|
|
+ 'userID': device_info['userID_id'],
|
|
|
|
+ 'username': device_info['NickName'],
|
|
|
|
+ 'isShare': device_info['isShare']
|
|
|
|
+ }
|
|
|
|
+ data['uid_binding_message'] = uid_binding_message
|
|
|
|
+ data['count'] = count
|
|
|
|
+ return response.json(0, data)
|
|
|
|
+ except Exception as e:
|
|
|
|
+ logger.info('查询异常:{}'.format(e))
|