From f3631e70ee8f67820ddc20235033c70999b44f35 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 9 May 2022 15:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=96=B9=E8=AE=BE=E5=A4=87=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/third/urls.py | 4 ++-- apps/third/views_d.py | 52 +++++-------------------------------------- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/apps/third/urls.py b/apps/third/urls.py index 862e8f0f..a940aa11 100755 --- a/apps/third/urls.py +++ b/apps/third/urls.py @@ -1,7 +1,7 @@ from django.urls import path, include from rest_framework import routers from apps.third.views import DahuaTestView, DhCommonViewSet, SpTestView, XxCommonViewSet, XxTestView -from apps.third.views_d import VChannelViewSet +from apps.third.views_d import TDeviceViewSet API_BASE_URL = 'api/third/' HTML_BASE_URL = 'third/' @@ -9,7 +9,7 @@ HTML_BASE_URL = 'third/' router = routers.DefaultRouter() router.register('xunxi', XxCommonViewSet, basename='api_xunxi') router.register('dahua', DhCommonViewSet, basename='api_dahua') -router.register('vchannel', VChannelViewSet, basename='vchannel') +router.register('tdevice', TDeviceViewSet, basename='tdevice') urlpatterns = [ path(API_BASE_URL, include(router.urls)), path(API_BASE_URL + 'dahua/test/', DahuaTestView.as_view()), diff --git a/apps/third/views_d.py b/apps/third/views_d.py index 496fcd30..b4ca55d9 100644 --- a/apps/third/views_d.py +++ b/apps/third/views_d.py @@ -2,68 +2,26 @@ from apps.third.models import TDevice from apps.third.serializers import BindAreaSerializer, LabelLocationSerializer from apps.utils.viewsets import CustomGenericViewSet from rest_framework.mixins import ListModelMixin -from apps.third.clients import xxClient, dhClient +from apps.third.clients import xxClient, dhClient, spClient from apps.third.tapis import xxapis, dhapis from rest_framework.response import Response from rest_framework.serializers import Serializer from rest_framework.decorators import action from apps.am.models import Area -# class BlgViewSet(ListModelMixin, CustomGenericViewSet): -# """ -# 定位基站接口 -# """ -# perms_map = {'get': '*'} # 权限标识 -# serializer_class = Serializer -# def list(self, request, *args, **kwargs): -# """ -# 定位基站列表 - -# 定位基站列表 -# """ -# data = request.data -# _, res = xxClient.request(**xxapis['blg_list'], json=data) -# return Response(res) - - -# class IbeaconViewSet(CustomGenericViewSet): -# """ -# 信标接口 -# """ -# perms_map = {'get': '*'} # 权限标识 -# serializer_class = Serializer - -# def list(self, request, *args, **kwargs): -# """ -# 信标列表 - -# 定位基站列表 -# """ -# data = request.data -# _, res = xxClient.request(**xxapis['blg_list'], json=data) -# return Response(res) - - -class DChannelViewSet(CustomGenericViewSet): - """ - 闸机接口 - """ - pass - - -class VChannelViewSet(CustomGenericViewSet): +class TDeviceViewSet(CustomGenericViewSet): """ 视频接口 """ @action(methods=['post'], detail=False, perms_map={'post': '*'}, serializer_class=Serializer) - def page(self, request): + def vchannel(self, request): request.data.update({'channelTypeList': ["1"]}) _, res = dhClient.request(**dhapis['channel_list'], json=request.data) return Response(res) - @action(methods=['post'], detail=False, perms_map={'post': 'dchannel:label_location'}, + @action(methods=['post'], detail=False, perms_map={'post': 'tdevice:label_location'}, serializer_class=LabelLocationSerializer) def label_location(self, request): """ @@ -88,7 +46,7 @@ class VChannelViewSet(CustomGenericViewSet): td.save() return Response() - @action(methods=['post'], detail=False, perms_map={'post': 'dchannel:bind_area'}, + @action(methods=['post'], detail=False, perms_map={'post': 'tdevice:bind_area'}, serializer_class=BindAreaSerializer) def bind_area(self, request): """