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