在线标签列表信息
This commit is contained in:
parent
26719d9681
commit
93d3a5aa20
|
@ -68,3 +68,9 @@ class BltSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TDevice
|
model = TDevice
|
||||||
fields = ['code', 'obj_cate', 'employee', 'employee_']
|
fields = ['code', 'obj_cate', 'employee', 'employee_']
|
||||||
|
|
||||||
|
|
||||||
|
class BltQuerySerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = TDevice
|
||||||
|
fields = ['area']
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from apps.third.models import TDevice, Tlog
|
from apps.third.models import TDevice, Tlog
|
||||||
from apps.third.serializers import BindAreaSerializer, BltSerializer, LabelLocationSerializer, TDeviceSerializer, TlogSerializer
|
from apps.third.serializers import BindAreaSerializer, BltQuerySerializer, BltSerializer, LabelLocationSerializer, TDeviceSerializer, TlogSerializer
|
||||||
from apps.utils.viewsets import CustomGenericViewSet
|
from apps.utils.viewsets import CustomGenericViewSet
|
||||||
from rest_framework.mixins import ListModelMixin, CreateModelMixin
|
from rest_framework.mixins import ListModelMixin, CreateModelMixin
|
||||||
from apps.third.clients import xxClient, dhClient, spClient
|
from apps.third.clients import xxClient, dhClient, spClient
|
||||||
|
@ -9,6 +9,7 @@ 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
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
from rest_framework.exceptions import ParseError
|
||||||
|
|
||||||
|
|
||||||
class BltViewSet(CustomGenericViewSet):
|
class BltViewSet(CustomGenericViewSet):
|
||||||
|
@ -58,18 +59,31 @@ class BltViewSet(CustomGenericViewSet):
|
||||||
ret['count_visitor'] = qs.filter(employee__type='visitor').count()
|
ret['count_visitor'] = qs.filter(employee__type='visitor').count()
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, perms_map={'get': '*'})
|
@action(methods=['post'], detail=False, perms_map={'post': '*'},
|
||||||
def all(self, request):
|
serializer_class=BltQuerySerializer)
|
||||||
"""全部在线标签列表信息
|
def query(self, request):
|
||||||
|
"""在线标签列表信息
|
||||||
|
|
||||||
全部在线标签列表信息
|
在线标签列表信息
|
||||||
"""
|
"""
|
||||||
json = {
|
data = request.data
|
||||||
"pageNum": 1,
|
if data.get('area', None):
|
||||||
"numPerPage": 2000,
|
try:
|
||||||
"online": "online"
|
railId = Area.objects.get(id=data['area']).third_info['xx_rail']['id']
|
||||||
}
|
except Exception:
|
||||||
_, res = xxClient.request(**xxapis['blt_list'], json=json)
|
raise ParseError('区域信息不正确')
|
||||||
|
json = {
|
||||||
|
"railId": railId,
|
||||||
|
"type": ""
|
||||||
|
}
|
||||||
|
_, res = xxClient.request(**xxapis['rail_ibeacon_list'], json=json)
|
||||||
|
else:
|
||||||
|
json = {
|
||||||
|
"pageNum": 1,
|
||||||
|
"numPerPage": 2000,
|
||||||
|
"online": "online"
|
||||||
|
}
|
||||||
|
_, res = xxClient.request(**xxapis['blt_list'], json=json)
|
||||||
blt_list = res['recordList']
|
blt_list = res['recordList']
|
||||||
macs = []
|
macs = []
|
||||||
for i in blt_list:
|
for i in blt_list:
|
||||||
|
|
Loading…
Reference in New Issue