|
@@ -8,6 +8,7 @@ from rest_framework.views import APIView
|
|
|
from rest_framework.viewsets import ModelViewSet
|
|
|
|
|
|
from background.Object import AmazonS3Util, RedisObject, TokenObject
|
|
|
+from background.author import MyAuthentication
|
|
|
from background.serializers import ProductInfoSerializer, VideoInSerializer, QuickStartInfoSerializer, \
|
|
|
UpgradeFirmwareInfoSerializer
|
|
|
from background.models import ProductInfo, VideoInfo, QuickStartInfo, UpgradeFirmwareInfo, WechatUserInfo
|
|
@@ -17,15 +18,18 @@ from rest_framework.response import Response
|
|
|
class ProductInfoSet(ModelViewSet):
|
|
|
queryset = ProductInfo.objects.all()
|
|
|
serializer_class = ProductInfoSerializer
|
|
|
+ # authentication_classes = [MyAuthentication, ]
|
|
|
|
|
|
|
|
|
class VideoInfoSet(ModelViewSet):
|
|
|
+ # authentication_classes = [MyAuthentication, ]
|
|
|
queryset = VideoInfo.objects.all()
|
|
|
serializer_class = VideoInSerializer
|
|
|
filterset_fields = ['id', 'product_info_id', 'title']
|
|
|
|
|
|
|
|
|
class QuickStartInfoSet(ModelViewSet):
|
|
|
+ # authentication_classes = [MyAuthentication, ]
|
|
|
queryset = QuickStartInfo.objects.all()
|
|
|
serializer_class = QuickStartInfoSerializer
|
|
|
filterset_fields = ['id', 'product_info_id', 'title']
|
|
@@ -35,6 +39,7 @@ class UpgradeFirmwareInfoSet(ModelViewSet):
|
|
|
queryset = UpgradeFirmwareInfo.objects.all()
|
|
|
serializer_class = UpgradeFirmwareInfoSerializer
|
|
|
filterset_fields = ['id', 'product_info_id', 'title']
|
|
|
+ # authentication_classes = [MyAuthentication, ]
|
|
|
|
|
|
|
|
|
class GetUploadUrlView(APIView):
|
|
@@ -45,11 +50,9 @@ class GetUploadUrlView(APIView):
|
|
|
return Response({'code': 444, 'result': {'error_msg': 'file_name参数有误'}})
|
|
|
try:
|
|
|
s3_obj = AmazonS3Util()
|
|
|
- if file_type == '1': # 视频
|
|
|
- key_name = 'vsees/video_file/{file_name}'.format(file_name=file_name)
|
|
|
- elif file_type == '2': # 说明书
|
|
|
+ if file_type == '1': # 说明书
|
|
|
key_name = 'vsees/quick_start_file/{file_name}'.format(file_name=file_name)
|
|
|
- elif file_type == '3': # 升级文件
|
|
|
+ elif file_type == '2': # 升级文件
|
|
|
key_name = 'vsees/upgrade_firmware_file/{file_name}'.format(file_name=file_name)
|
|
|
else:
|
|
|
return Response({'code': 444, 'result': {'error_msg': 'file_type参数有误'}})
|
|
@@ -86,7 +89,7 @@ class WechatLoginView(APIView):
|
|
|
获取state
|
|
|
@return: response
|
|
|
"""
|
|
|
- nwo_time = time.time()
|
|
|
+ nwo_time = int(time.time())
|
|
|
redis_obj = RedisObject()
|
|
|
try:
|
|
|
state = hashlib.md5((str(uuid.uuid1()) + str(nwo_time)).encode('utf-8')).hexdigest()
|