三方设备接口
This commit is contained in:
parent
c7318fe8ee
commit
f3631e70ee
|
@ -1,7 +1,7 @@
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
from apps.third.views import DahuaTestView, DhCommonViewSet, SpTestView, XxCommonViewSet, XxTestView
|
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/'
|
API_BASE_URL = 'api/third/'
|
||||||
HTML_BASE_URL = 'third/'
|
HTML_BASE_URL = 'third/'
|
||||||
|
@ -9,7 +9,7 @@ HTML_BASE_URL = 'third/'
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register('xunxi', XxCommonViewSet, basename='api_xunxi')
|
router.register('xunxi', XxCommonViewSet, basename='api_xunxi')
|
||||||
router.register('dahua', DhCommonViewSet, basename='api_dahua')
|
router.register('dahua', DhCommonViewSet, basename='api_dahua')
|
||||||
router.register('vchannel', VChannelViewSet, basename='vchannel')
|
router.register('tdevice', TDeviceViewSet, basename='tdevice')
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path(API_BASE_URL, include(router.urls)),
|
path(API_BASE_URL, include(router.urls)),
|
||||||
path(API_BASE_URL + 'dahua/test/', DahuaTestView.as_view()),
|
path(API_BASE_URL + 'dahua/test/', DahuaTestView.as_view()),
|
||||||
|
|
|
@ -2,68 +2,26 @@ from apps.third.models import TDevice
|
||||||
from apps.third.serializers import BindAreaSerializer, LabelLocationSerializer
|
from apps.third.serializers import BindAreaSerializer, LabelLocationSerializer
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
from rest_framework.mixins import ListModelMixin
|
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 apps.third.tapis import xxapis, dhapis
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.serializers import Serializer
|
from rest_framework.serializers import Serializer
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from apps.am.models import Area
|
from apps.am.models import Area
|
||||||
|
|
||||||
# class BlgViewSet(ListModelMixin, CustomGenericViewSet):
|
|
||||||
# """
|
|
||||||
# 定位基站接口
|
|
||||||
# """
|
|
||||||
# perms_map = {'get': '*'} # 权限标识
|
|
||||||
# serializer_class = Serializer
|
|
||||||
|
|
||||||
# def list(self, request, *args, **kwargs):
|
class TDeviceViewSet(CustomGenericViewSet):
|
||||||
# """
|
|
||||||
# 定位基站列表
|
|
||||||
|
|
||||||
# 定位基站列表
|
|
||||||
# """
|
|
||||||
# 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):
|
|
||||||
"""
|
"""
|
||||||
视频接口
|
视频接口
|
||||||
"""
|
"""
|
||||||
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||||
serializer_class=Serializer)
|
serializer_class=Serializer)
|
||||||
def page(self, request):
|
def vchannel(self, request):
|
||||||
request.data.update({'channelTypeList': ["1"]})
|
request.data.update({'channelTypeList': ["1"]})
|
||||||
_, res = dhClient.request(**dhapis['channel_list'], json=request.data)
|
_, res = dhClient.request(**dhapis['channel_list'], json=request.data)
|
||||||
return Response(res)
|
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)
|
serializer_class=LabelLocationSerializer)
|
||||||
def label_location(self, request):
|
def label_location(self, request):
|
||||||
"""
|
"""
|
||||||
|
@ -88,7 +46,7 @@ class VChannelViewSet(CustomGenericViewSet):
|
||||||
td.save()
|
td.save()
|
||||||
return Response()
|
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)
|
serializer_class=BindAreaSerializer)
|
||||||
def bind_area(self, request):
|
def bind_area(self, request):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue