|
@@ -29,13 +29,13 @@ http://192.168.136.40:8077/Test
|
|
import json
|
|
import json
|
|
import time
|
|
import time
|
|
import urllib
|
|
import urllib
|
|
|
|
+import requests
|
|
from Object.AliPayObject import AliPayObject
|
|
from Object.AliPayObject import AliPayObject
|
|
import boto3
|
|
import boto3
|
|
from boto3.session import Session
|
|
from boto3.session import Session
|
|
import oss2
|
|
import oss2
|
|
import paypalrestsdk
|
|
import paypalrestsdk
|
|
import logging
|
|
import logging
|
|
-from aliyunsdkcore import client
|
|
|
|
from django.http import JsonResponse, HttpResponse
|
|
from django.http import JsonResponse, HttpResponse
|
|
from django.utils.decorators import method_decorator
|
|
from django.utils.decorators import method_decorator
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
from django.views.decorators.csrf import csrf_exempt
|
|
@@ -43,7 +43,8 @@ from django.views.generic.base import View
|
|
from django.contrib.auth.hashers import make_password # 对密码加密模块
|
|
from django.contrib.auth.hashers import make_password # 对密码加密模块
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, OSS_ROLE_ARN, AWS_ACCESS_KEY_ID, \
|
|
from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, OSS_ROLE_ARN, 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, OssCrdModel, StsCrdModel, DeviceLogModel, VodBucketModel
|
|
|
|
|
|
+from Model.models import Order_Model, Store_Meal, DeviceLogModel, VodBucketModel, \
|
|
|
|
+ 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
|
|
@@ -156,6 +157,8 @@ class testView(View):
|
|
return self.play_m3u8(request_dict, response)
|
|
return self.play_m3u8(request_dict, response)
|
|
elif operation == 'generate_video':
|
|
elif operation == 'generate_video':
|
|
return self.generate_video(request_dict, response)
|
|
return self.generate_video(request_dict, response)
|
|
|
|
+ if operation == 'getSerialNumberInfo': # 序列号信息查询
|
|
|
|
+ return self.getSerialNumberInfo(request_dict, response, requests)
|
|
else:
|
|
else:
|
|
return 123
|
|
return 123
|
|
|
|
|
|
@@ -827,3 +830,61 @@ 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, requests):
|
|
|
|
+ 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:
|
|
|
|
+ data = {}
|
|
|
|
+ company_serial_qs = CompanySerialModel.objects.filter(serial_number=serial_number).values('status')
|
|
|
|
+ if not company_serial_qs.exists():
|
|
|
|
+ return response.json(173)
|
|
|
|
+ if company_serial_qs[0]['status'] == 0:
|
|
|
|
+ return response.json(0, {'contents': '序列号未分配'})
|
|
|
|
+ uid_company_serial_qs = UIDCompanySerialModel.objects.filter(
|
|
|
|
+ company_serial__serial_number=serial_number).values('uid__uid', 'uid__status',
|
|
|
|
+ 'company_serial__serial_number')
|
|
|
|
+ if not uid_company_serial_qs.exists() and company_serial_qs[0]['status'] != 0:
|
|
|
|
+ data['serial_number'] = serial_number
|
|
|
|
+ if company_serial_qs[0]['status'] == 1:
|
|
|
|
+ data['status'] = '已分配'
|
|
|
|
+ if company_serial_qs[0]['status'] == 2:
|
|
|
|
+ data['status'] = '已绑定uid'
|
|
|
|
+ if company_serial_qs[0]['status'] == 3:
|
|
|
|
+ data['status'] = '已占用'
|
|
|
|
+ return response.json(0, 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'],
|
|
|
|
+ }
|
|
|
|
+ if company_serial_qs[0]['status'] == 1:
|
|
|
|
+ data['status'] = '已分配'
|
|
|
|
+ if company_serial_qs[0]['status'] == 2:
|
|
|
|
+ data['status'] = '绑定uid'
|
|
|
|
+ if company_serial_qs[0]['status'] == 3:
|
|
|
|
+ data['status'] = '已占用'
|
|
|
|
+ uid = uid_company_serial['uid__uid'] if uid_company_serial['uid__uid'] else ''
|
|
|
|
+ device_info_qs = Device_Info.objects.filter(UID=uid).values(
|
|
|
|
+ 'UID',
|
|
|
|
+ 'serial_number',
|
|
|
|
+ 'userID_id',
|
|
|
|
+ 'primaryUserID',
|
|
|
|
+ 'NickName', )
|
|
|
|
+ uid_user_message = {
|
|
|
|
+ 'uid': device_info_qs[0]['UID'] if device_info_qs.exists() else '',
|
|
|
|
+ 'serialNumber': device_info_qs[0]['serial_number'] if device_info_qs.exists() else '',
|
|
|
|
+ 'userID': device_info_qs[0]['userID_id'] if device_info_qs.exists() else '',
|
|
|
|
+ 'username': device_info_qs[0]['NickName'] if device_info_qs.exists() else '',
|
|
|
|
+ 'primaryUserID': device_info_qs[0]['primaryUserID'] if device_info_qs.exists() else ''
|
|
|
|
+ }
|
|
|
|
+ data['uid_user_message'] = uid_user_message
|
|
|
|
+ return response.json(0, data)
|
|
|
|
+ except Exception as e:
|
|
|
|
+ logger.info('查询异常:{}'.format(e))
|
|
|
|
+ return response.json(500)
|