43 lines
1.4 KiB
Python
Executable File
43 lines
1.4 KiB
Python
Executable File
from django.db import models
|
|
from apps.am.models import Area
|
|
|
|
from apps.utils.models import BaseModel
|
|
|
|
# Create your models here.
|
|
|
|
|
|
class TDevice(BaseModel):
|
|
"""
|
|
三方设备补充信息
|
|
"""
|
|
DEVICE_BLG = 10
|
|
DEVICE_IBEACON = 20
|
|
DEVICE_BLT = 30
|
|
DEVICE_AOA = 40
|
|
DEVICE_SPEAKER = 50
|
|
DEVICE_VCHANNEL = 60
|
|
DEVICE_DCHANNEL = 70
|
|
DEVICE_PANEL = 80
|
|
|
|
DEVICE_CHOICE = (
|
|
(DEVICE_BLG, '定位基站'),
|
|
(DEVICE_IBEACON, '定位信标'),
|
|
(DEVICE_BLT, '定位标签'),
|
|
(DEVICE_AOA, 'aoa引擎'),
|
|
(DEVICE_SPEAKER, '音响'),
|
|
(DEVICE_VCHANNEL, '视频通道'),
|
|
(DEVICE_DCHANNEL, '闸机通道'),
|
|
(DEVICE_PANEL, '面板机')
|
|
)
|
|
type = models.PositiveSmallIntegerField('设备类型', choices=DEVICE_CHOICE)
|
|
code = models.CharField('设备唯一标识', max_length=20)
|
|
location = models.JSONField('位置信息', default=dict,
|
|
null=False, blank=True)
|
|
area = models.ForeignKey(Area, on_delete=models.CASCADE,
|
|
verbose_name='所在区', null=True, blank=True)
|
|
areas = models.ManyToManyField(Area, verbose_name='覆盖区',
|
|
related_name='tareas')
|
|
is_clock = models.BooleanField('是否打卡设备', default=False)
|
|
third_info = models.JSONField('三方信息', default=dict,
|
|
null=False, blank=True)
|