from itertools import chain

from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from django.db import models
from django.utils import timezone
from imagekit.models import ProcessedImageField
from imagekit.processors import ResizeToFill

from Ansjer.config import SERVER_DOMAIN


class PermissionsManager(models.Manager):
    use_in_migrations = True

    def get_by_natural_key(self, permName):
        return self.get(
            permName=permName
        )


class RoleManager(models.Manager):
    """
    The manager for the auth's Role model..
    """
    use_in_migrations = True

    def get_by_natural_key(self, roleName):
        return self.get(roleName=roleName)


class UserManager(BaseUserManager):

    def create_user(self, username, password, userID, is_active,
                    user_isValid, **extra_fields):
        user = self.model(
            username=username,
            userID=userID,
            is_active=is_active,
            user_isValid=user_isValid,
            **extra_fields
        )
        user.set_password(password)
        user.save(using=self._db)

        role = Role.objects.get(rid=1)
        user.role.add(role)
        return user

    def create_superuser(self, username, password, userID, is_active,
                         user_isValid, **extra_fields):
        # extra_fields.setdefault('is_superuser', is_superuser)
        is_superuser = extra_fields.get('is_superuser', None)
        if is_superuser != 100 and is_superuser != 1:
            raise ValueError('Superuser must have is_superuser=1 or 100.')

        return self.create_user(username, password, userID, is_active,
                                user_isValid, **extra_fields)


class Permissions(models.Model):
    permName = models.CharField(blank=True, null=True, max_length=32, unique=True, verbose_name=u'权限名称')
    description = models.CharField(blank=True, null=True, max_length=128, verbose_name=u'描述信息', default='')
    objects = PermissionsManager()

    class Meta:
        ordering = ['permName']
        db_table = 'permissions'
        verbose_name = u'role permission'
        verbose_name_plural = verbose_name
        unique_together = (('permName'),)

    def natural_key(self):
        return (self.permName)


class MenuModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    parentId = models.IntegerField(default=0, verbose_name='父节点ID')
    name = models.CharField(max_length=50, null=True, default='',
                            verbose_name='名称')  # 首字母大写，一定要与vue文件的name对应起来，用于noKeepAlive缓存控制（该项特别重要）
    path = models.CharField(max_length=100, null=True, default='', verbose_name='路径')
    component = models.CharField(max_length=100, null=True, default='', verbose_name='vue文件路径')  # 所谓的vue 组件
    hidden = models.BooleanField(blank=True, default=False, verbose_name=u'是否隐藏')
    alwaysShow = models.BooleanField(blank=True, default=False, verbose_name=u'始终显示当前节点')
    levelHidden = models.BooleanField(blank=True, default=False, verbose_name=u'是否隐藏一级路由')
    title = models.CharField(max_length=50, default='', verbose_name='标题')
    icon = models.CharField(max_length=50, default='', verbose_name='图标名')
    isCustomSvg = models.BooleanField(blank=True, default=False, verbose_name=u'是否是自定义svg图标')
    noKeepAlive = models.BooleanField(blank=True, default=False, verbose_name=u'当前路由是否不缓存')
    noClosable = models.BooleanField(blank=True, default=False, verbose_name=u'当前路由是否可关闭多标签页')
    badge = models.CharField(max_length=10, default='', verbose_name='badge小标签（只支持子级）')
    tabHidden = models.BooleanField(blank=True, default=False, verbose_name=u'当前路由是否不显示多标签页')
    activeMenu = models.CharField(max_length=50, default='', verbose_name='高亮指定菜单')
    dot = models.BooleanField(blank=True, default=False, verbose_name=u'小圆点')
    dynamicNewTab = models.BooleanField(blank=True, default=False, verbose_name=u'动态传参路由是否新开标签页')
    redirect = models.CharField(max_length=50, default='', verbose_name='重定向')
    menu_code = models.CharField(max_length=100, default='', verbose_name='菜单编码')
    menutype = models.SmallIntegerField(default=1, verbose_name=u'类型')  # 类型: 1-菜单 2-按钮
    sort = models.IntegerField(default=0, verbose_name='排序')

    class Meta:
        db_table = 'menu'
        verbose_name = u'菜单表'
        verbose_name_plural = verbose_name


class Role(models.Model):
    rid = models.SmallIntegerField(primary_key=True, unique=True, verbose_name=u'用户角色组ID')
    roleName = models.CharField(max_length=32, unique=True,
                                default='User', verbose_name=u'角色名称')
    permission = models.ManyToManyField(to='Permissions', blank=True, verbose_name=u'权限', db_table='role_permissions')
    menu = models.ManyToManyField(to='MenuModel', blank=True, verbose_name=u'后台菜单权限', db_table='role_menu')

    Description = models.TextField(blank=True, default='', verbose_name=u'描述信息')

    objects = RoleManager()

    class Meta:
        ordering = ['roleName']
        db_table = 'role'
        verbose_name = u'用户角色'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.roleName

    def natural_key(self):
        return (self.roleName,)

    def get_all_permission(self):
        perms = self.permission.all()

        permslist = []
        if self.rid == 100:
            perms = Permissions.objects.all()
            for perm in perms:
                permslist.append(perm.permName)
            return permslist
        else:
            permlist_tmp = []
            for perm in perms:
                permlist_tmp.append(perm.permName)
            permSet = set(permlist_tmp)
            permslist = list(permSet)
            permslist.sort()
            return permslist


class Device_User(AbstractBaseUser):
    userID = models.CharField(blank=True, max_length=32, primary_key=True,
                              verbose_name=u'用户ID', unique=True)
    role = models.ManyToManyField(to='Role', blank=True, verbose_name=u'用户角色', db_table='user_role')

    username = models.CharField(max_length=64, db_index=True, verbose_name=u'用户名', default='', blank=True)
    password = models.CharField(max_length=128, verbose_name=u'密码')
    userEmail = models.EmailField(max_length=64, db_index=True, verbose_name=u'邮箱', default='', blank=True)
    # 实际的路径就是 MEDIA_ROOT/Image/filename,所以可用upload_to来指定文件存放的前缀路径
    userIconPath = ProcessedImageField(blank=True, upload_to='User/Images/', default='static/User/default.png',
                                       verbose_name=u'头像',
                                       # 图片将处理成85x85的尺寸
                                       processors=[ResizeToFill(85, 85)], )
    userIconUrl = models.URLField(blank=True, max_length=128,
                                  default=SERVER_DOMAIN + 'account/getAvatar/User/defaultUser.png')
    NickName = models.CharField(blank=True, max_length=64, default='', verbose_name=u'用户昵称')
    is_superuser = models.IntegerField(blank=True, default=0, verbose_name=u'用户类型')
    is_active = models.BooleanField(blank=True, default=False, verbose_name=u'用户活动状态')
    data_joined = models.DateTimeField(blank=True, verbose_name=u'加入时间', auto_now_add=True, db_index=True)
    last_login = models.DateTimeField(blank=True, verbose_name='u最后登录时间', auto_now=True, db_index=True)
    user_isValid = models.BooleanField(blank=True, default=False, verbose_name=u'用户有效性',
                                       help_text=u'是否是认证通过的用户')
    online = models.BooleanField(blank=True, default=False, verbose_name=u'用户登录状态')
    machine_code = models.CharField(blank=True, max_length=128, default='', verbose_name=u'机械码')

    language = models.CharField(blank=True, max_length=16, default='en', verbose_name=u'语言地区')
    # 手机注册增加字段
    phone = models.CharField(max_length=16, db_index=True, verbose_name=u'手机号', default='', blank=True)
    fingerprint_enable = models.SmallIntegerField(default=0, verbose_name=u'是否开启了指纹登录')  # 0：未开启，1：已开启
    fingerprint_key = models.CharField(max_length=128, default='', verbose_name=u'客户端用于解码的密钥等信息')
    is_local = models.BooleanField(blank=True, default=False, verbose_name=u'是否是本地登录用户')  # False：账号登录，1：本地登录
    subscribe_email = models.SmallIntegerField(default=0, verbose_name=u'是否订阅营销邮件')  # 0：未订阅，1：订阅，2：不订阅
    region_country = models.IntegerField(blank=True, default=0, verbose_name='关联tb_country表id')
    region_status = models.BooleanField(blank=True, default=False, verbose_name='地区选择状态')  # 0：未选， 1：已选
    objects = UserManager()

    USERNAME_FIELD = 'userID'  # 必须有一个唯一标识
    REQUIRED_FIELDS = ['is_superuser']  # 创建superuser时的必须字段

    class Meta:
        ordering = ('-data_joined',)
        verbose_name = u'用户信息'
        db_table = 'device_user'
        get_latest_by = 'last_login'

    def __str__(self):
        return self.username

    def get_role_id(self):
        rids = []
        roles = self.role.all()
        for role in roles:
            rids.append(role.rid)
        return rids

    def get_all_permission(self):
        roles = self.role.all()
        permslist = []
        for role in roles:
            if role.rid == 100:
                perms = Permissions.objects.all()
                for perm in perms:
                    permslist.append(perm.permName)
                return permslist

        permSet = set(permslist)
        for role in roles:
            permlist_tmp = []
            for perm in role.permission.all():
                permlist_tmp.append(perm.permName)

            permSet_tmp = set(permlist_tmp)
            permSet = permSet.union(permSet_tmp)
            permslist = list(permSet)
            permslist.sort()
            return permslist

    @property
    def is_staff(self):
        return self.is_superuser


# 设备表是建项目开发者设计的,自己看着办
# 谢谢提醒！我选择凉拌。
# 我选择狗带
class Device_Info(models.Model):
    id = models.CharField(blank=True, max_length=32, primary_key=True)
    userID = models.ForeignKey(Device_User, blank=True, to_field='userID', on_delete=models.CASCADE)
    NickName = models.CharField(blank=True, max_length=32, verbose_name=u'设备名称')
    UID = models.CharField(blank=True, max_length=32, verbose_name=u'设备UID', default='')
    SID = models.CharField(blank=True, max_length=32, verbose_name=u'服务器ID', default='')
    View_Account = models.CharField(blank=True, max_length=32, verbose_name=u'设备用户名称', default='')
    View_Password = models.CharField(blank=True, max_length=32, verbose_name=u'设备密码', default='')
    AudioFormat = models.IntegerField(blank=True, default=1, verbose_name=u'初始化影像')
    EventNotification = models.IntegerField(blank=True, verbose_name=u'报警类型', default=0)
    ChannelIndex = models.IntegerField(blank=True, verbose_name=u'通道号', default=0)
    Online = models.BooleanField(blank=True, default=False, verbose_name=u'设备是否在线')
    mMonitorIndex = models.IntegerField(blank=True, default=-1)
    Type = models.IntegerField(blank=True, verbose_name='设备类型')
    DebugMode = models.IntegerField(blank=True, verbose_name=u'调试模式', default=0)
    NotificationMode = models.IntegerField(blank=True, verbose_name=u'是否报警', default=0)
    qvgaLevel = models.BooleanField(blank=True, verbose_name=u'SD与HD画面', default=0,
                                    help_text=u'0代表：SD、1代表：HD')
    isShare = models.BooleanField(blank=True, verbose_name=u'共享设备',
                                  help_text=u'是否为共享获取的设备', default=False)
    primaryUserID = models.CharField(blank=True, verbose_name='主用户id', max_length=32, default='')
    primaryMaster = models.CharField(max_length=64, verbose_name=u'主用户名', default='')
    vodPrimaryUserID = models.CharField(blank=True, verbose_name='云存主用户id', max_length=32, default='')
    vodPrimaryMaster = models.CharField(max_length=64, verbose_name=u'云存主用户名', default='')
    data_joined = models.DateTimeField(blank=True, verbose_name=u'设备添加时间', auto_now_add=True, db_index=True)
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True, null=True)

    ip = models.CharField(blank=True, max_length=20, default='', verbose_name=u'设备区域ip')
    area = models.CharField(blank=True, max_length=100, default='', verbose_name=u'设备区域area')
    # ios要求新增字段
    version = models.CharField(blank=True, max_length=20, default='', verbose_name=u'版本号')
    iSNotification = models.BooleanField(blank=True, verbose_name=u'报警通知 0:关闭,1:开启)', default=False)
    isVod = models.SmallIntegerField(blank=True, default=0, verbose_name='是否支持云存')  # 是否支持云存设备
    isExist = models.SmallIntegerField(blank=True, default=1,
                                       verbose_name='是否被删除')  # 是否被删除了(需主用户交互) 1存在，0不存在，2设备被重置
    isCameraOpenCloud = models.SmallIntegerField(blank=True, default=1, verbose_name='是否开启云存')  # 0：不开启  1：开启
    serial_number = models.CharField(blank=True, max_length=9, default='', verbose_name='关联序列号')
    # 分享用户备注名
    noteName = models.CharField(max_length=64, verbose_name=u'用户备注名', default='', blank=True)
    device_group_id = models.IntegerField(default=0, verbose_name='关联设备分组表id')
    ###
    REQUIRED_FIELDS = []

    def __str__(self):
        return self.NickName

    def model_to_dict(self, fields=None, exclude=None):
        opts = self._meta
        data = {}
        for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many):
            if not getattr(f, 'editable', False):
                continue
            if fields and f.name not in fields:
                continue
            if exclude and f.name in exclude:
                continue
            data[f.name] = f.value_from_object(self)
        return data

    class Meta:
        db_table = 'device_info'
        ordering = ('-data_joined',)
        verbose_name = u'用户设备信息表'
        verbose_name_plural = verbose_name


class Access_Log(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.CharField(max_length=100, default='', db_index=True, blank=True, verbose_name=u'用户')
    operation = models.CharField(max_length=100, db_index=True, default='', blank=True, verbose_name=u'操作')
    ip = models.CharField(max_length=100, default='', db_index=True, blank=True, verbose_name=u'访问ip地址')
    url = models.CharField(max_length=150, default='', blank=True, verbose_name=u'访问路径')
    status = models.IntegerField(default=0, blank=True, verbose_name=u'状态')
    time = models.DateTimeField(null=True, blank=True, db_index=True, verbose_name=u'访问时间')
    content = models.TextField(blank=True, default='', verbose_name=u'参数内容')

    class Meta:
        db_table = 'access_log'
        verbose_name = u'访问日志表'
        verbose_name_plural = verbose_name


class Equipment_Info(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name=u'自增标记ID')
    devUid = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'设备ID')
    devNickName = models.CharField(blank=True, max_length=32, default='', verbose_name=u'设备昵称')
    Channel = models.IntegerField(default=1, blank=True, verbose_name=u'设备通道')
    eventType = models.IntegerField(default=0, blank=True, verbose_name=u'事件类型')
    status = models.BooleanField(blank=True, default=False, verbose_name=u'事件状态')
    alarm = models.CharField(blank=True, max_length=256, verbose_name=u'报警信息')
    eventTime = models.CharField(blank=True, db_index=True, default='', max_length=16, verbose_name=u'设备报警时间')
    receiveTime = models.CharField(blank=True, default='', max_length=16, verbose_name=u'接收到报警时间')
    userID_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户ID')
    is_st = models.SmallIntegerField(default=0, verbose_name='是否截图')  # 0 否,1 是图，2,视频
    storage_location = models.SmallIntegerField(default=1, verbose_name='数据信息存储位置。1：阿里云oss，2：aws')
    borderCoords = models.TextField(default='', blank=True, verbose_name=u'ai类型图片边框位置信息')
    addTime = models.IntegerField(verbose_name='添加时间', db_index=True, default=0)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'equipment_info'
        verbose_name = u'设备信息推送表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)
        app_label = "PushModel"


class EquipmentInfo1(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS, 3: oci美国凤凰城, 4: oci英国伦敦, 5: 华为云
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_1'
        verbose_name = '推送数据表1'
        app_label = 'PushModel'


class EquipmentInfo2(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_2'
        verbose_name = '推送数据表2'
        app_label = 'PushModel'


class EquipmentInfo3(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_3'
        verbose_name = '推送数据表3'
        app_label = 'PushModel'


class EquipmentInfo4(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_4'
        verbose_name = '推送数据表4'
        app_label = 'PushModel'


class EquipmentInfo5(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_5'
        verbose_name = '推送数据表5'
        app_label = 'PushModel'


class EquipmentInfo6(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_6'
        verbose_name = '推送数据表6'
        app_label = 'PushModel'


class EquipmentInfo7(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_7'
        verbose_name = '推送数据表7'
        app_label = 'PushModel'


class EquipmentInfo8(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_8'
        verbose_name = '推送数据表8'
        app_label = 'PushModel'


class EquipmentInfo9(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_9'
        verbose_name = '推送数据表9'
        app_label = 'PushModel'


class EquipmentInfo10(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_10'
        verbose_name = '推送数据表10'
        app_label = 'PushModel'


class EquipmentInfo11(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_11'
        verbose_name = '推送数据表11'
        app_label = 'PushModel'


class EquipmentInfo12(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_12'
        verbose_name = '推送数据表12'
        app_label = 'PushModel'


class EquipmentInfo13(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_13'
        verbose_name = '推送数据表13'
        app_label = 'PushModel'


class EquipmentInfo14(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_14'
        verbose_name = '推送数据表14'
        app_label = 'PushModel'


class EquipmentInfo15(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_15'
        verbose_name = '推送数据表15'
        app_label = 'PushModel'


class EquipmentInfo16(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_16'
        verbose_name = '推送数据表16'
        app_label = 'PushModel'


class EquipmentInfo17(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_17'
        verbose_name = '推送数据表17'
        app_label = 'PushModel'


class EquipmentInfo18(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_18'
        verbose_name = '推送数据表18'
        app_label = 'PushModel'


class EquipmentInfo19(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_19'
        verbose_name = '推送数据表19'
        app_label = 'PushModel'


class EquipmentInfo20(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_20'
        verbose_name = '推送数据表20'
        app_label = 'PushModel'


class EquipmentInfo21(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_21'
        verbose_name = '推送数据表21'
        app_label = 'PushModel'


class EquipmentInfo22(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_22'
        verbose_name = '推送数据表22'
        app_label = 'PushModel'


class EquipmentInfo23(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_23'
        verbose_name = '推送数据表23'
        app_label = 'PushModel'


class EquipmentInfo24(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_24'
        verbose_name = '推送数据表24'
        app_label = 'PushModel'


class EquipmentInfo25(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_25'
        verbose_name = '推送数据表25'
        app_label = 'PushModel'


class EquipmentInfo26(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_26'
        verbose_name = '推送数据表26'
        app_label = 'PushModel'


class EquipmentInfo27(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_27'
        verbose_name = '推送数据表27'
        app_label = 'PushModel'


class EquipmentInfo28(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_28'
        verbose_name = '推送数据表28'
        app_label = 'PushModel'


class EquipmentInfo29(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_29'
        verbose_name = '推送数据表29'
        app_label = 'PushModel'


class EquipmentInfo30(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_30'
        verbose_name = '推送数据表30'
        app_label = 'PushModel'


class EquipmentInfo31(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_31'
        verbose_name = '推送数据表31'
        app_label = 'PushModel'


class EquipmentInfo32(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_32'
        verbose_name = '推送数据表32'
        app_label = 'PushModel'


class EquipmentInfo33(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_33'
        verbose_name = '推送数据表33'
        app_label = 'PushModel'


class EquipmentInfo34(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_34'
        verbose_name = '推送数据表34'
        app_label = 'PushModel'


class EquipmentInfo35(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_35'
        verbose_name = '推送数据表35'
        app_label = 'PushModel'


class EquipmentInfo36(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_36'
        verbose_name = '推送数据表36'
        app_label = 'PushModel'


class EquipmentInfo37(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_37'
        verbose_name = '推送数据表37'
        app_label = 'PushModel'


class EquipmentInfo38(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_38'
        verbose_name = '推送数据表38'
        app_label = 'PushModel'


class EquipmentInfo39(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_39'
        verbose_name = '推送数据表39'
        app_label = 'PushModel'


class EquipmentInfo40(models.Model):
    id = models.BigAutoField(primary_key=True, verbose_name='主键')
    device_user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name='用户id')
    device_uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    device_nick_name = models.CharField(default='', max_length=32, verbose_name='设备昵称')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='设备通道')
    # 0:空字符,1:ai人,2:ai动物,3:车,123:组合类型(人/车/动物),
    # 51:移动侦测,52:传感器报警,53:影像遗失,54:PIR,55:门磁报警,56:外部发报,57:人型报警,
    # 702:摄像头休眠,703:摄像头唤醒,704：电量过低
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    # （51,）表示一个事件标签。（51,57,）两个事件标签
    event_tag = models.CharField(default='', max_length=128, db_index=True, verbose_name='事件标签')
    alarm = models.CharField(default='', max_length=256, verbose_name='报警信息')
    # 0:无图, 1:单图, 3:多图
    is_st = models.PositiveSmallIntegerField(default=0, verbose_name='图片信息')
    # 1: 阿里云, 2: AWS
    storage_location = models.PositiveSmallIntegerField(default=1, verbose_name='存储桶位置')
    border_coords = models.TextField(default='', verbose_name='ai类型图片边框位置信息')
    status = models.BooleanField(default=False, verbose_name='已读状态')  # 0: 未读, 1: 已读
    answer_status = models.BooleanField(default=False, verbose_name='接听状态')  # 0: 未接听,1: 已接听
    event_time = models.CharField(default='', max_length=10, db_index=True, verbose_name='上报时间')
    add_time = models.IntegerField(default=0, db_index=True, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_40'
        verbose_name = '推送数据表40'
        app_label = 'PushModel'


class PushInaccurateFeedback(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键id')
    equipment_info_id = models.CharField(default='', max_length=32, verbose_name='推送表id')
    user_id = models.CharField(default='', max_length=32, verbose_name='用户id')
    uid = models.CharField(default='', max_length=32, verbose_name='uid')
    channel = models.PositiveSmallIntegerField(default=1, verbose_name='通道')
    # 事件类型, 1,2,3,3:aws rekognition识别,其他为设备识别
    event_type = models.IntegerField(default=0, verbose_name='事件类型')
    event_time = models.CharField(default='', max_length=16, verbose_name='事件时间')
    is_st = models.SmallIntegerField(default=0, verbose_name='是否多图')  # 1:单图, 3:多图
    identify_type = models.SmallIntegerField(default=0, verbose_name='AI识别类型')  # 0:云端检测, 1:本地检测
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    tag = models.CharField(default='', max_length=128, verbose_name='标签')

    class Meta:
        db_table = 'push_inaccurate_feedback'
        verbose_name = '推送不准确反馈表'
        verbose_name_plural = verbose_name
        app_label = 'PushModel'


class Ai_Push_Info(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    devUid = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'设备ID')
    devNickName = models.CharField(blank=True, max_length=32, default='', verbose_name=u'设备昵称')
    Channel = models.IntegerField(default=1, blank=True, verbose_name=u'设备通道')
    eventType = models.CharField(blank=True, max_length=100, default='', verbose_name=u'事件类型')
    status = models.BooleanField(blank=True, default=False, verbose_name=u'事件状态')
    alarm = models.CharField(blank=True, max_length=256, verbose_name=u'报警信息')
    eventTime = models.CharField(blank=True, default='', max_length=16, verbose_name=u'设备报警时间')
    receiveTime = models.CharField(blank=True, default='', max_length=16, verbose_name=u'接收到报警时间')
    userID_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户ID')
    is_st = models.SmallIntegerField(default=0, verbose_name='是否截图')  # 0 否,1 是图，2,视频
    storage_location = models.SmallIntegerField(default=1, db_index=True,
                                                verbose_name='数据信息存储位置。1：阿里云oss，2：aws')
    # message_id = models.CharField(blank=True, max_length=32, default='', verbose_name='第三方推送服务器返回的id')
    # push_type = models.SmallIntegerField(blank=True, default=0, verbose_name='第三方推送服务器标志。0：APNS推送，1：谷歌推送，2：极光推送')
    # push_server_status = models.IntegerField(blank=True, default=200, verbose_name='是否成功推送到第三方服务器。200：成功，other：失败')
    # push_device_status = models.SmallIntegerField(blank=True, default=-1, verbose_name='是否成功推送到目标设备。0：失败，1：成功')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'ai_push_info'
        verbose_name = u'ai信息推送表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class StatResModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自动ID')
    name = models.CharField(default='', max_length=120, verbose_name='图片名称', unique=True)
    addTime = models.IntegerField(verbose_name='添加时间', default=0)

    def __str__(self):
        return self.name

    class Meta:
        db_table = 'statres'
        verbose_name = '静态资源表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class FeedBackModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    userID = models.ForeignKey(Device_User, null=True, blank=True, to_field='userID', on_delete=models.CASCADE)
    type = models.SmallIntegerField(default=0, verbose_name='反馈类型')  # 【0:产品建议,1:功能异常,2:安全问题】
    status = models.SmallIntegerField(default=0, verbose_name='状态:0未解决/解决')
    content = models.TextField(blank=True, null=True, verbose_name=u'反馈描述')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)
    FS = models.ManyToManyField(to='StatResModel', blank=True, verbose_name=u'用户反馈关联资源',
                                db_table='fb_res')
    app = models.CharField(max_length=8, default='', verbose_name='类型')  # [ios,android]
    phone_model = models.CharField(max_length=64, default='', verbose_name='手机型号')  # [小米,android]
    os_version = models.CharField(max_length=16, default='', verbose_name='系统版本')
    uid = models.CharField(max_length=20, default='', verbose_name='设备uid')
    product_type = models.CharField(max_length=32, default='', verbose_name='设备uid')
    app_version = models.CharField(max_length=32, default='', verbose_name='app版本信息')

    appBundleId = models.CharField(max_length=32, default='', verbose_name='app版本appBundleId')
    email = models.CharField(max_length=32, default='', verbose_name='app版本email')
    score = models.CharField(max_length=32, default='0', verbose_name='评分--星星数')
    collect_status = models.SmallIntegerField(default=0, verbose_name='收藏[0:未收藏, 1:已收藏]')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'feedback'
        verbose_name = u'用户反馈信息表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class User_Brand(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    # 关联用户
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)
    deviceSupplier = models.CharField(max_length=32, default='',
                                      verbose_name='（必填）设备供应商 string  （例：华为、小米...）')
    deviceModel = models.CharField(max_length=64, default='', verbose_name='（必填）设备型号 string @mock=HM NOTE 1TD')
    osType = models.CharField(max_length=32, default='', verbose_name='（必填）操作系统名称 string @mock=Android')
    osVersion = models.CharField(max_length=32, default='', verbose_name='（必填）操作系统版本号 string @mock=4.0')

    country = models.CharField(max_length=200, default='', verbose_name='国家')
    province = models.CharField(max_length=150, default='', verbose_name='省')
    city = models.CharField(max_length=132, default='', verbose_name='市')
    area = models.CharField(max_length=132, default='', verbose_name='区')
    street = models.CharField(max_length=132, default='', verbose_name='街道')

    longitude = models.CharField(max_length=30, default='', verbose_name='经度')
    latitude = models.CharField(max_length=30, default='', verbose_name='纬度')
    appId = models.CharField(max_length=50, default='', verbose_name='appid_值')
    status = models.IntegerField(default=0, verbose_name='传国家省市信息过来就为状态：1 ，不传就为状态：0')
    ip = models.CharField(blank=True, max_length=20, default='', verbose_name=u'区域ip')

    addTime = models.IntegerField(verbose_name='添加时间', default=0)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'user_brand'
        verbose_name = u'用户登录手机端手机品牌统计表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


# 存储桶表
class VodBucketModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    bucket = models.CharField(max_length=60, verbose_name='存储桶名称')
    storeDay = models.IntegerField(default=0, verbose_name='存储生命周期(天)')
    content = models.TextField(verbose_name='描述', default='')
    endpoint = models.CharField(max_length=125, default='', verbose_name='存储节点')
    area = models.CharField(max_length=16, default='', verbose_name='区域')
    region = models.CharField(max_length=16, default='', verbose_name='regionID')
    is_free = models.SmallIntegerField(default=0, verbose_name='是否为免费存储桶[0:否,1:是]')

    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)

    mold = models.SmallIntegerField(default=0, verbose_name='存储区域类型')  # 0：国内阿里 1：国外aws
    region_id = models.IntegerField(default=1, verbose_name='大洲编号')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_bucket'
        verbose_name = u'存储通信息'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class Store_Meal(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增ID')
    # title = models.CharField(blank=True, max_length=32, verbose_name=u'标题')
    currency = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'货币符号')
    symbol = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'符号')
    price = models.CharField(blank=True, max_length=32, verbose_name=u'价格')
    virtual_price = models.CharField(blank=True, max_length=32, verbose_name=u'虚拟价格')
    is_discounts = models.SmallIntegerField(default=0, verbose_name=u'该套餐是否有优惠 [0=否，1是]')  # 0没有；1有
    discount_price = models.CharField(blank=True, max_length=32, verbose_name=u'第二年优惠价格')
    day = models.IntegerField(default=0, blank=True, verbose_name=u'云存录像保存天数（循环）')  # 7,30,180,360
    expire = models.IntegerField(default=0, blank=True, verbose_name=u'有效期')  # 单位月
    # content = models.TextField(blank=True, null=True, verbose_name=u'描述')
    add_time = models.DateTimeField(blank=True, null=True, verbose_name=u'加入时间', auto_now_add=True)
    # 1: PayPal, 2: 支付宝, 3: 微信, 4: 苹果支付, 5: 苹果内购, 10: 免费体验, 11: 激活码
    pay_type = models.ManyToManyField(to='Pay_Type', verbose_name='付款类型', db_table='store_meal_pay')
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True)
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE,
                               default=1, verbose_name='存储空间')
    commodity_type = models.SmallIntegerField(default=0, verbose_name='云存储套餐类型')  # 0：事件型 1：连续型
    commodity_code = models.CharField(default='', max_length=32, verbose_name='套餐规格码')
    is_show = models.SmallIntegerField(default=0, verbose_name=u'是否隐藏 [0=否，1是]')
    # lang = models.CharField(default='', max_length=20, verbose_name='语言/国家')
    lang = models.ManyToManyField(to='Lang', verbose_name='套餐语言', db_table='store_meal_lang')
    cycle_config_id = models.IntegerField(null=True, verbose_name='周期付款配置表id')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')  # 单位月
    icloud_store_meal_id = models.IntegerField(default=0, verbose_name='关联云盘套餐id')
    pixel_level = models.SmallIntegerField(default=0, verbose_name='像素等级')  # 0:低于4k像素;1:大于等于4k像素
    is_ai = models.SmallIntegerField(default=0, verbose_name='是否支持AI')  # 0：不支持；1：支持
    product_id = models.CharField(default='', max_length=64, verbose_name='商品id')
    app_type = models.SmallIntegerField(default=0, verbose_name='app类型')  # 1:ZosiSmart苹果; 2:Vsees苹果
    is_4g = models.SmallIntegerField(default=0, verbose_name='是否支持4G')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'store_meal'
        verbose_name = u'存储套餐'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class AiStoreMeal(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增ID')
    price = models.CharField(blank=True, max_length=32, verbose_name=u'价格')
    virtual_price = models.CharField(blank=True, max_length=32, verbose_name=u'虚拟价格')
    symbol = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'符号')
    currency = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'货币符号')
    is_show = models.SmallIntegerField(default=0, verbose_name=u'是否显示')  # 0: 否, 1: 是
    is_beta = models.SmallIntegerField(default=0, verbose_name=u'是否显示beta')  # 0: 否, 1: 是
    is_discounts = models.SmallIntegerField(default=0, verbose_name=u'是否有优惠')  # 0: 没有, 1: 有
    discount_price = models.CharField(blank=True, max_length=32, verbose_name=u'第二年优惠价格')
    effective_day = models.IntegerField(default=0, blank=True, verbose_name=u'有效天数')  # 7, 30
    pay_type = models.ManyToManyField(to='Pay_Type', verbose_name='付款类型', db_table='ai_store_meal_pay')
    lang = models.ManyToManyField(to='Lang', verbose_name='套餐语言', db_table='ai_store_meal_lang')
    add_time = models.DateTimeField(blank=True, verbose_name=u'添加时间', auto_now_add=True)
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'ai_store_meal'
        verbose_name = u'AI套餐'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class Pay_Type(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增ID')
    payment = models.CharField(max_length=32, verbose_name=u'支付方式')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'pay_type'
        verbose_name = u'付款类型'
        verbose_name_plural = verbose_name
        ordering = ('id',)


# 套餐语言表
class Lang(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增ID')
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='语言/国家')
    title = models.CharField(blank=True, max_length=320, verbose_name='标题')
    new_title = models.JSONField(null=True, verbose_name='新套餐标题')
    content = models.TextField(blank=True, null=True, verbose_name='描述')
    discount_content = models.CharField(blank=True, max_length=320, verbose_name=u'优惠信息描述')
    type = models.SmallIntegerField(default=0, verbose_name='类型')  # 0:云存 1：AI 2:4G 3:云盘

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'lang'
        verbose_name = '套餐语言'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class Equipment_Version(models.Model):
    eid = models.CharField(blank=True, max_length=32, primary_key=True)
    ESN = models.CharField(blank=True, max_length=32, verbose_name=u'设备规格名称')
    code = models.CharField(blank=True, max_length=64, verbose_name=u'设备规格代码')
    version = models.CharField(blank=True, max_length=64, verbose_name=u'设备版本')
    softwareVersion = models.CharField(blank=True, max_length=32, verbose_name=u'软件版本')
    chipModelList2Code = models.CharField(max_length=32, blank=True, verbose_name=u'主芯片码')
    channel = models.IntegerField(blank=True, verbose_name=u'通道数')
    resolutionRatio = models.IntegerField(blank=True, verbose_name=u'分辨率')
    type = models.CharField(blank=True, max_length=16, verbose_name=u'设备机型')
    companyCode = models.CharField(blank=True, max_length=128, verbose_name=u'用户公司名称')
    data_joined = models.DateTimeField(blank=True, verbose_name=u'加入时间', auto_now_add=True)
    fileSize = models.IntegerField(blank=True, verbose_name=u'文件总大小')
    filePath = models.CharField(blank=True, max_length=256, verbose_name=u'升级文件路径')
    Description = models.TextField(blank=True, default='', verbose_name=u'描述信息')
    fileMd5 = models.CharField(blank=True, max_length=32, default='', verbose_name=u'上传文件MD5加密')
    status = models.BooleanField(blank=True, default=True, verbose_name=u'是否开启更新状态')
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True)
    lang = models.CharField(blank=True, default='en', max_length=32, verbose_name=u'ota包内置语言')
    mci = models.CharField(default='', blank=True, max_length=10, verbose_name='设备类型')
    img = models.CharField(max_length=300, blank=True, default='', verbose_name=u'图片路径')
    max_ver = models.CharField(default='', max_length=16, verbose_name='最大版本号')
    is_popup = models.SmallIntegerField(default=0, verbose_name=u'是否弹窗')
    data_json = models.JSONField(null=True,
                                 verbose_name='版本号附加数据,关联国家或者指定UID,{uid_list:[],country_list:[]}')
    auto_update = models.BooleanField(blank=True, default=False, verbose_name=u'是否自动升级')

    def __str__(self):
        return self.eid

    class Meta:
        verbose_name = '设备版本信息'
        ordering = ('-data_joined',)
        db_table = 'equipment_version'


class AVSSVersion(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    online_version = models.CharField(default='', max_length=32, verbose_name='线上版本')
    force_update_version = models.CharField(default='', max_length=32, verbose_name='强制更新版本')

    class Meta:
        verbose_name = 'AVSS版本'
        db_table = 'avss_version'


class App_Info(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    appBundleId = models.CharField(blank=True, max_length=32, verbose_name=u'appID')
    appName = models.CharField(blank=True, max_length=32, verbose_name=u'app名称')
    systemLanguage = models.CharField(blank=True, max_length=32, verbose_name=u'系统语言')
    newAppversion = models.CharField(blank=True, max_length=12, verbose_name=u'系统版本')
    minAppversion = models.CharField(default='', blank=True, max_length=12, verbose_name=u'最小系统版本')
    bundleVersion = models.CharField(blank=True, max_length=12, verbose_name=u'项目版本')
    content = models.TextField(blank=True, default='', verbose_name=u'更新内容')
    app_type = models.IntegerField(default=0, blank=True, verbose_name=u'app类型')  # ios 1,android 2
    add_time = models.DateTimeField(blank=True, null=True, verbose_name=u'加入时间', auto_now_add=True)
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True)
    downloadLink = models.CharField(max_length=300, blank=True, default='', verbose_name='升级')
    img = models.CharField(default='', max_length=128, verbose_name='图片路径')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'app_info'
        verbose_name = u'app信息表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class App_Colophon(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    app_id = models.ForeignKey(App_Info, to_field='id', on_delete=models.CASCADE, verbose_name='appid编号', blank=True,
                               default=1)
    lang = models.CharField(blank=True, max_length=32, verbose_name=u'系统语言')
    newApp_version = models.CharField(blank=True, max_length=12, verbose_name=u'系统版本')
    content = models.TextField(blank=True, default='', verbose_name=u'更新内容')
    version_time = models.IntegerField(default=0, blank=True, verbose_name=u'版本更新的时间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'app_colophon'
        verbose_name = u'app信息表的记录关联到App_Info'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class Order_Model(models.Model):
    orderID = models.CharField(blank=True, max_length=20, primary_key=True, verbose_name=u'订单id')
    paymentID = models.CharField(blank=True, max_length=64, default='', verbose_name='付款id')
    trade_no = models.CharField(blank=True, max_length=64, default='', verbose_name='第三方订单号')
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)  # 订单关联用户
    UID = models.CharField(max_length=20, verbose_name='设备UID')
    channel = models.SmallIntegerField(default=0, verbose_name=u'通道数')
    desc = models.CharField(max_length=50, default='', verbose_name='商品描述')
    price = models.CharField(default='', max_length=16, verbose_name='价格')
    fee = models.CharField(default='', max_length=8, verbose_name='手续费')
    refunded_amount = models.FloatField(default=0, verbose_name=u'已退款金额')
    currency = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'货币')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)
    isSelectDiscounts = models.SmallIntegerField(default=0, verbose_name=u'用户是否选择了第二年优惠 [0=否，1是]')
    # 0: 待支付, 1：支付成功, 2: 取消支付, 4: 退款失败, 5: 全额退款, 6: 部分退款, 7: PayPal已退款, 9：处理中, 10：支付失败
    status = models.SmallIntegerField(default=0, verbose_name='付款状态')
    # 1: PayPal, 2: 支付宝, 3: 微信, 4: 苹果支付, 5: 苹果内购, 10: 免费体验, 11: 激活码
    payType = models.SmallIntegerField(default=0, verbose_name='支付方式')
    payTime = models.IntegerField(verbose_name='支付成功时间', default=0)
    rank = models.ForeignKey(Store_Meal, to_field='id', default='', on_delete=models.CASCADE,
                             verbose_name='关联云存套餐表')
    ai_rank = models.ForeignKey(AiStoreMeal, to_field='id', default='', on_delete=models.CASCADE,
                                verbose_name='关联ai套餐表')
    order_type = models.SmallIntegerField(default=0, verbose_name='订单类型：0：云存,1:AI+云存,2:联通4G,3:五兴,4:云盘')
    unify_combo_id = models.CharField(blank=True, default='', max_length=32, verbose_name=u'统一套餐id')
    nickname = models.CharField(default='', max_length=64, verbose_name='设备昵称')
    uid_bucket_id = models.IntegerField(default=0, verbose_name='关联uid_bucket的字段')
    commodity_type = models.SmallIntegerField(default=0, verbose_name='云存储套餐类型')
    commodity_code = models.CharField(default='', max_length=32, verbose_name='套餐规格码')
    pay_url = models.CharField(max_length=2000, default='', verbose_name='支付url')
    paypal = models.CharField(max_length=500, null=True, blank=True, verbose_name='支付批准url')
    promotion_rule_id = models.CharField(blank=True, max_length=64, default='', verbose_name='促销id')
    plan_id = models.CharField(default='', blank=True, max_length=64, verbose_name=u'paypal计划id')
    agreement_id = models.CharField(default='', blank=True, max_length=64, verbose_name=u'paypal协议id')
    coupon_id = models.CharField(default='', blank=True, max_length=10, verbose_name=u'优惠券id')
    store_meal_name = models.CharField(default='', blank=True, max_length=64, verbose_name=u'关联套餐名')
    create_vod = models.SmallIntegerField(default=0, verbose_name='是否生成云存服务')  # 0：未生成，1：已生成
    transaction_id = models.CharField(default='', blank=True, max_length=64, verbose_name=u'苹果内购transactionId')
    original_transaction_id = models.CharField(default='', blank=True, max_length=64,
                                               verbose_name=u'苹果内购originalTransactionId')
    app_type = models.SmallIntegerField(default=1, verbose_name='支付APP来源')  # 1：zosi，2：vsees

    def __str__(self):
        return self.orderID

    class Meta:
        db_table = 'orders'
        verbose_name = u'订单信息表'
        verbose_name_plural = verbose_name
        ordering = ('-orderID',)


# 优惠券文案语言表
class CouponLang(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增ID')
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='语言/国家')
    instruction = models.CharField(blank=True, default='', max_length=200, verbose_name=u'用法')
    quota = models.CharField(blank=True, default='', max_length=200, verbose_name=u'优惠额度, 例如20.0%')
    unit = models.CharField(blank=True, default='', max_length=200, verbose_name=u'优惠单位, 例如off, 折')
    remark = models.CharField(blank=True, default='', max_length=200, verbose_name=u'备注')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'coupon_lang'
        verbose_name = '套餐语言'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class CouponConfigModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    type = models.SmallIntegerField(default=0, verbose_name='优惠类型')  # 1打折； 2抵扣
    use_range = models.CharField(default=0, max_length=100, verbose_name='使用限制')  # 0:所有服务都可使用; 1:云存；2:ai;多种1，2，3
    coupon_discount = models.CharField(blank=True, max_length=32, verbose_name=u'折扣力度')
    lang = models.ManyToManyField(to='CouponLang', verbose_name='套餐语言', db_table='coupon_lang_associated')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'coupon_config'
        verbose_name = u'优惠券配置表'
        verbose_name_plural = verbose_name


class CouponModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    use_status = models.SmallIntegerField(default=0, verbose_name='使用状态')  # 0未使用；1冻结；2已使用
    distribute_time = models.IntegerField(verbose_name='发放到用户账户时间', default=0)
    valid_time = models.PositiveIntegerField(default=9999999999, verbose_name='有效期间')  # 超过有效期不可在使用；0永久
    # userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)  # 关联用户
    userID = models.CharField(blank=True, max_length=32, db_index=True, verbose_name=u'用户ID')
    coupon_config = models.ForeignKey(CouponConfigModel, null=True, blank=True, to_field='id', on_delete=models.CASCADE,
                                      verbose_name='关联优惠券配置表的id')
    update_time = models.IntegerField(verbose_name='更新时间', default=0)
    create_time = models.IntegerField(verbose_name='添加时间', default=0)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'coupon'
        verbose_name = u'优惠券'
        verbose_name_plural = verbose_name


class CouponCombo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    coupon_id = models.IntegerField(default=0, verbose_name='优惠券id')
    combo_id = models.IntegerField(default=0, verbose_name='套餐id')
    # 0：云存，1：AI，2：4G
    coupon_type = models.SmallIntegerField(verbose_name='类型', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)
    create_time = models.IntegerField(verbose_name='添加时间', default=0)

    class Meta:
        db_table = 'coupon_combo'
        verbose_name = u'优惠券关联套餐'
        verbose_name_plural = verbose_name


class PayCycleConfigModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    # name = models.CharField(default='',max_length=200, verbose_name='计划名字')
    # tax = models.CharField(max_length=2000, default='', verbose_name='税金')
    cycles = models.IntegerField(verbose_name='周期：0代表无限期', default=0)
    frequency = models.CharField(max_length=50, verbose_name='频率,MONTH,WEEK,YEAR', default=0)
    frequencyInterval = models.IntegerField(default=0, verbose_name='频率周期')
    remark = models.CharField(max_length=1000, default='', verbose_name='备注')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'pay_cycle_config'
        verbose_name = u'周期付款计划'
        verbose_name_plural = verbose_name


class PromotionRuleModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    # json格式, 例: {"cn": "黑色星期五", "en": "Black Friday"}
    ruleName = models.TextField(default='', verbose_name='规则名字')
    # json格式, 例: {"cn": "买一送一","en": "buy one get one free"}
    ruleDesc = models.TextField(default='', verbose_name='规则描述')
    # json格式, 例: {"buy": 1, "get": 1}
    ruleConfig = models.CharField(max_length=2000, default='', verbose_name='规则配置')
    startTime = models.IntegerField(default=0, verbose_name='促销活动开始时间')
    endTime = models.IntegerField(default=0, verbose_name='促销活动结束时间')
    # 0: 未进行, 1: 进行中
    status = models.SmallIntegerField(default=0, verbose_name='活动状态')
    remark = models.CharField(max_length=50, default='', verbose_name='备注')
    # json格式, 例: {"cn": "买一送一", "en": "buy one get one free"}
    popups = models.CharField(max_length=2000, default='', verbose_name='app弹窗消息')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'promotion_rule'
        verbose_name = u'促销规则表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class VodHlsModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='回放列表主键')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    time = models.IntegerField(verbose_name='播放列表名字时间戳', default=0, db_index=True)
    endTime = models.IntegerField(verbose_name='云存储删除时间（周期）', default=0, db_index=True)
    sec = models.IntegerField(verbose_name='秒数', default=0)
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE, default=1,
                               verbose_name='存储空间')
    fg = models.CharField(max_length=20, verbose_name='ts个数,时间描述片段数')  # 阿里为时间片段数,亚马逊为一个32bit整型，前28bit代表ts文件的时长

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls'
        verbose_name = u'云存回放信息表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class VodHlsMon(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_mon'
        verbose_name = '星期一云存回放信息表'
        ordering = ('-id',)


class VodHlsTues(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_tues'
        verbose_name = '星期二云存回放信息表'
        ordering = ('-id',)


class VodHlsWed(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_wed'
        verbose_name = '星期三云存回放信息表'
        ordering = ('-id',)


class VodHlsThur(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_thur'
        verbose_name = '星期四云存回放信息表'
        ordering = ('-id',)


class VodHlsFri(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_fri'
        verbose_name = '星期五云存回放信息表'
        ordering = ('-id',)


class VodHlsSat(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_sat'
        verbose_name = '星期六云存回放信息表'
        ordering = ('-id',)


class VodHlsSun(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_sun'
        verbose_name = '星期天云存回放信息表'
        ordering = ('-id',)


class OssCrdModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, verbose_name='设备UID')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    data = models.TextField(verbose_name='设备sts')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE, default=1,
                               verbose_name='存储空间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'osscrd'
        verbose_name = u'设备证书'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class StsCrdModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    data = models.TextField(verbose_name='设备sts')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE, default=1,
                               verbose_name='存储空间')
    type = models.SmallIntegerField(default=0, verbose_name='sts类型')  # 0:阿里云,1:s3

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'stscrd'
        verbose_name = u'设备证书'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class UID_Bucket(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE,
                               verbose_name='存储空间')
    status = models.SmallIntegerField(default=0, verbose_name='状态[0:关闭,1:开启]')
    orderId = models.CharField(max_length=20, verbose_name='关联订单号', default='', db_index=True)
    endTime = models.BigIntegerField(verbose_name='套餐结束时间', db_index=True, default=0)
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updateTime = models.BigIntegerField(verbose_name='更新时间', default=0)
    use_status = models.IntegerField(verbose_name='使用状态[1:使用中,2已过期]', default=0)
    has_unused = models.SmallIntegerField(default=0, verbose_name='是否拥有其它未使用的套餐[0:否,1:是]')

    class Meta:
        db_table = 'vod_uid_bucket'
        verbose_name = '设备关联套餐表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class Unused_Uid_Meal(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    bucket = models.ForeignKey(VodBucketModel, blank=True, to_field='id', on_delete=models.CASCADE,
                               verbose_name='存储空间')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    expire = models.IntegerField(verbose_name='存储桶存储时长[月份]', default=0)
    is_ai = models.SmallIntegerField(verbose_name='是否开通AI服务', default=0)  # 0:不开通；1：开通
    order_id = models.CharField(max_length=20, verbose_name='关联订单号', default='', db_index=True)

    # num = models.IntegerField(verbose_name='个数', default=0)
    # effect_time = models.BigIntegerField(verbose_name='生效时间', db_index=True, default=0)
    # uid_bucket = models.ForeignKey(UID_Bucket, blank=True, to_field='id', on_delete=models.CASCADE, default=0,
    #                            verbose_name='uid_bucket关联')
    class Meta:
        db_table = 'unused_uid_Meal'
        verbose_name = '未使用的设备关联套餐表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class UID_Preview(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(default='', max_length=20, db_index=True, verbose_name='设备UID')
    channel = models.SmallIntegerField(verbose_name=u'通道号', default=0)
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'uid_preview'
        verbose_name = '设备预览图'
        verbose_name_plural = verbose_name
        ordering = ('id',)


# 系统发送信息新到用户
class SysMsgModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    userID_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户ID')
    title = models.CharField(default='', max_length=64, verbose_name='标题')
    msg = models.TextField(blank=True, default='', verbose_name='发送内容')
    status = models.SmallIntegerField(verbose_name='是否已读', default=0)  # 0:否,1:是
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)
    # 消息类型, 0:系统通知, 702:休眠, 704:低电量
    eventType = models.IntegerField(verbose_name='消息类型', default=0)
    jumpLink = models.TextField(default='', verbose_name='跳转链接')
    uid = models.CharField(default='', max_length=20, db_index=True, verbose_name='设备UID')

    class Meta:
        db_table = 'sys_msg'
        verbose_name = '系统消息'
        verbose_name_plural = verbose_name
        ordering = ('-id',)
        app_label = "PushModel"


# 设备推送重构
# 设备配置表，新
class UidSetModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, db_index=True, unique=True, verbose_name='设备UID')
    channel = models.SmallIntegerField(default=0, verbose_name='通道数量')  #
    detect_status = models.SmallIntegerField(default=0, verbose_name='推送开关')  # 状态[0:关闭,1:开启,2:用户解绑]
    detect_interval = models.IntegerField(verbose_name='推送间隔', default=60)  # 秒
    addTime = models.IntegerField(verbose_name='添加时间', default=0, db_index=True)
    updTime = models.IntegerField(verbose_name='更新时间', default=0, db_index=True)
    ucode = models.CharField(max_length=32, verbose_name='设备产品码', default='')
    version = models.CharField(max_length=32, verbose_name='设备版本', default='')
    p2p_region = models.CharField(max_length=16, verbose_name='设备p2p区域', default='ALL')  # ALL CN EU US
    tz = models.CharField(default='', max_length=16, verbose_name='设备时区')  # +8
    video_code = models.SmallIntegerField(default=0, verbose_name='编码类型')  # 0:264,1:265
    nickname = models.CharField(default='', max_length=64, verbose_name='设备昵称')
    ip = models.CharField(max_length=20, default='', verbose_name=u'设备ip')
    # 设备重置后第一次启动时间
    detect_group = models.CharField(default='', max_length=32, verbose_name=u'检测类型')
    pwd = models.CharField(max_length=32, default='', verbose_name=u'设备密码')  # 暂时是预留字段
    resetTime = models.IntegerField(default=0, verbose_name='设备重置时间')
    region_alexa = models.CharField(max_length=8, verbose_name='设备alexa区域', default='ALL')  # ALL CN EU US
    deviceModel = models.CharField(blank=True, max_length=64, default='', verbose_name=u'设备型号')
    TimeZone = models.CharField(blank=True, max_length=50, default='', verbose_name=u'时区')
    TimeStatus = models.SmallIntegerField(default=0, verbose_name='同步手机时间开关。0：关闭，1：开启')
    SpaceUsable = models.CharField(blank=True, max_length=20, default='', verbose_name=u'可用空间')
    SpaceSum = models.CharField(blank=True, max_length=20, default='', verbose_name=u'总空间')
    MirrorType = models.IntegerField(blank=True, default=0,
                                     verbose_name=u'镜像类型 0:关闭镜像,1：上下镜像，2:左右镜像，3：上下左右镜像')
    RecordType = models.IntegerField(blank=True, default=0, verbose_name=u'录像模式(0:关闭,1:全是录像,3:报警录像)')
    OutdoorModel = models.IntegerField(blank=True, default=0, verbose_name=u'室外模式 0：关闭，1：开启')
    WIFIName = models.CharField(blank=True, max_length=50, default='', verbose_name=u'无线名称')
    isDetector = models.SmallIntegerField(default=0, verbose_name=u'侦测开关0:关闭,1:开启')
    DetectorRank = models.IntegerField(default=0, verbose_name=u'侦测灵敏度 0:低,1:中,2:高,3:最高')
    is_human = models.IntegerField(default=0, verbose_name='是否支持人形追踪。0：不支持，1：支持')
    is_custom_voice = models.IntegerField(default=0, verbose_name='是否支持自定义语音。0：不支持，1：支持')
    double_wifi = models.IntegerField(default=0, verbose_name='是否支持双频wifi。0：不支持，1：支持')
    isSupportFourPoint = models.SmallIntegerField(default=0, verbose_name='是否支持预置点')  # 0:不支持, 1:支持
    mobile_4g = models.IntegerField(default=0, verbose_name='是否支持4g。0：不支持，1：支持')
    is_ptz = models.IntegerField(default=0, verbose_name='是否支持云台。0：不支持，1：支持')
    is_ai = models.IntegerField(default=2, verbose_name='是否支持ai')  # 0,关闭，1开启，2,不支持
    cloud_vod = models.SmallIntegerField(default=2, verbose_name='云存开关')  # 0,关闭，1开启，2,不支持
    is_alexa = models.IntegerField(default=0, verbose_name='是否支持alexa')  # 0为不支持，1为支持，2为开启alexa发现
    is_notification = models.IntegerField(blank=True, default=1, verbose_name='新加-消息提醒开关')  # 0：关闭，1：开启
    new_detect_interval = models.IntegerField(blank=True, verbose_name='新加-消息提醒间隔', default=60)  # 秒
    tb_country = models.IntegerField(blank=True, default=0, verbose_name='国家')
    tb_city_information_id = models.IntegerField(blank=True, default=0, verbose_name='城市信息')
    device_type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    ai_type = models.IntegerField(default=0, verbose_name='检测类型')
    msg_notify = models.JSONField(null=True, verbose_name='消息通知Json')

    class Meta:
        db_table = 'uid_set'
        verbose_name = u'设备配置表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


# 设备关联用户推送
class UidPushModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)
    uid_set = models.ForeignKey(UidSetModel, to_field='id', on_delete=models.CASCADE)
    appBundleId = models.CharField(blank=True, max_length=32, verbose_name=u'appID')
    app_type = models.IntegerField(default=0, verbose_name=u'app类型 1:ios,2:安卓')
    # 0: apns, 1: 安卓gcm, 2: 极光, 3:华为, 4:小米, 5:vivo, 6:oppo, 7:魅族, 8:荣耀
    push_type = models.IntegerField(default=0, verbose_name=u'推送类型')
    token_val = models.CharField(default='', max_length=500, db_index=True, verbose_name=u'设备验证令牌')
    jg_token_val = models.CharField(default='', max_length=500, verbose_name=u'极光推送令牌')
    m_code = models.CharField(default='', max_length=64, verbose_name='手机唯一标识')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)
    lang = models.CharField(max_length=8, verbose_name='推送语言类型', default='en')  # en英文 cn中文
    tz = models.CharField(max_length=8, verbose_name='utc时区', default='0')

    class Meta:
        db_table = 'uid_push'
        verbose_name = '设备绑定'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class GatewayPush(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    user_id = models.CharField(default='', max_length=32, db_index=True, verbose_name=u'用户id')
    app_bundle_id = models.CharField(default='', max_length=32, verbose_name=u'app包id')
    app_type = models.IntegerField(default=0, verbose_name=u'app类型')  # 1: ios, 2: 安卓
    push_type = models.IntegerField(default=0,
                                    verbose_name=u'推送类型')  # 0: apns, 1: 安卓gcm, 2: 极光, 3:华为, 4:小米, 5:vivo, 6:oppo, 7:魅族
    token_val = models.CharField(default='', max_length=500, verbose_name=u'设备验证令牌')
    jg_token_val = models.CharField(default='', max_length=500, verbose_name=u'极光推送令牌')
    m_code = models.CharField(default='', max_length=64, db_index=True, verbose_name='手机唯一标识')
    lang = models.CharField(default='en', max_length=8, verbose_name='推送语言')
    tz = models.CharField(default='0', max_length=8, verbose_name='时区')
    logout = models.BooleanField(default=False, verbose_name=u'退出登录')

    class Meta:
        db_table = 'gateway_push'
        verbose_name = '网关推送'
        verbose_name_plural = verbose_name
        app_label = 'PushModel'


# 设备通道配置
class UidChannelSetModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    uid = models.ForeignKey(UidSetModel, to_field='id', on_delete=models.CASCADE)
    channel = models.IntegerField(default=1, verbose_name='通道号')
    channel_name = models.CharField(blank=True, default='', max_length=32, verbose_name=u'通道名')
    pir_audio = models.SmallIntegerField(default=0, verbose_name='pir声音。0：关闭，1：开启')
    mic_audio = models.SmallIntegerField(default=0, verbose_name='mic声音。0：关闭，1：开启')
    battery_status = models.SmallIntegerField(default=0, verbose_name='低电量提醒状态。0：关闭，1：开启')
    battery_level = models.SmallIntegerField(default=0,
                                             verbose_name='低电量提醒级别。0: 低于10%；1：低于25%；2：低于50%；3：低于75%')
    sleep_status = models.SmallIntegerField(default=0, verbose_name='是否开启【休眠通知】。0：关闭；1：开启')
    sleep_time = models.SmallIntegerField(default=0, verbose_name='摄像机进入休眠时间。0：不休眠；1：10秒；2：20秒；3：30秒')
    light_night_model = models.IntegerField(default=0, verbose_name='夜视模式')  # 0：全彩模式，1：黑白模式，2：智能夜视模式
    light_alarm_type = models.IntegerField(default=0, verbose_name='警报人形类型')  # 0为人形，1为移动，3是人形和移动侦测0x0f
    # 声光报警级别: 0: 关闭，1：强烈声光告警，2：轻微声光告警，3: 强烈声告警，4:轻微声告警，5:强烈光告警
    light_alarm_level = models.IntegerField(default=0, verbose_name='声光报警级别')
    light_alarm_man_en = models.IntegerField(default=0, verbose_name='人为告警状态')  # 0：关，1：开
    light_alarm_vol = models.IntegerField(default=0, verbose_name='报警音量')  # 音量值0-100
    light_long_light = models.IntegerField(default=0, verbose_name='长亮')
    voice_prompt_status = models.SmallIntegerField(default=0, verbose_name='个性语音提示快关。0：关闭，1：开启')
    voice_prompt_enter = models.IntegerField(default=0, verbose_name='进入铃声id')
    voice_prompt_leave = models.IntegerField(default=0, verbose_name='离开铃声id')
    voice_prompt_intelligent_mute = models.SmallIntegerField(default=0, verbose_name='智能静音。0：关闭，1：开启')
    voice_start_x = models.FloatField(default=0, verbose_name='起始坐标的x')
    voice_start_y = models.FloatField(default=18, verbose_name='起始坐标的y')
    voice_end_x = models.FloatField(default=44, verbose_name='结束坐标的x')
    voice_end_y = models.FloatField(default=18, verbose_name='结束坐标的y')
    voice_start_time = models.IntegerField(default=0, verbose_name='语音执行的起始时间')
    voice_end_time = models.IntegerField(default=0, verbose_name='语音执行的结束时间')
    voice_repeat_day = models.IntegerField(default=127, verbose_name='语音执行的日期，周几')
    voice_direction = models.IntegerField(default=0, verbose_name='语音方向。')
    # 0：移动侦测，1：人形检测，2：挥手识别，3：人脸检测，4：异声感知，5：车辆检测，7：宠物检测，6：哭声检测，8：徘徊检测
    # 9：区域闯入，10：区域闯出，11：长时间无人检测，12：往来检测，13：云相册
    algorithm_type = models.SmallIntegerField(default=99, verbose_name='关联算法类型')

    class Meta:
        db_table = 'uid_channel'
        verbose_name = '设备通道设置'
        verbose_name_plural = verbose_name


# oauth2 第三方登录补全信息
class UserExModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)
    appBundleId = models.CharField(default='', max_length=32, verbose_name=u'appID')
    # {'cn': '简体中文', 'tc': '繁体中文', 'fr': '法文', 'ru': '俄文', 'es': '西班牙文',
    # 'pl': '波兰文', 'ja': '日文', 'de': '德文', 'en': '英文'}
    region = models.CharField(default='', max_length=16, verbose_name='区域语言')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'user_ex'
        verbose_name = '用户扩展信息表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


# oauth2 第三方登录补全信息
class UserOauth2Model(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)
    authType = models.SmallIntegerField(default=0, verbose_name=0)  # 授权类型 0 非授权，1 微信授权，2 苹果授权
    unionID = models.CharField(default='', max_length=64, verbose_name='唯一标记')  # 绑定唯一标记 unionID
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'user_oauth2'
        verbose_name = '用户oauth2关联'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class SysMassModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键自增id')
    sender = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)  # 发送人
    platform = models.CharField(default='', verbose_name='平台', max_length=16)
    lang = models.TextField(blank=True, default='', verbose_name=u'语种')
    recever = models.TextField(blank=True, default='', verbose_name=u'接受者')
    msg = models.TextField(blank=True, default='', verbose_name=u'发送内容')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='修改时间', default=0)

    class Meta:
        db_table = 'sys_mass'
        verbose_name = '群发消息记录表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class UidUserModel(models.Model):
    id = models.CharField(max_length=32, primary_key=True)
    userID = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE)
    NickName = models.CharField(max_length=32, verbose_name=u'设备名称')
    UID = models.CharField(max_length=32, verbose_name=u'设备UID', default='')
    View_Account = models.CharField(max_length=32, verbose_name=u'设备用户名称', default='')
    View_Password = models.CharField(max_length=32, verbose_name=u'设备密码', default='')
    ChannelIndex = models.IntegerField(verbose_name=u'通道号', default=0)
    Type = models.IntegerField(verbose_name='设备类型')
    NotificationMode = models.IntegerField(verbose_name=u'是否报警', default=0)
    isShare = models.BooleanField(verbose_name=u'共享设备', default=False)
    primaryUserID = models.CharField(verbose_name='主用户id', max_length=32, default='')
    primaryMaster = models.CharField(max_length=64, verbose_name=u'主用户名', default='')
    data_joined = models.DateTimeField(verbose_name=u'设备添加时间', auto_now_add=True)
    version = models.CharField(max_length=20, default='', verbose_name=u'版本号')
    isVod = models.SmallIntegerField(default=0, verbose_name='是否支持云存')  # 是否支持云存设备
    isExist = models.SmallIntegerField(default=1, verbose_name='是否被删除')  # 是否被删除了(需主用户交互) 1存在，0不存在
    is_ap = models.SmallIntegerField(default=1, verbose_name='是否为ap模式添加')  # 1为ap模式添加，0为非ap模式添加

    class Meta:
        db_table = 'uid_user'
        ordering = ('-data_joined',)
        verbose_name = u'用户设备ap表'
        verbose_name_plural = verbose_name


class pushDeployModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键自增id')
    name = models.CharField(max_length=32, default='', verbose_name=u'推送配置名称')
    key = models.CharField(max_length=32, default='', verbose_name=u'推送配置key')
    secret = models.CharField(max_length=32, default='', verbose_name=u'推送配置密钥')
    pem = models.CharField(max_length=32, default='', verbose_name=u'推送配置路径')
    type = models.CharField(max_length=32, default='', verbose_name=u'推送配置类型')  # ios 1,android 2
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='修改时间', default=0)

    class Meta:
        db_table = 'push_deploy'
        verbose_name = '推送配置表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class AppSetModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键自增id')
    appBundleId = models.CharField(max_length=64, default='', verbose_name=u'APPid')
    content = models.TextField(default='', verbose_name=u'里面包含评分，用户帮助，ap添加方式，ap工具，广告模块等json字段值')
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.IntegerField(verbose_name='修改时间', default=0)

    class Meta:
        db_table = 'app_set'
        verbose_name = 'app的各个版本控制表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


# 认证客户端类型表
class ApplicationModel(models.Model):
    CLIENT_TYPES = (
        ('confidential', 'confidential'),
        ('public', 'public'),
    )
    # authorization_code
    # 授权码模式(即先登录获取code, 再获取token)
    # password
    # 密码模式(将用户名, 密码传过去, 直接获取token)
    # client_credentials
    # 客户端模式(无用户, 用户向客户端注册, 然后客户端以自己的名义向’服务端’获取资源)
    # implicit
    # 简化模式(在redirect_uri
    # 的Hash传递token;
    # Auth客户端运行在浏览器中, 如JS, Flash)
    # refresh_token
    # 刷新access_token
    GRANT_TYPES = (
        ('authorization_code', "authorization_code"),
        ('password', "password"),
        ('client_credentials', "client_credentials"),
        ('implicit', "implicit"),
        ('refresh_token', "refresh_token"),
    )
    id = models.BigAutoField(primary_key=True)
    name = models.CharField(max_length=128, blank=True, verbose_name='client名字描述')
    client_id = models.CharField(max_length=50, unique=True, verbose_name='客户端id')
    client_secret = models.CharField(max_length=50, unique=True, verbose_name='客户端secret')
    client_type = models.CharField(max_length=32, choices=CLIENT_TYPES, verbose_name='客户端类型')
    grant_type = models.CharField(max_length=32, choices=GRANT_TYPES, blank=True, null=True)
    redirect_uri = models.TextField(blank=True, null=True, verbose_name='重定向url')
    skip_auth = models.BooleanField(default=False, verbose_name='是否跳过点击授权')
    add_time = models.IntegerField(verbose_name='添加时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        ordering = ('-add_time',)
        verbose_name = u'可授权客户端表'
        db_table = 'oauth_application'


# 授权码信息表
class GrantCodeModel(models.Model):
    id = models.BigAutoField(primary_key=True)
    userID = models.ForeignKey(Device_User, verbose_name="用户表userID", to_field='userID', on_delete=models.CASCADE)
    code = models.CharField(max_length=32, unique=True)
    app_id = models.CharField(max_length=100, default='', verbose_name="appBundleId")
    application = models.ForeignKey(ApplicationModel, verbose_name="用户表id", to_field='id', on_delete=models.CASCADE)
    expire_time = models.IntegerField(verbose_name='过期时间', default=0)
    add_time = models.IntegerField(verbose_name='添加时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    # 输出的永远是本地时间输出的永远是本地时间
    def is_expired(self):
        return timezone.now() >= self.expire_time

    class Meta:
        ordering = ('-add_time',)
        verbose_name = u'授权码表'
        db_table = 'oauth_grant_code'


class UserAppFrequencyModel(models.Model):
    id = models.AutoField(primary_key=True)
    user = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE, verbose_name='关联设备用户表')
    type = models.SmallIntegerField(default=0, verbose_name='使用频率类型')  # 1：每天，2：三天，3：一周，4：两周，5：一个月，6：一个月以上
    data_time = models.IntegerField(default=0, verbose_name='数据时间')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        verbose_name = '用户使用APP频率表'
        verbose_name_plural = verbose_name
        db_table = 'user_app_frequency'
        ordering = ('-add_time',)


class AppFrequencyStatisticsModel(models.Model):
    id = models.AutoField(primary_key=True)
    data = models.TextField(default='', verbose_name='统计好的数据')
    month = models.IntegerField(default=0, verbose_name='月份')
    year = models.IntegerField(default=0, verbose_name='年份')

    class Meta:
        verbose_name = 'app月使用频率统计表'
        verbose_name_plural = verbose_name
        db_table = 'app_frequency_statistics'


class AppFrequencyYearStatisticsModel(models.Model):
    id = models.AutoField(primary_key=True)
    data = models.TextField(default='', verbose_name='统计好的数据')
    year = models.IntegerField(default=0, verbose_name='年份')
    num = models.IntegerField(default=0, verbose_name='总人数')

    class Meta:
        verbose_name = 'app使用频率统计表，年度统计'
        verbose_name_plural = verbose_name
        db_table = 'app_frequency_year_statistics'


# alexa连接数统计表
class AlexaConnectStatisticsModel(models.Model):
    id = models.AutoField(primary_key=True)
    num = models.IntegerField(default=0, verbose_name='总人数')
    data_time = models.IntegerField(default=0, verbose_name='数据时间')

    class Meta:
        verbose_name = 'alexa连接数统计表'
        verbose_name_plural = verbose_name
        db_table = 'alexa_statistics'


class FAQModel(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=64, default='', unique=True, verbose_name='标题')
    content = models.TextField(default='', verbose_name='内容')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_faq'
        verbose_name = '问题帮助表'
        verbose_name_plural = verbose_name


class AppLogModel(models.Model):
    id = models.AutoField(primary_key=True)
    user = models.ForeignKey(Device_User, to_field='userID', on_delete=models.CASCADE, verbose_name='关联设备用户表')
    uid = models.CharField(max_length=20, default='', verbose_name='设备uid')
    average_delay = models.CharField(max_length=32, default='', verbose_name='最高平均延时')
    status = models.SmallIntegerField(default=0, verbose_name='失败状态')  # 0: 成功,1: 失败
    filename = models.CharField(max_length=120, default='', verbose_name='文件名')
    add_time = models.IntegerField(default=0, verbose_name='日期')

    class Meta:
        db_table = 'app_log'
        verbose_name = 'APP日志表'
        verbose_name_plural = verbose_name


class DeviceLogModel(models.Model):
    id = models.AutoField(primary_key=True)
    ip = models.CharField(default='', max_length=32, verbose_name='ip')
    uid = models.CharField(max_length=32, default='', verbose_name='设备uid', db_index=True)
    serial_number = models.CharField(max_length=9, default='', verbose_name='序列号', db_index=True)
    status = models.SmallIntegerField(default=0, verbose_name='上传状态')  # 0: 成功,1: 失败, 3非文件形式，与error_info相关
    filename = models.CharField(max_length=120, default='', verbose_name='文件名')
    error_info = models.TextField(blank=True, default='', verbose_name='设备异常信息')
    add_time = models.DateTimeField(blank=True, auto_now_add=True, verbose_name=u'添加时间')

    class Meta:
        db_table = 'device_log'
        verbose_name = '设备日志表'
        verbose_name_plural = verbose_name


class EquipmentInfoExStatisticsModel(models.Model):
    id = models.AutoField(primary_key=True)
    push_type = models.SmallIntegerField(default=0,
                                         verbose_name='第三方推送服务器标志。0：APNS推送，1：谷歌推送，2：极光推送')
    number_of_successes = models.IntegerField(default=0, verbose_name='推送成功数量')
    number_of_failures = models.IntegerField(default=0, verbose_name='推送失败数量')
    number_of_arrival = models.IntegerField(default=0, verbose_name='推送到达数量')
    statistics_date = models.IntegerField(default=0, verbose_name='属于哪天、哪月的统计')
    date_type = models.SmallIntegerField(default=0, verbose_name='统计日期的类型。0：天，1：月')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')

    class Meta:
        db_table = 'equipment_info_ex_statistics'
        verbose_name = '推送消息统计表'
        verbose_name_plural = verbose_name


class CountryIPModel(models.Model):
    id = models.AutoField(primary_key=True)
    ip = models.CharField(default='', max_length=32, verbose_name='ip')
    user_ex = models.ForeignKey(UserExModel, to_field='id', on_delete=models.CASCADE,
                                verbose_name='关联用户扩展信息表id')
    country = models.CharField(default='', max_length=100, verbose_name='国家')
    status = models.SmallIntegerField(default=0, verbose_name='是否已经查找，0：否，1：是')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')

    class Meta:
        db_table = 'country_ip'
        verbose_name = 'ip-国家统计表'
        verbose_name_plural = verbose_name


class ZositechHelpModel(models.Model):
    id = models.AutoField(primary_key=True)
    locale = models.CharField(default='', db_index=True, max_length=50, verbose_name='语言')
    label_names = models.CharField(default='', db_index=True, max_length=50, verbose_name='标签')
    origin = models.CharField(default='', db_index=True, max_length=50, verbose_name='来源')
    # author_id = models.CharField(default='', max_length=50, verbose_name='管理员id')
    # body = models.TextField(default='', blank=True, verbose_name='内容')
    # comments_disabled = models.CharField(default='', max_length=10, verbose_name='comments')
    # created_at = models.CharField(default='', max_length=50, verbose_name='创建时间')
    # draft = models.CharField(default='', max_length=10, verbose_name='草稿')
    # edited_at = models.CharField(default='',max_length=50, verbose_name='修改时间')
    # html_url = models.CharField(default='', blank=True, verbose_name='跳转路径')
    # body = models.CharField(default='', blank=True, verbose_name='标签')
    # body = models.CharField(default='', blank=True, verbose_name='标签')
    # body = models.TextField(default='', blank=True, verbose_name='标签')
    # body = models.TextField(default='', blank=True, verbose_name='标签')
    # body = models.CharField(default='', blank=True, verbose_name='标签')
    # body = models.CharField(default='', blank=True, verbose_name='标签')

    content = models.TextField(blank=True, default='', verbose_name=u'内容')

    class Meta:
        db_table = 'zositech_help'
        verbose_name = '周视使用帮助表'
        verbose_name_plural = verbose_name


class EquipmentVersionLimitModel(models.Model):
    id = models.AutoField(primary_key=True)
    type = models.SmallIntegerField(default=0, verbose_name='限制类型')
    content = models.TextField(default='', verbose_name='限制内容')
    equipment_version = models.ForeignKey(Equipment_Version, to_field='eid', on_delete=models.CASCADE,
                                          verbose_name='关联设备版本信息id')
    status = models.SmallIntegerField(default=0, verbose_name='是否启用。0：不启用，1：启用')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'equipment_version_limit'
        verbose_name = '设备版本信息限制表'
        verbose_name_plural = verbose_name


class ExperienceContextModel(models.Model):
    id = models.AutoField(primary_key=True)
    experience_type = models.SmallIntegerField(default=0, verbose_name='体验类型')  # 0: 免费体验套餐， 1： 激活码
    uid = models.CharField(max_length=20, default='', verbose_name='设备uid')
    do_time = models.IntegerField(default=0, verbose_name='激活时间')

    # is_experience = models.SmallIntegerField(default=0, verbose_name=u'是否云存体验用户')  # 0：不是体验用户，1：是体验用户

    class Meta:
        db_table = 'experience_context'
        verbose_name = '设备体验表'
        verbose_name_plural = verbose_name


class ExperienceAiModel(models.Model):
    id = models.AutoField(primary_key=True)
    experience_type = models.SmallIntegerField(default=0, verbose_name='体验类型')  # 0: 免费体验, 1: 激活码
    uid = models.CharField(max_length=20, default='', verbose_name='设备uid')
    do_time = models.IntegerField(default=0, verbose_name='激活时间')

    class Meta:
        db_table = 'experience_ai'
        verbose_name = 'ai体验表'
        verbose_name_plural = verbose_name


class CDKcontextModel(models.Model):
    id = models.AutoField(primary_key=True)
    cdk = models.CharField(max_length=50, unique=True, verbose_name='激活码')
    create_time = models.IntegerField(default=0, verbose_name='创建时间')
    valid_time = models.IntegerField(default=0, verbose_name='有效期间')  # 超过有效期激活码不可在激活 ,0：永久
    is_activate = models.SmallIntegerField(default=0, verbose_name='是否已激活')  # 0 未激活  1 已激活
    is_down = models.SmallIntegerField(default=0, verbose_name='是否已下载')  # 0 未下载 1 已下载
    rank = models.ForeignKey(Store_Meal, to_field='id', default='', on_delete=models.CASCADE, verbose_name='套餐类型')
    order = models.CharField(max_length=20, blank=True, unique=True, verbose_name='订单id')
    express_id = models.CharField(blank=True, max_length=128, verbose_name='速卖通订单id')

    # 备用字段
    spare_1 = models.CharField(default='', blank=True, max_length=64, verbose_name=u'备用字段1')
    spare_2 = models.CharField(default='', blank=True, max_length=64, verbose_name=u'备用字段2')
    spare_3 = models.CharField(default='', blank=True, max_length=64, db_index=True, verbose_name=u'备用字段3')

    class Meta:
        db_table = 'cdk_context'
        verbose_name = '激活码表'
        verbose_name_plural = verbose_name


class VoicePromptModel(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=128, default='', verbose_name='语音标题')
    type = models.SmallIntegerField(default=0, verbose_name='语音类型。0：进入语音，1：离开语音')
    filename = models.CharField(max_length=120, default='', verbose_name='文件名')
    language = models.CharField(max_length=16, default='', verbose_name='语言类型')
    classification = models.SmallIntegerField(default=1, verbose_name='语音分类。0：系统，1：自定义')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    uid = models.CharField(max_length=20, default='0', verbose_name='关联设备UID')
    # 0：移动侦测，1：人形检测，2：挥手识别，3：人脸检测，4：异声感知，5：车辆检测，7：宠物检测，6：哭声检测，8：徘徊检测
    # 9：区域闯入，10：区域闯出，11：长时间无人检测，12：往来检测，13：云相册
    algorithm_type = models.SmallIntegerField(default=99, verbose_name='关联算法类型')
    channel = models.IntegerField(default=0, verbose_name='通道号')
    status = models.SmallIntegerField(default=1, verbose_name='是否启用。0：不启用，1：启用')
    device_types = models.JSONField(default=list, verbose_name='设备类型列表（整数数组）')

    class Meta:
        db_table = 'voice_prompt'
        verbose_name = '语音提示表'
        verbose_name_plural = verbose_name


class DeviceTypeModel(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64, default='', verbose_name='设备名称')
    model = models.SmallIntegerField(default=0, verbose_name='设备大类。1：dvr，2：ipc')
    type = models.IntegerField(default=0, verbose_name='设备类型')
    ptz_type = models.IntegerField(default=0, verbose_name='ptz类型。1：dvr球机，2：IPCPTZ，3：同轴菜单')
    icon = models.CharField(max_length=120, default='', verbose_name='文件名')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_type'
        verbose_name = '设备类型表'
        verbose_name_plural = verbose_name


class AppBundle(models.Model):
    id = models.AutoField(primary_key=True)
    app_bundle_id = models.CharField(default='', max_length=32, verbose_name='app版本id')
    app_device_type = models.ManyToManyField(to='AppDeviceType', db_table='app_bundle_device_type',
                                             verbose_name='APP版本-设备类型')

    class Meta:
        db_table = 'app_bundle'
        verbose_name = 'APP版本表'
        verbose_name_plural = verbose_name


class AppVersionNumber(models.Model):
    id = models.AutoField(primary_key=True)
    app_bundle = models.ForeignKey(AppBundle, to_field='id', default='', on_delete=models.DO_NOTHING,
                                   verbose_name='关联APP版本表')
    version_number = models.CharField(max_length=32, verbose_name='版本号', default='')

    class Meta:
        db_table = 'app_version_number'
        verbose_name = 'APP版本号表'
        verbose_name_plural = verbose_name


class AppDeviceType(models.Model):
    id = models.AutoField(primary_key=True)
    # 1:DVR, 2：IPC
    model = models.SmallIntegerField(default=0, verbose_name='设备类型')
    type = models.IntegerField(default=0, verbose_name='设备型号')
    icon = models.CharField(default='', max_length=200, verbose_name='图标文件路径')
    iconV2 = models.CharField(default='', max_length=200, verbose_name='新版APP图标文件路径')
    config = models.JSONField(null=True, verbose_name='关联配网方式、网络频段配置json')
    app_version_number_id = models.CharField(default='', max_length=32, verbose_name='关联APP版本号表id')

    class Meta:
        db_table = 'app_device_type'
        verbose_name = 'APP设备类型表'
        verbose_name_plural = verbose_name


class DeviceNameLanguage(models.Model):
    id = models.AutoField(primary_key=True)
    app_device_type = models.ForeignKey(AppDeviceType, to_field='id', default='', on_delete=models.CASCADE,
                                        verbose_name='关联APP设备类型表id')
    lang = models.CharField(default='', max_length=10, verbose_name='语言')
    name = models.CharField(default='', max_length=32, verbose_name='设备名称')
    sort = models.SmallIntegerField(default=0, verbose_name=u'升序排序')

    class Meta:
        ordering = ('sort',)
        db_table = 'device_name_language'
        verbose_name = '设备名称语言表'
        verbose_name_plural = verbose_name


class OperatingLogsModel(models.Model):
    id = models.AutoField(primary_key=True)
    userId = models.CharField(blank=False, max_length=32, db_index=True, verbose_name=u'操作人')
    operatingtime = models.DateTimeField(blank=True, verbose_name=u'操作时间', auto_now=True)
    operatingcontent = models.TextField(blank=True, default='', verbose_name=u'操作内容')
    operatingtype = models.CharField(blank=True, verbose_name=u'操作类型', max_length=32)
    is_saveprocessinfo = models.SmallIntegerField(default=1, verbose_name=u'是否保存过程信息。1：保存，2：不保存')
    devUid = models.CharField(default='', blank=True, max_length=32, verbose_name=u'设备ID')
    userIp = models.CharField(blank=True, max_length=20, default='', verbose_name=u'用户ip')

    class Meta:
        db_table = 'operating_logs'
        verbose_name = '操作数据表'
        verbose_name_plural = verbose_name


class ProcessInfoLogsModel(models.Model):
    id = models.AutoField(primary_key=True)
    userId = models.CharField(blank=False, max_length=32, db_index=True, verbose_name=u'操作人')
    devUid = models.CharField(default='', blank=True, max_length=32, verbose_name=u'设备ID')
    operatingcontent = models.TextField(blank=True, default='', verbose_name=u'操作内容')
    operatingtime = models.DateTimeField(blank=True, verbose_name=u'操作时间', auto_now=True)

    class Meta:
        db_table = 'processinfo_logs'
        verbose_name = '过程信息表'
        verbose_name_plural = verbose_name


class UserModel(models.Model):
    id = models.AutoField(primary_key=True)
    username = models.CharField(unique=True, max_length=128, null=False, verbose_name='用户名')
    password = models.CharField(max_length=128, null=False, verbose_name='密码')
    permission = models.CharField(max_length=24, null=False, verbose_name='权限')
    login_time = models.IntegerField(blank=True, default=0, verbose_name='登录时间')
    online = models.SmallIntegerField(default=0, verbose_name='是否在线')
    phone = models.CharField(max_length=11, default='', verbose_name='手机号')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')

    class Meta:
        verbose_name = '用户表'
        verbose_name_plural = verbose_name
        db_table = 'user'


class CompanyModel(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=64, unique=True, default='', verbose_name='企业名称')
    mark = models.CharField(max_length=3, unique=True, default='', verbose_name='企业标志，用于序列号的后三位')
    secret = models.CharField(max_length=10, db_index=True, default='', verbose_name='企业秘钥')
    quantity = models.IntegerField(default=0, verbose_name='已购买的序列号的数量')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_company'
        verbose_name = '企业表'
        verbose_name_plural = verbose_name


class RegionModel(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32, default='', verbose_name='区域名称')
    continent_code = models.CharField(max_length=3, default='', verbose_name='洲代码')
    api = models.CharField(max_length=50, default='', verbose_name='域名')
    zosi_api = models.CharField(max_length=50, default='', verbose_name='周视域名')
    loocam_api = models.CharField(max_length=50, default='', verbose_name='录看域名')
    neutral_api = models.CharField(max_length=50, default='', verbose_name='中性域名')
    push_api = models.CharField(max_length=50, default='', verbose_name='推送域名')

    class Meta:
        db_table = 'tb_region'
        verbose_name = '区域表'
        verbose_name_plural = verbose_name


class VPGModel(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32, default='', verbose_name='群组名称')
    uid_count = models.IntegerField(default=0, verbose_name='uid数量')
    region = models.ForeignKey(RegionModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='群组用于的地区')
    company = models.ForeignKey(CompanyModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='关联企业表')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_vpg'
        verbose_name = 'vpg表'
        verbose_name_plural = verbose_name


class UIDModel(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.CharField(max_length=20, null=False, db_index=True, unique=True, verbose_name='设备id')
    mac = models.CharField(max_length=17, null=True, default='', verbose_name='设备id对应的mac地址')
    uid_extra = models.TextField(default='', verbose_name='uid的额外描述')
    status = models.SmallIntegerField(default=0, verbose_name='使用状态')  # 0:未使用, 2:已使用, 3:数据被同步
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')
    area = models.SmallIntegerField(default=0, verbose_name='区域')  # 0:国内, 1:国外
    vpg = models.ForeignKey(VPGModel, to_field='id', default=1, on_delete=models.DO_NOTHING,
                            verbose_name='关联VPG表的id')
    p2p_type = models.IntegerField(default=1, verbose_name='p2p类型。1：宸云，2：tutk')
    full_uid_code = models.CharField(max_length=256, default='', verbose_name='宸云完整uid')
    platform = models.CharField(max_length=10, default='', verbose_name='平台')
    init_string = models.CharField(max_length=256, default='', verbose_name='尚云设备初始化字符')
    init_string_app = models.CharField(max_length=256, default='', verbose_name='尚云设备app初始化字符')

    class Meta:
        ordering = ('-add_time',)
        verbose_name = 'uid表'
        verbose_name_plural = verbose_name
        db_table = 'uid'


class UserUIDModel(models.Model):
    id = models.AutoField(primary_key=True)
    user = models.ForeignKey(UserModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联用户表id')
    uid = models.ForeignKey(UIDModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联uid表id')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        verbose_name = '用户与UID的关联表'
        verbose_name_plural = verbose_name
        db_table = 'user_uid'


class PermissionModel(models.Model):
    id = models.AutoField(primary_key=True)
    type = models.SmallIntegerField(null=False, verbose_name='权限枚举')
    description = models.TextField(default='', verbose_name='权限描述')

    class Meta:
        verbose_name = '权限表'
        verbose_name_plural = verbose_name
        db_table = 'permission'


class LogModel(models.Model):
    id = models.AutoField(primary_key=True)
    operation = models.TextField(default='', verbose_name='操作描述')
    time = models.IntegerField(default=0, verbose_name='操作时间')
    ip = models.CharField(default='', max_length=24, verbose_name='用户ip')
    user = models.ForeignKey(UserModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联用户id')
    content = models.TextField(default='', verbose_name='请求参数')
    status = models.IntegerField(default=0, verbose_name='请求状态')
    url = models.CharField(max_length=150, default='', verbose_name='请求路径')

    class Meta:
        ordering = ('-time',)
        verbose_name = '日志表'
        verbose_name_plural = verbose_name
        db_table = 'log'


class HistoryUIDModel(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.CharField(max_length=20, null=False, db_index=True, verbose_name='设备id')
    uid_extra = models.TextField(default='', verbose_name='uid的额外描述')
    status = models.SmallIntegerField(default=0, verbose_name='使用状态')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')
    area = models.SmallIntegerField(default=0, verbose_name='区域')  # 0：国内；1：国外

    class Meta:
        verbose_name = '历史UID表'
        verbose_name_plural = verbose_name
        db_table = 'history_uid'


class MacModel(models.Model):
    id = models.AutoField(primary_key=True)
    value = models.CharField(max_length=17, null=False, verbose_name='最新的mac地址')
    is_active = models.BooleanField(default=True, verbose_name='当前mac地址是否可用')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        verbose_name = '最新的mac地址表'
        verbose_name_plural = verbose_name
        db_table = 'tb_mac'


class OrderTaskModel(models.Model):
    id = models.AutoField(primary_key=True)
    order_number = models.CharField(max_length=32, verbose_name='订单号')
    board = models.CharField(max_length=32, verbose_name='主板')
    plan = models.CharField(max_length=32, verbose_name='配置方案')
    checksum = models.CharField(max_length=32, verbose_name='校验和')
    ic_model = models.CharField(max_length=32, verbose_name='ic型号')
    quantity = models.IntegerField(default=0, verbose_name='通知单上的生成数量')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')

    class Meta:
        db_table = 'order_task'
        verbose_name = '订单任务表'
        verbose_name_plural = verbose_name


class CountryModel(models.Model):
    id = models.AutoField(primary_key=True)
    number = models.IntegerField(unique=True, verbose_name='区号')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')
    region = models.ForeignKey(RegionModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='关联区域表')
    country_code = models.CharField(max_length=2, default='', verbose_name='国家iso2代码')
    country_name = models.CharField(max_length=20, default='', verbose_name='国家名')
    international_area_code = models.IntegerField(default=0, verbose_name='国际区号')
    DST = models.SmallIntegerField(default=0, verbose_name='夏令时')

    class Meta:
        db_table = 'tb_country'
        verbose_name = '地区表'
        verbose_name_plural = verbose_name


class LanguageModel(models.Model):
    id = models.AutoField(primary_key=True)
    lang = models.CharField(max_length=16, default='', verbose_name='语种')
    lang_youdao = models.CharField(max_length=16, default='', verbose_name='有道的语种')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_language'
        verbose_name = '语言表'
        verbose_name_plural = verbose_name


class CountryLanguageModel(models.Model):
    id = models.AutoField(primary_key=True)
    country_name = models.CharField(max_length=64, default='', verbose_name='国家名称')
    language = models.ForeignKey(LanguageModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联语言表的id')
    country = models.ForeignKey(CountryModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联地区表的id')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_country_language'
        verbose_name = '不同语言的地区名称表'
        verbose_name_plural = verbose_name


class SerialNumberModel(models.Model):
    id = models.AutoField(primary_key=True)
    serial_number = models.CharField(max_length=9, db_index=True, unique=True, verbose_name='序列号')
    status = models.SmallIntegerField(default=1, verbose_name='可用状态。0：不可用，1：可用')
    use_status = models.SmallIntegerField(default=0, db_index=True, verbose_name='使用状态, 0: 未使用, 1: 已分配')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')

    class Meta:
        db_table = 'tb_serial_number'
        verbose_name = '序列号表'
        verbose_name_plural = verbose_name


class CompanySerialModel(models.Model):
    id = models.AutoField(primary_key=True)
    company = models.ForeignKey(CompanyModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联企业表的id')
    serial_number = models.CharField(max_length=11, db_index=True, blank=True, default='', verbose_name=u'6位数序列号')
    status = models.SmallIntegerField(default=0, verbose_name='使用状态, 0:未使用,1:已分配,2:绑定uid,3:已占用')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_company_serial'
        verbose_name = '企业关联序列号表'
        verbose_name_plural = verbose_name


class UIDCompanySerialModel(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.ForeignKey(UIDModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联UID表')
    company_serial = models.ForeignKey(CompanySerialModel, to_field='id', on_delete=models.CASCADE,
                                       verbose_name='6位数序列号')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_uid_company_serial'
        verbose_name = 'UID关联【企业关联序列号】表'
        verbose_name_plural = verbose_name


class iotdeviceInfoModel(models.Model):
    id = models.AutoField(primary_key=True)
    serial_number = models.CharField(default='', max_length=9, db_index=True, verbose_name='序列号')
    uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='uid')
    certificate_id = models.CharField(default='', max_length=128, verbose_name='证书id')
    certificate_pem = models.TextField(default='', verbose_name='证书')
    public_key = models.TextField(default='', verbose_name='公钥')
    private_key = models.TextField(default='', verbose_name='私钥')
    thing_name = models.CharField(default='', max_length=64, db_index=True, verbose_name='物品名')
    thing_groups = models.CharField(default='', max_length=64, verbose_name='物品组')
    endpoint = models.CharField(default='', max_length=100, db_index=True, verbose_name='终端节点')
    token_iot_number = models.CharField(default='', db_index=True, max_length=50, verbose_name='签名令牌')
    add_time = models.DateTimeField(auto_now_add=True, verbose_name='添加时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'iot_deviceInfo'
        verbose_name = 'iot设备信息表'
        verbose_name_plural = verbose_name


class UIDMainUser(models.Model):
    id = models.AutoField(primary_key=True)
    UID = models.CharField(blank=True, max_length=32, verbose_name=u'设备UID', default='')
    user_id = models.CharField(blank=True, max_length=32, verbose_name=u'用户ID', default='')

    class Meta:
        db_table = 'uid_mainuser'
        verbose_name = '设备主用户表'
        verbose_name_plural = verbose_name


class Pc_Info(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    pc_name = models.CharField(blank=True, max_length=32, verbose_name=u'软件名称')
    bundle_version = models.IntegerField(default=0, verbose_name=u'项目类型。0：Zosi;149：COCOON HD; 150:Loocam; 151:中性')
    pc_version = models.CharField(blank=True, max_length=12, verbose_name=u'版本号')
    pc_test = models.SmallIntegerField(default=0, verbose_name='测试版。0：否，1：是')
    lang = models.CharField(blank=True, max_length=32, verbose_name=u'语言类型')
    download_link = models.CharField(max_length=300, blank=True, default='', verbose_name='下载链接')
    add_time = models.IntegerField(verbose_name='添加时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)
    file_type = models.CharField(blank=True, max_length=32, verbose_name=u'文件类型')
    package = models.CharField(blank=True, max_length=32, verbose_name=u'整合包id')
    explain = models.TextField(blank=True, default='', verbose_name=u'更新内容')
    is_update = models.SmallIntegerField(blank=True, default=0, verbose_name='强制更新。0：否，1：是')
    is_open = models.SmallIntegerField(blank=True, default=0, verbose_name='是否开启版本。0：否，1：是')
    content = models.TextField(blank=True, default='', verbose_name=u'内容信息')
    authority = models.SmallIntegerField(blank=True, default=0, verbose_name='权限')

    class Meta:
        db_table = 'pc_info'
        verbose_name = u'pc信息表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class CloudLogModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.CharField(max_length=100, default='', db_index=True, blank=True, verbose_name=u'用户')
    uid = models.CharField(blank=True, max_length=32, db_index=True, verbose_name=u'uid', default='')
    operation = models.CharField(max_length=100, db_index=True, default='', blank=True, verbose_name=u'操作')
    ip = models.CharField(max_length=100, default='', db_index=True, blank=True, verbose_name=u'访问ip地址')
    url = models.CharField(max_length=150, default='', blank=True, verbose_name=u'访问路径')
    time = models.IntegerField(null=True, blank=True, db_index=True, verbose_name=u'访问时间')
    content = models.TextField(blank=True, default='', verbose_name=u'参数内容')

    class Meta:
        db_table = 'cloud_log'
        verbose_name = '云存api记录表'
        verbose_name_plural = verbose_name


class VideoPlaybackTimeModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    userID = models.CharField(max_length=100, default='', db_index=True, blank=True, verbose_name=u'用户ID')
    uid = models.CharField(max_length=32, default='', db_index=True, verbose_name=u'uid')
    playMode = models.CharField(max_length=10, default='', verbose_name=u'播放模式')
    startTime = models.IntegerField(default=0, verbose_name=u'开始播放时间')
    duration = models.SmallIntegerField(default=0, verbose_name='播放时长')

    class Meta:
        db_table = 'video_playback_time'
        verbose_name = '视频播放时长表'
        verbose_name_plural = verbose_name


class PctestjobModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    jobname = models.CharField(blank=True, max_length=32, verbose_name=u'岗位名字')
    jobcode = models.SmallIntegerField(default=3, verbose_name='岗位code 。1：管理员，3：普通人员')

    class Meta:
        db_table = 'pctest_job'
        verbose_name = u'pc岗位表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PctestdeviceModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    devicename = models.CharField(blank=True, max_length=32, verbose_name=u'设备名字')

    class Meta:
        db_table = 'pctest_device'
        verbose_name = u'pc测试设备表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class OrderUIDModel(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.ForeignKey(UIDModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联uid表')
    order = models.ForeignKey(OrderTaskModel, to_field='id', on_delete=models.CASCADE, verbose_name='关联订单任务表')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'order_uid'
        verbose_name = '订单与uid关联表'
        verbose_name_plural = verbose_name


class PctestfunctionModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    functionname = models.CharField(blank=True, max_length=32, verbose_name=u'职能名字')
    functioncode = models.SmallIntegerField(default=1, verbose_name='职能code 。PC端自己逻辑判断')

    class Meta:
        db_table = 'pctest_function'
        verbose_name = u'pc设备职能表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PctestuserModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    username = models.CharField(blank=True, max_length=32, verbose_name=u'用户名字')
    password = models.CharField(blank=True, max_length=32, verbose_name=u'用户名字')
    job = models.ForeignKey(PctestjobModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='关联pc岗位表')

    class Meta:
        db_table = 'pctest_user'
        verbose_name = u'pc角色岗位表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PctestlogModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(PctestuserModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='关联pc岗位表')
    content = models.TextField(blank=True, default='', verbose_name=u'测试日志')
    addtime = models.IntegerField(verbose_name='添加时间', default=0)

    class Meta:
        db_table = 'pctest_log'
        verbose_name = u'pc测试日志表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PctestjobdeviceModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    job = models.ForeignKey(PctestjobModel, to_field='id', on_delete=models.DO_NOTHING, verbose_name='关联pc岗位表')
    device = models.ForeignKey(PctestdeviceModel, to_field='id', on_delete=models.DO_NOTHING,
                               verbose_name='关联pc测试设备表')

    class Meta:
        db_table = 'pctest_job_device'
        verbose_name = u'pc岗位设备关联表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PctestModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    device = models.ForeignKey(PctestdeviceModel, to_field='id', on_delete=models.DO_NOTHING,
                               verbose_name='关联pc测试设备表')
    function = models.ForeignKey(PctestfunctionModel, to_field='id', on_delete=models.DO_NOTHING,
                                 verbose_name='关联pc设备职能表')

    class Meta:
        db_table = 'pctest_device_function'
        verbose_name = u'pc岗位设备关联表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class P2PIpModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, default='', unique=True, db_index=True, verbose_name='设备uid')
    ip = models.CharField(default='', max_length=32, verbose_name='ip')
    p2p_request_times = models.IntegerField(default=0, verbose_name='p2p请求次数')
    relay_request_times = models.IntegerField(default=0, verbose_name='relay请求次数')
    continent_name = models.CharField(default='', max_length=10, verbose_name='大洲')
    country_name = models.CharField(default='', max_length=100, verbose_name='国家')
    region_name = models.CharField(default='', max_length=100, verbose_name='地区')
    city_name = models.CharField(default='', max_length=100, verbose_name='城市')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'p2p_ip'
        verbose_name = u'设备p2p_ip地区表'
        verbose_name_plural = verbose_name


class DeviceDomainModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    ip = models.CharField(default='', db_index=True, max_length=32, verbose_name='ip')
    country_name = models.CharField(max_length=20, default='', verbose_name='国家名')
    api = models.CharField(max_length=50, default='', verbose_name='使用的域名')
    add_time = models.DateTimeField(blank=True, auto_now_add=True, verbose_name=u'添加时间')
    update_time = models.DateTimeField(blank=True, auto_now=True, verbose_name=u'更新时间')

    class Meta:
        db_table = 'device_domain'
        verbose_name = u'设备域名表'
        verbose_name_plural = verbose_name


class DeviceDomainRegionModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    serial_number = models.CharField(default='', max_length=9, db_index=True, verbose_name='序列号')
    ip = models.CharField(default='', max_length=32, verbose_name='ip')
    country_code = models.CharField(default='', max_length=8, verbose_name='国家编码')
    region_id = models.SmallIntegerField(default=0, verbose_name='对应tb_region表id')
    add_time = models.DateTimeField(blank=True, auto_now_add=True, verbose_name='添加时间')
    update_time = models.DateTimeField(blank=True, auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'device_domain_region'
        verbose_name = '设备域名地区表'
        verbose_name_plural = verbose_name


class AppScannedSerial(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    serial = models.CharField(default='', max_length=9, db_index=True, verbose_name='序列号')
    region_country = models.IntegerField(default=0, verbose_name='关联tb_country表id')
    ip = models.CharField(default='', max_length=32, verbose_name='ip')
    add_time = models.IntegerField(default=0, verbose_name='添加时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'app_scanned_serial'
        verbose_name = 'app扫描序列号表'
        verbose_name_plural = verbose_name


class RequestRecordModel(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增ID')
    method = models.CharField(max_length=10, default='', verbose_name='请求类型')
    url = models.CharField(max_length=200, default='', verbose_name='请求路径')
    parameter = models.CharField(max_length=200, default='', verbose_name='请求参数')
    execute_time = models.FloatField(default=0, verbose_name='执行时间')
    status_code = models.CharField(max_length=10, default='', verbose_name='响应状态码')
    reason_phrase = models.CharField(max_length=200, default='', verbose_name='错误信息')
    add_time = models.DateTimeField(blank=True, auto_now_add=True, verbose_name=u'添加时间')

    class Meta:
        db_table = 'request_record'
        verbose_name = u'请求记录表'
        verbose_name_plural = verbose_name
        ordering = ('-add_time',)


class AiService(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    orders = models.ForeignKey(Order_Model, to_field='orderID', default='', on_delete=models.CASCADE,
                               verbose_name='关联订单表')
    detect_status = models.SmallIntegerField(default=0, verbose_name='状态')  # 0:关闭, 1:开启
    endTime = models.BigIntegerField(verbose_name='套餐结束时间', db_index=True, default=0)
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updTime = models.BigIntegerField(verbose_name='更新时间', default=0)
    use_status = models.IntegerField(verbose_name='使用状态', default=0)  # 0:未使用, 1:使用中, 2:已过期
    # 1:人, 2:动物, 3:车, 4:包裹
    detect_group = models.CharField(blank=True, default='1', max_length=100, verbose_name='侦测类型')
    detect_interval = models.IntegerField(verbose_name='推送间隔', default=60)  # 秒

    class Meta:
        db_table = 'ai_service'
        verbose_name = 'ai设备服务表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class AiProcessTime(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    msg_id = models.CharField(max_length=50, verbose_name='消息id', default=0)
    detectTime = models.BigIntegerField(verbose_name='设备侦测时间', default=0)
    receiveTime = models.BigIntegerField(verbose_name='接口调用时间', default=0)
    aiTime = models.BigIntegerField(verbose_name='ai识别上传开始时间', default=0)
    aiEndTime = models.BigIntegerField(verbose_name='ai识别结束时间', default=0)
    pushTime = models.BigIntegerField(verbose_name='推送开始时间', default=0)
    pushEndTime = models.BigIntegerField(verbose_name='推送结束时间', default=0)
    picUploadTime = models.BigIntegerField(verbose_name='图片上传开始时间', default=0)
    picUploadEndTime = models.BigIntegerField(verbose_name='图片上传结束结束时间', default=0)
    serverCountTime = models.BigIntegerField(verbose_name='服务器总花时间', default=0)
    appPushTime = models.IntegerField(verbose_name='添加时间', default=0)
    endTime = models.IntegerField(verbose_name='接口结束时间', default=0)

    class Meta:
        db_table = 'ai_process_time'
        verbose_name = 'ai设备服务表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class Surveys(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    no = models.CharField(max_length=10, unique=True, verbose_name='编号', default=0)
    user_type = models.SmallIntegerField(default=0, verbose_name='调查用户对象[1:云存储用户,2:AI用户,3：所有APP用户]')
    start_time = models.IntegerField(default=0, verbose_name='开始显示时间')
    end_time = models.IntegerField(default=0, verbose_name='显示结束时间')
    is_show = models.SmallIntegerField(default=0, verbose_name='是否显示[0:隐藏,1:显示]')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'surveys'
        verbose_name = '问卷调查—问卷调查表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class SurveysUserLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表ID')
    type = models.SmallIntegerField(default=0, verbose_name='调查用户对象[1:云存储用户,2:AI用户,3：所有APP用户]')
    is_filled = models.SmallIntegerField(default=0, verbose_name='是否填写[0:未填,1:已填]')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'surveys_user_log'
        verbose_name = '问卷调查—用户记录'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class SurveysTitle(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    surveys = models.ForeignKey(Surveys, to_field='id', default='', on_delete=models.CASCADE,
                                verbose_name='关联问卷表ID')
    title_content = models.TextField(blank=True, verbose_name='题目内容', default=0)
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'surveys_title'
        verbose_name = '问卷调查—题目表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class CloudVodSurveysAnswer(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    title = models.ForeignKey(SurveysTitle, to_field='id', default='', on_delete=models.CASCADE,
                              verbose_name='关联题目表ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表ID')
    answer1 = models.SmallIntegerField(verbose_name='答案1 （分数）')
    answer2 = models.CharField(max_length=500, blank=True, verbose_name='答案2', default='')
    answer3 = models.CharField(max_length=500, blank=True, verbose_name='答案3', default='')
    answer4 = models.CharField(max_length=500, blank=True, verbose_name='答案4', default='')
    answer5 = models.CharField(max_length=500, blank=True, verbose_name='答案5', default='')
    answer6 = models.CharField(max_length=500, blank=True, verbose_name='答案6', default='')
    ip = models.CharField(max_length=32, default='', db_index=True, blank=True, verbose_name=u'访问ip地址')
    country_name = models.CharField(max_length=20, default='', verbose_name='国家名')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'cloud_vod_surveys_answer'
        verbose_name = '云存问卷调查—答案表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class CloudVodSurveysOperateLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表ID')
    status = models.SmallIntegerField(default=0, verbose_name='状态{0:未处理,1:提交,2:关闭,3:未提交}')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'cloud_vod_surveys_operate_log'
        verbose_name = '云存问卷调查—操作日志'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class DeviceOTAUpgradeRecord(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    old_version = models.CharField(max_length=64, blank=True, verbose_name='原版本号', default='')
    new_version = models.CharField(max_length=64, blank=True, verbose_name='升级后版本号', default='')
    user_id = models.CharField(max_length=32, blank=True, verbose_name='用户ID', default='')
    serial_number = models.CharField(max_length=11, blank=True, verbose_name='序列号', default='')
    uid = models.CharField(max_length=22, blank=True, verbose_name='设备UID', default='')
    mci = models.CharField(max_length=10, blank=True, verbose_name='设备大类:IPC/NVR/DVR', default='')

    class Meta:
        db_table = 'device_OTA_upgrade_record'
        verbose_name = '设备OTA升级记录'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PaypalWebHookEvent(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    webhook_event_id = models.CharField(max_length=200, blank=True, verbose_name='webhook事件ID', default='')
    resource_type = models.CharField(max_length=11, verbose_name='资源类型', blank=True, default='')
    # event_type: 1=PAYMENT.SALE.COMPLETED(付款，订阅成功后钩子)，2=PAYMENT.SALE.REVERSED（付款撤销）
    # event_type: 3=BILLING.SUBSCRIPTION.CANCELLED（订阅取消），4=BILLING.SUBSCRIPTION.SUSPENDED（订阅暂停），
    # event_type:  5=BILLING.SUBSCRIPTION.PAYMENT.FAILED（订阅付款失败），6=PAYMENT.SALE.REFUNDED（退款）
    event_type = models.SmallIntegerField(default=0, verbose_name='事件类型')
    summary = models.CharField(max_length=500, verbose_name='事件概要', blank=True, default='')
    agreement_id = models.CharField(max_length=22, db_index=True, verbose_name='订阅ID', blank=True, default='')
    trade_no = models.CharField(max_length=22, db_index=True, verbose_name='交易ID', blank=True, default='')
    orderID = models.CharField(max_length=30, db_index=True, verbose_name='订单ID', blank=True, default='')
    newOrderID = models.CharField(max_length=30, db_index=True, verbose_name='新订单ID', blank=True, default='')
    update_status = models.BooleanField(default=False, verbose_name='更新PayPal资源状态')
    resource = models.TextField(blank=True, default='', verbose_name=u'资源详情')
    agreement_desc = models.TextField(blank=True, default='', verbose_name=u'订阅详情')
    created_time = models.IntegerField(default=0, db_index=True, verbose_name='创建时间')

    class Meta:
        db_table = 'paypal_webhook_event'
        verbose_name = 'paypal钩子事件记录表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class PopupsConfig(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')

    title = models.CharField(max_length=1000, verbose_name='弹窗标题', blank=True, default='')
    content = models.CharField(max_length=1000, verbose_name='弹窗内容', blank=True, default='')
    tag = models.SmallIntegerField(default=0, verbose_name='app跳转页面标签{1：云存储购 2：AI购买 3：优惠券}')
    start_time = models.IntegerField(default=0, verbose_name='更新时间')
    end_time = models.IntegerField(default=0, verbose_name='创建时间')
    lang = models.CharField(blank=True, max_length=16, default='en', verbose_name=u'语言地区')

    class Meta:
        db_table = 'popups_config'
        verbose_name = 'app弹窗设置'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class RedDotsConfig(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    module = models.CharField(max_length=1000, verbose_name='app模块', blank=True, default='')
    start_time = models.IntegerField(default=0, verbose_name='更新时间')
    end_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'red_dots_config'
        verbose_name = '红点标记配置'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class UserFamily(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表ID')
    name = models.CharField(max_length=50, db_index=True, verbose_name=u'家庭名称', default='', blank=True)
    location = models.CharField(max_length=100, verbose_name='位置', blank=True, default='')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'user_family'
        verbose_name = '用户家庭'
        verbose_name_plural = verbose_name


class FamilyMemberPermission(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    no = models.CharField(max_length=10, unique=True, verbose_name='编号', default=0)
    name = models.CharField(max_length=50, verbose_name=u'权限名称', default='')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    describe = models.CharField(max_length=128, blank=True, verbose_name='权限描述', default=0)
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'family_member_permission'
        verbose_name = '家庭成员权限'
        verbose_name_plural = verbose_name


class FamilyMember(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表id')
    user_name = models.CharField(max_length=64, db_index=True, verbose_name=u'用户名', default='', blank=True)
    family = models.ForeignKey(UserFamily, to_field='id', default='', on_delete=models.CASCADE,
                               verbose_name='关联用户家庭id')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    identity = models.SmallIntegerField(default=0, verbose_name='状态{0:普通成员,1:屋主}')
    permission = models.ForeignKey(FamilyMemberPermission, to_field='id', default='', on_delete=models.CASCADE,
                                   verbose_name='关联用户家庭id')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'family_member'
        verbose_name = '家庭成员'
        verbose_name_plural = verbose_name


class FamilyRoom(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    name = models.CharField(max_length=128, verbose_name=u'房间名称', default='', blank=True)
    family = models.ForeignKey(UserFamily, to_field='id', default='', on_delete=models.CASCADE,
                               verbose_name='关联用户家庭id')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'family_room'
        verbose_name = '家庭房间'
        verbose_name_plural = verbose_name


class GatewaySubDevice(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    device = models.ForeignKey(Device_Info, to_field='id', default='', on_delete=models.CASCADE,
                               verbose_name='关联设备信息id')
    device_type = models.SmallIntegerField(default=0, verbose_name=u'设备类型')
    nickname = models.CharField(default='', max_length=32, verbose_name=u'设备名称')
    ieee_addr = models.CharField(default='', max_length=64, verbose_name=u'长地址')
    src_addr = models.CharField(default='', max_length=16, verbose_name=u'短地址')
    status = models.SmallIntegerField(default=1, verbose_name='在线状态')  # 1:在线, 0:离线
    # 0:正常, 1:被拆动, 智能按钮紧急开关状态: 0:关闭, 1:开启
    is_tampered = models.SmallIntegerField(default=0, verbose_name='拆动状态')
    mac = models.CharField(default='', max_length=32, verbose_name=u'mac地址')
    device_model = models.CharField(default='', max_length=16, verbose_name=u'设备型号')
    manufacturer = models.CharField(default='', max_length=16, verbose_name=u'制造商')
    sensor_serial = models.CharField(default='', max_length=32, verbose_name=u'传感器序列号')
    firmware_version = models.CharField(default='', max_length=32, verbose_name=u'固件版本')
    hardware_version = models.CharField(default='', max_length=32, verbose_name=u'硬件版本')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'gateway_sub_device'
        verbose_name = '网关子设备'
        verbose_name_plural = verbose_name


class FamilyRoomDevice(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    room_id = models.IntegerField(default=0, blank=True, verbose_name=u'房间id')
    family_id = models.IntegerField(default=0, blank=True, verbose_name=u'家庭id')
    device = models.ForeignKey(Device_Info, to_field='id', default='', on_delete=models.CASCADE,
                               verbose_name='关联设备信息id')
    sub_device = models.IntegerField(default=0, blank=True, verbose_name='关联子设备信息id')
    sort = models.IntegerField(default=0, blank=True, verbose_name=u'排序，越小越靠前')
    category = models.SmallIntegerField(default=0, verbose_name='类别{0：网关传感器类；1：摄像头类}')
    category_sort = models.IntegerField(default=0, blank=True, verbose_name='类别排序')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'family_room_device'
        verbose_name = '家庭房间关联设备'
        verbose_name_plural = verbose_name


class FamilyMemberJoin(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表id')
    family = models.ForeignKey(UserFamily, to_field='id', default='', on_delete=models.CASCADE,
                               verbose_name='关联用户家庭id')
    status = models.SmallIntegerField(default=0, verbose_name='状态{0:未确认,1:拒绝,2:同意}')
    # 0:家庭所有者搜索邀请,1:成员扫码加入
    type = models.SmallIntegerField(default=0, verbose_name='类型')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'family_member_join'
        verbose_name = '家庭成员加入'
        verbose_name_plural = verbose_name


class SensorRecord(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    gateway_sub_device_id = models.IntegerField(default=0, blank=True, verbose_name=u'网关子设备id')
    alarm = models.CharField(default='', max_length=32, verbose_name=u'消息内容')
    event_type = models.SmallIntegerField(default=0, verbose_name=u'消息类型')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'sensor_record'
        verbose_name = '传感器记录'
        verbose_name_plural = verbose_name
        app_label = 'PushModel'


class SmartScene(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记id')
    user = models.ForeignKey(Device_User, to_field='userID', default='', on_delete=models.CASCADE,
                             verbose_name='关联用户表id')
    device_id = models.CharField(default='', max_length=32, verbose_name=u'关联设备信息id')
    sub_device_id = models.IntegerField(default=0, verbose_name=u'关联子设备表id')
    scene_name = models.CharField(default='', max_length=100, verbose_name=u'场景名称')
    conditions = models.TextField(default='', verbose_name=u'条件')
    tasks = models.TextField(default='', verbose_name=u'任务')
    is_all_day = models.SmallIntegerField(default=0, verbose_name=u'是否全天')  # 0: 不设置时间, 1: 全天, 2: 非全天
    effective_time_id = models.IntegerField(default=0, verbose_name=u'关联场景执行时间id')
    is_enable = models.BooleanField(default=True, verbose_name=u'是否开启')
    device_data = models.TextField(default='', verbose_name=u'设备场景数据')
    tz = models.FloatField(default=0, verbose_name='时区')
    scene_data = models.TextField(default='', verbose_name='场景数据')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'smart_scene'
        verbose_name = '智能场景'
        verbose_name_plural = verbose_name


class EffectiveTime(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记id')
    start_time = models.SmallIntegerField(default=0, verbose_name=u'开始时间')
    end_time = models.SmallIntegerField(default=0, verbose_name=u'结束时间')
    repeat = models.SmallIntegerField(default=0, verbose_name=u'重复周期')

    class Meta:
        db_table = 'effective_time'
        verbose_name = '场景执行时间'
        verbose_name_plural = verbose_name


class DeviceTemperatureUnit(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记id')
    user_id = models.CharField(default='', max_length=32, verbose_name='用户id')
    temperature_unit = models.SmallIntegerField(default=0, verbose_name='温度单位')  # 0: 华氏度℉, 1: 摄氏度℃

    class Meta:
        db_table = 'device_temperature_unit'
        verbose_name = '设备温度单位'
        verbose_name_plural = verbose_name


class SceneLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    scene_name = models.CharField(default='', max_length=100, verbose_name='场景名称')
    scene_id = models.IntegerField(default=0, verbose_name='关联场景id')
    device_id = models.CharField(default='', max_length=32, verbose_name='关联网关id')
    sub_device_id = models.IntegerField(default=0, verbose_name='关联子设备id')
    tasks = models.TextField(default='', verbose_name=u'任务')
    status = models.SmallIntegerField(default=0, verbose_name='场景状态')
    created_time = models.IntegerField(default=0, verbose_name='场景触发时间')

    class Meta:
        db_table = 'scene_log'
        verbose_name = '场景日志'
        verbose_name_plural = verbose_name
        app_label = 'PushModel'


class UnicomCombo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记Id')
    package_id = models.CharField(default='', max_length=128, verbose_name=u'第三方套餐包id')
    combo_name = models.CharField(default='', max_length=32, verbose_name=u'套餐名称')
    status = models.SmallIntegerField(default=0, verbose_name='状态{0:开启,1:停用}')
    # 套餐类型 0:联通商用,1:联通初始化赠送,2:联通赠送套餐,3:五兴电信,4:出厂测试
    combo_type = models.SmallIntegerField(default=0, verbose_name='套餐类型')
    flow_total = models.IntegerField(default=0, blank=True, verbose_name=u'流量总量值 单位(MB)')
    expiration_days = models.IntegerField(default=0, blank=True, verbose_name=u'有效期天数')
    expiration_type = models.SmallIntegerField(default=0, verbose_name=u'有效期类型,0=天，1=月，2=年')
    pay_type = models.ManyToManyField(to='Pay_Type', verbose_name='付款类型', db_table='unicom_combo_pay_type')
    price = models.CharField(blank=True, max_length=32, verbose_name=u'价格')
    virtual_price = models.CharField(blank=True, null=True, max_length=32, verbose_name=u'原价格')
    is_unlimited = models.SmallIntegerField(default=0, verbose_name=u'是否无限流量,，0：有限流量，1：无限流量')
    sort = models.IntegerField(default=0, blank=True, verbose_name=u'排序，越小越靠前')
    remark = models.TextField(blank=True, default='', verbose_name=u'描述信息')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    is_show = models.SmallIntegerField(default=1, verbose_name=u'是否显示,0：不显示，1：显示')
    is_del = models.BooleanField(blank=True, default=False, verbose_name=u'是否删除默认false')

    class Meta:
        db_table = 'unicom_combo'
        verbose_name = '联通套餐表'
        verbose_name_plural = verbose_name


class UnicomComboOrderInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记Id')
    iccid = models.CharField(default='', max_length=32, verbose_name=u'完整的20位纯数字ICCID')
    renew_list_id = models.CharField(blank=True, default='', max_length=32, verbose_name=u'联通订购成功套餐队列id')
    status = models.SmallIntegerField(default=0, verbose_name='状态{0:未使用,1:已使用,2:已过期}')
    order_id = models.CharField(blank=True, default='', max_length=32, verbose_name=u'关联订单表')
    combo = models.ForeignKey(UnicomCombo, to_field='id', default='', on_delete=models.CASCADE,
                              verbose_name=u'联通套餐表')
    year = models.IntegerField(default=0, verbose_name='使用年')
    month = models.IntegerField(default=0, verbose_name='使用月')
    flow_total_usage = models.CharField(blank=True, default='', max_length=32, verbose_name=u'激活时当月已用流量')
    flow_exceed = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=u'当前套餐已超流量值MB')
    last_combo_flow_exceed = models.DecimalField(default=0, max_digits=10, decimal_places=2,
                                                 verbose_name=u'上一个流量套餐流量已超值(MB)')
    is_flow_exceed = models.IntegerField(default=0,
                                         verbose_name=u'当前套餐是否已超流量，0：正常结算，1：已超需计入下一个流量套餐')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序')
    next_month_activate = models.BooleanField(blank=True, default=False, verbose_name=u'下月激活')
    activation_time = models.IntegerField(default=0, verbose_name='激活时间')
    expire_time = models.IntegerField(default=0, verbose_name='过期时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    is_del = models.BooleanField(blank=True, default=False, verbose_name=u'是否删除')

    class Meta:
        db_table = 'unicom_combo_order_info'
        verbose_name = '联通套餐订单信息表'
        verbose_name_plural = verbose_name


class UnicomDeviceInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记Id')
    iccid = models.CharField(db_index=True, unique=True, max_length=32, verbose_name=u'完整的20位纯数字ICCID')
    status = models.SmallIntegerField(default=0, verbose_name=u'状态{0:可测试,1:测试完成,2:已使用}')
    serial_no = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'设备序列号')
    user_id = models.CharField(blank=True, max_length=32, verbose_name=u'用户id')
    card_type = models.SmallIntegerField(default=0,
                                         verbose_name=u'状态{0:联通,1:五兴电信,2:移动,3:鼎芯电信,4:其它,5:鼎芯国际}')
    main_card = models.SmallIntegerField(default=0, verbose_name=u'SIM卡类型{0:拔插卡,1:贴片卡}')
    sim_used_flow = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=u'sim卡已用总流量(MB)')
    sim_cycle_used_flow = models.DecimalField(default=0, max_digits=10, decimal_places=2,
                                              verbose_name=u'设备账期已用流量(MB)')
    access_number = models.CharField(blank=True, max_length=32, verbose_name=u'接入号码')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'unicom_device_info'
        verbose_name = '联通设备信息'
        verbose_name_plural = verbose_name


class UnicomDeviceQueueMonitoringPush(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记Id')
    iccid = models.CharField(default='', max_length=32, verbose_name=u'完整的20位纯数字ICCID')
    serial_no = models.CharField(default='', max_length=32, verbose_name=u'序列号')
    sign = models.CharField(default='', max_length=128, verbose_name=u'验证签名')
    time = models.CharField(default='', max_length=32, verbose_name=u'推送时间（yyyymmddhhmiss）')
    type = models.CharField(default='', max_length=32, verbose_name=u'推送类型：DEVICE_QUEUE_MONITORING:设队列监控;')
    current_renew_list_id = models.CharField(default='', max_length=32, verbose_name=u'队列ID')
    no_queue_available = models.SmallIntegerField(default=0, verbose_name=u'是否无可用队列；1:是；0:否')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'unicom_device_queue_monitoring_push'
        verbose_name = '联通设备队列监控推送表'
        verbose_name_plural = verbose_name


class UnicomDeviceStatusChangePush(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记Id')
    iccid = models.CharField(default='', max_length=32, verbose_name=u'完整的20位纯数字ICCID')
    serial_no = models.CharField(default='', max_length=32, verbose_name=u'序列号')
    sign = models.CharField(default='', max_length=128, verbose_name=u'验证签名')
    time = models.CharField(default='', max_length=32, verbose_name=u'推送时间（yyyymmddhhmiss）')
    # 变更类型： DEVICE_REAL_NAME_STATUS_CHANGE：实名状态变更；DEVICE_STATUS_CHANGE：设备状态变更；
    type = models.CharField(default='', max_length=32, verbose_name=u'变更类型')
    # 之前值：设备状态变更 1: 已激活；2: 可激活；3: 已停用；4: 已失效；5: 可测试；6: 库存；7: 已更换；8: 已清除;
    previous_val = models.CharField(default='', max_length=32, verbose_name=u'之前值：')
    # 当前值：设备状态变更 1:已激活；2:可激活；3:已停用；4:已失效；5:可测试；6:库存；7:已更换；8:已清除;
    current_val = models.CharField(default='', max_length=32, verbose_name=u'当前值：')
    reason = models.SmallIntegerField(default=0, verbose_name=u'变更原因编码：请查看【信息提示码】')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'unicom_device_status_change_push'
        verbose_name = '联通设备状态变更推送表'
        verbose_name_plural = verbose_name


class UnicomComboExperienceHistory(models.Model):
    id = models.AutoField(primary_key=True)
    # 0: 免费体验, 1: 激活码
    experience_type = models.SmallIntegerField(default=0, verbose_name='体验类型')
    iccid = models.CharField(max_length=32, default='', verbose_name='联通20位ICCID')
    do_time = models.IntegerField(default=0, verbose_name='激活时间')

    class Meta:
        db_table = 'unicom_combo_experience_history'
        verbose_name = '联通套餐体验历史表'
        verbose_name_plural = verbose_name


class UnicomFlowPush(models.Model):
    id = models.AutoField(primary_key=True)
    user_id = models.CharField(default='', max_length=32, verbose_name=u'用户id')
    # 0: 剩余10%流量预警, 1: 流量到期
    type = models.SmallIntegerField(default=0, verbose_name='流量推送类型')
    combo_order_id = models.CharField(max_length=32, default='', verbose_name='当前订单套餐id')
    serial_no = models.CharField(max_length=32, default='', verbose_name='序列号')
    flow_total_usage = models.DecimalField(default=0, max_digits=10, decimal_places=2,
                                           verbose_name=u'当月实际流量用量 单位(MB)')
    flow_total = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=u'流量总量 单位(MB)')
    status = models.SmallIntegerField(default=0, verbose_name=u'状态{0:待推送,1:已推送}')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'unicom_flow_push'
        verbose_name = '联通流量用量推送'
        verbose_name_plural = verbose_name
        app_label = "PushModel"


class DeviceAppScenario(models.Model):
    id = models.AutoField(primary_key=True)
    # 0：用作显示banner图使用，1：店铺，2：照看长辈，3：看护儿童，4：逗宠专属
    type = models.SmallIntegerField(default=0, verbose_name='场景类型')
    sort = models.SmallIntegerField(default=0, verbose_name=u'排序，越小越靠前')
    cver_url = models.CharField(max_length=128, default='', verbose_name='封面图地址')
    banner_url = models.CharField(max_length=128, default='', verbose_name='横幅图片地址')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'device_app_scenario'
        verbose_name = '设备应用场景'
        verbose_name_plural = verbose_name


class DeviceScenarioLangInfo(models.Model):
    id = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32, default='', verbose_name='场景内容')
    content = models.CharField(max_length=100, default='', verbose_name='场景内容')
    scenario_id = models.IntegerField(default=0, verbose_name=u'应用场景id')
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='语言/国家')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'device_scenario_lang_info'
        verbose_name = '设备场景语言信息'
        verbose_name_plural = verbose_name


class DeviceAlgorithmScenario(models.Model):
    id = models.AutoField(primary_key=True)
    algorithm_id = models.IntegerField(default=0, db_index=True, verbose_name='算法id')
    scenario_id = models.IntegerField(default=0, db_index=True, verbose_name='场景id')
    sort = models.IntegerField(default=99, verbose_name=u'排序，越小越靠前')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'device_algorithm_scenario'
        verbose_name = '设备算法关联应用场景'
        verbose_name_plural = verbose_name


class DeviceAlgorithmType(models.Model):
    id = models.AutoField(primary_key=True)
    # 0：移动侦测，1：人形检测，2：挥手识别，3：人脸检测，4：异声感知，5：车辆检测，7：宠物检测，6：哭声检测，8：徘徊检测
    # 9：区域闯入，10：区域闯出，11：长时间无人检测，12：往来检测，13：云相册,14:火焰检测,15:婴儿遮面
    type = models.SmallIntegerField(default=0, verbose_name='算法类型')
    memory = models.CharField(max_length=32, default='', verbose_name='所需内存')
    down_count = models.IntegerField(default=0, verbose_name='下载次数')
    # 0：默认，1：HOT，2：Beta
    tag = models.SmallIntegerField(default=0, verbose_name='标签')
    # 0：免费，1：限时免费，2：付费
    status = models.SmallIntegerField(default=0, verbose_name='算法使用状态')
    expire_time = models.IntegerField(verbose_name='限时免费到期时间', default=0)
    sort = models.IntegerField(default=0, verbose_name=u'排序，越小越靠前')
    basic_function = models.TextField(blank=True, default='', verbose_name=u'基础功能（json格式）')
    image_url = models.CharField(max_length=255, default='', verbose_name='图片地址')
    details_img_url = models.CharField(max_length=255, default='', verbose_name='详情图')
    icon_url = models.CharField(max_length=255, default='', verbose_name='图标地址')
    resource = models.JSONField(null=True, verbose_name='算法模型bin文件地址JSON格式')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_algorithm_type'
        verbose_name = '设备算法类型'
        verbose_name_plural = verbose_name


class DeviceAlgorithmBanner(models.Model):
    id = models.AutoField(primary_key=True)
    algorithm_type = models.ForeignKey(DeviceAlgorithmType, to_field='id', default='', on_delete=models.CASCADE,
                                       verbose_name=u'关联算法类型')
    image_url = models.CharField(max_length=255, default='', verbose_name='横幅图')
    sort = models.IntegerField(default=0, verbose_name=u'排序，越小越靠前')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_algorithm_banner'
        verbose_name = '设备算法横幅广告'
        verbose_name_plural = verbose_name


class DeviceAlgorithmExplain(models.Model):
    id = models.AutoField(primary_key=True)
    algorithm_type = models.ForeignKey(DeviceAlgorithmType, to_field='id', default='', on_delete=models.CASCADE,
                                       verbose_name=u'关联算法类型')
    title = models.CharField(max_length=32, default='', verbose_name='标题')
    subtitle = models.CharField(max_length=100, default='', verbose_name='副标题')
    price = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name='价格')
    introduction = models.TextField(blank=True, default='', verbose_name='功能介绍')
    install_explain = models.TextField(blank=True, default='', verbose_name=u'安装说明')
    concerning = models.CharField(blank=True, max_length=64, default='', verbose_name=u'关于（文本标题）')
    risk_warning = models.TextField(blank=True, default='', verbose_name=u'风险提示')
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='语言/国家')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_algorithm_explain'
        verbose_name = '设备算法详情'
        verbose_name_plural = verbose_name


class DeviceUidAlgorithmType(models.Model):
    id = models.AutoField(primary_key=True)
    status = models.SmallIntegerField(default=0, verbose_name=u'状态{0:关闭，1:开启}')
    memory = models.CharField(max_length=32, default='', verbose_name='设备内存')
    function = models.TextField(blank=True, default='', verbose_name='功能设置')
    device_uid = models.CharField(max_length=32, db_index=True, default='', verbose_name='设备uid')
    algorithm_type = models.ForeignKey(DeviceAlgorithmType, to_field='id', default='', on_delete=models.CASCADE,
                                       verbose_name=u'关联算法类型')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_uid_algorithm_type'
        verbose_name = '设备uid关联算法类型'
        verbose_name_plural = verbose_name


class DeviceTypeAlgorithmInfo(models.Model):
    id = models.AutoField(primary_key=True)
    device_name = models.CharField(blank=True, max_length=32, default='', verbose_name='设备类型名称')
    device_type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    algorithm_type = models.SmallIntegerField(default=0, verbose_name='算法类型')
    type_icon = models.CharField(blank=True, max_length=255, default='', verbose_name='设备类型icon')
    device_link = models.CharField(blank=True, max_length=255, default='', verbose_name='设备购买链接')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_type_algorithm_info'
        verbose_name = '设备类型关联算法'
        verbose_name_plural = verbose_name


class DeviceAlgorithmPassengerFlow(models.Model):
    id = models.AutoField(primary_key=True)
    uid = models.CharField(max_length=32, db_index=True, default='', verbose_name='设备uid')
    type = models.SmallIntegerField(default=0, verbose_name='客流类型，1:进,2:离开')
    count = models.IntegerField(default=0, verbose_name='当前时段统计数量')
    statistical_time = models.DateTimeField(blank=True, null=True, verbose_name=u'统计日期时间')
    device_time = models.IntegerField(default=0, verbose_name='设备上报时间戳')
    channel = models.IntegerField(default=1, blank=True, verbose_name=u'设备通道')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_algorithm_passenger_flow'
        verbose_name = '设备算法客流统计'
        verbose_name_plural = verbose_name


class VodHlsSummary(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='回放汇总列表主键')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    time = models.IntegerField(verbose_name='汇总年月时间戳', default=0, db_index=True)
    upload_duration = models.BigIntegerField(verbose_name='上传秒数', default=0)
    upload_frequency = models.IntegerField(verbose_name='上传次数', default=0)
    play_duration = models.IntegerField(verbose_name='播放秒数', default=0)
    play_frequency = models.IntegerField(verbose_name='播放次数', default=0)
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_summary'
        verbose_name = u'云存回放汇总信息表'
        verbose_name_plural = verbose_name


class DeviceUserSummary(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='用户汇总列表主键')
    time = models.IntegerField(verbose_name='时间戳', default=0, db_index=True)
    query_type = models.SmallIntegerField(verbose_name='查询类型{0：新增用户，1：活跃用户}', default=0)
    count = models.IntegerField(verbose_name='总人数', default=0)
    country = models.TextField(verbose_name='所属国家', default='')
    continent = models.TextField(verbose_name='四大洲信息', default='')
    device_type = models.JSONField(verbose_name='设备类型信息', null=True)
    ucode = models.JSONField(verbose_name='ucode类型', null=True)
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'device_user_summary'
        verbose_name = u'用户汇总信息表'
        verbose_name_plural = verbose_name


class OrdersSummary(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='订单汇总列表主键')
    time = models.IntegerField(verbose_name='时间戳', default=0, db_index=True)
    query_type = models.SmallIntegerField(verbose_name='查询类型{0：付费订单，1：免费订单，2：首次付费订单，3：复购订单}',
                                          default=0)
    service_type = models.SmallIntegerField(verbose_name='增值服务类型{0：云存，1：AI，2：4G}', default=0)
    count = models.IntegerField(verbose_name='订单数量', default=0)
    total = models.CharField(verbose_name='销售额', default='', max_length=255)
    country = models.TextField(verbose_name='所属国家', default='')
    device_type = models.TextField(verbose_name='设备类型信息', default='')
    store_meal = models.TextField(verbose_name='套餐信息', default='')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'orders_summary'
        verbose_name = u'订单汇总信息表'
        verbose_name_plural = verbose_name


class DeviceInfoSummary(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='设备汇总列表主键')
    time = models.IntegerField(verbose_name='时间戳', default=0, db_index=True)
    query_type = models.SmallIntegerField(verbose_name='查询类型{0：新增设备，1：活跃设备}', default=0)
    count = models.IntegerField(verbose_name='设备数量', default=0)
    country = models.TextField(verbose_name='所属国家', default='')
    continent = models.TextField(verbose_name='四大洲信息', default='')
    device_type = models.TextField(verbose_name='设备类型信息', default='')
    vod_service = models.TextField(verbose_name='云存服务信息', default='')
    ai_service = models.TextField(verbose_name='ai服务信息', default='')
    unicom_service = models.TextField(verbose_name='联通服务信息', default='')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'device_info_summary'
        verbose_name = u'设备汇总信息表'
        verbose_name_plural = verbose_name


class OperatingCosts(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键id')
    order_id = models.CharField(verbose_name='订单号', default='', max_length=24, db_index=True)
    uid = models.CharField(verbose_name='设备UID', default='', max_length=20, db_index=True)
    day_average_price = models.CharField(verbose_name='收入分摊/天', default='0', max_length=16)  # 订单金额/订单天数
    month_average_price = models.CharField(verbose_name='收入分摊/月', default='0', max_length=16)  # 收入分摊/天*当月使用天数
    purchase_quantity = models.CharField(verbose_name='购买量/月', default='', max_length=8, blank=True)
    actual_storage = models.CharField(default='0', verbose_name='实际存储量', max_length=16)
    actual_api = models.IntegerField(default=0, verbose_name='实际调用api次数')
    actual_flow = models.CharField(default='0', verbose_name='实际流量', max_length=16)
    monthly_income = models.CharField(verbose_name='当月结算收入', default='0', max_length=16)  # 实际收入/套餐总天数*结算天数
    settlement_days = models.SmallIntegerField(verbose_name='当月结算天数', default=0)
    remaining_usage_time = models.IntegerField(default=0, verbose_name='剩余使用时间')
    created_time = models.IntegerField(default=0, verbose_name='当月结算时间')
    start_time = models.BigIntegerField(default=0, verbose_name='订单开始时间')
    end_time = models.BigIntegerField(default=0, verbose_name='订单结束时间')
    time = models.IntegerField(verbose_name='时间戳', default=0)
    remark = models.CharField(blank=True, default='', max_length=200, verbose_name='备注')
    profit = models.CharField(verbose_name='当月利润', default='0', max_length=16)
    profit_margin = models.CharField(verbose_name='当月利润率', default='0', max_length=8)
    storage_cost = models.CharField(verbose_name='云存成本', default='0', max_length=16)
    api_cost = models.CharField(verbose_name='调用api成本', default='0', max_length=16)
    fee = models.CharField(verbose_name='订单手续费', default='0', max_length=16)
    flow_cost = models.CharField(verbose_name='流量成本', default='0', max_length=16)
    real_income = models.CharField(verbose_name='订单实际收入', default='0', max_length=16)
    price = models.CharField(verbose_name='订单价格', default='0', max_length=16)
    region = models.CharField(verbose_name='地区', default='', max_length=8)
    country_name = models.CharField(verbose_name='国家', default='', max_length=16)
    order_type = models.CharField(verbose_name='订单类型', default='', max_length=16)
    expire = models.CharField(verbose_name='订单时长', default='', max_length=16)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'operating_costs'
        verbose_name = '运营成本'
        verbose_name_plural = verbose_name


class UidBucketStatistics(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='设备汇总列表主键')
    uid = models.CharField(verbose_name='设备UID', default='', max_length=20, db_index=True)
    storage_size = models.CharField(verbose_name='存储量', default='', max_length=16)  # 单位M
    api_count = models.IntegerField(default=0, verbose_name='实际调用api次数')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    time = models.IntegerField(verbose_name='时间戳', default=0)

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'uid_bucket_statistics'
        verbose_name = '存储桶信息统计'
        verbose_name_plural = verbose_name


class KVS(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    stream_name = models.CharField(default='', max_length=128, verbose_name='视频流名称')  # 视频流名称,为序列号
    stream_arn = models.CharField(default='', max_length=128, verbose_name='视频流ARN')
    data_retention_in_hours = models.PositiveSmallIntegerField(default=0, verbose_name='数据保留时间')  # 单位: 小时
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'kvs'
        verbose_name = 'kvs表'
        verbose_name_plural = verbose_name


class DeviceCloudPhotoInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    status = models.SmallIntegerField(default=0, verbose_name=u'状态{0:关闭，1:开启}')
    user_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_cloud_photo'
        verbose_name = '设备云相册信息'
        verbose_name_plural = verbose_name


class DevicePicturePushInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    type = models.SmallIntegerField(default=0, verbose_name=u'状态{0:图片，1:视频}')
    user_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    device_nick_name = models.CharField(blank=True, max_length=32, default='', verbose_name=u'设备昵称')
    channel = models.IntegerField(default=1, blank=True, verbose_name=u'设备通道')
    event_time = models.CharField(blank=True, db_index=True, default='', max_length=16, verbose_name=u'设备报警时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_picture_push_info'
        verbose_name = '设备图片推送信息'
        verbose_name_plural = verbose_name


class CloudPhotoBGM(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    is_show = models.SmallIntegerField(default=1, verbose_name=u'是否显示')  # 0: 否, 1: 是
    name = models.CharField(default='', max_length=128, verbose_name=u'音乐名称')
    link = models.CharField(default='', max_length=255, verbose_name=u'音乐链接')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'cloud_photo_bgm'
        verbose_name = '云相册背景音乐'
        verbose_name_plural = verbose_name


class UserOperationLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    user_id = models.CharField(default='', db_index=True, blank=True, max_length=32, verbose_name=u'用户id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    type = models.SmallIntegerField(default=0, verbose_name='类型[1:云存储弹窗,2:AI弹窗,3：4G,4:AI红点]')
    status = models.SmallIntegerField(default=0, verbose_name='0:未读/未操作，1:已读/已操作')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'user_operation_log'
        verbose_name = '用户操作日志记录'
        verbose_name_plural = verbose_name


class UidCloudStorageCount(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    count = models.IntegerField(default=0, blank=True, verbose_name=u'当日上传次数')
    type = models.SmallIntegerField(default=0, verbose_name='0：云存视频')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'uid_cloud_storage_count'
        verbose_name = '云存储uid日上传次数统计'
        verbose_name_plural = verbose_name


class DeviceChannelUserSet(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    channels = models.CharField(default='', blank=True, max_length=128, verbose_name=u'用户通道多个逗号隔开')
    user_id = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'用户id')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_channel_user_set'
        verbose_name = '设备通道用户设置'
        verbose_name_plural = verbose_name


class DeviceSharePermission(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    code = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'权限编码')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_share_permission'
        verbose_name = '设备分享权限'
        verbose_name_plural = verbose_name


class DevicePermissionLang(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    permission_id = models.IntegerField(default=0, verbose_name=u'关联设备权限ID')
    name = models.CharField(default='', max_length=50, verbose_name=u'权限名称')
    desc = models.CharField(blank=True, max_length=64, default='', verbose_name=u'描述')
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='例如：cn')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_permission_lang'
        verbose_name = '设备分享权限语言描述'
        verbose_name_plural = verbose_name


class DeviceChannelUserPermission(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    permission_id = models.IntegerField(default=0, verbose_name=u'关联设备权限ID')
    channel_user_id = models.IntegerField(default=0, verbose_name=u'通道用户id')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_channel_user_permission'
        verbose_name = '设备分享权限关联通道用户'
        verbose_name_plural = verbose_name


class DeviceTypeSharePermission(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    permission_id = models.IntegerField(default=0, verbose_name=u'关联设备权限ID')
    type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_type_share_permission'
        verbose_name = '设备类型关联分享权限'
        verbose_name_plural = verbose_name


class DeviceUserPermissions(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    permission_id = models.IntegerField(default=0, verbose_name=u'权限ID')
    user_id = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'用户id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_user_permissions'
        verbose_name = '分享设备用户权限表'
        verbose_name_plural = verbose_name


class DeviceSuperPassword(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    userID = models.ForeignKey(Device_User, blank=True, to_field='userID', on_delete=models.CASCADE)
    lang = models.CharField(default='', max_length=20, db_index=True, verbose_name='语言/国家')
    orderID = models.CharField(max_length=30, db_index=True, verbose_name='订单ID', blank=True, default='')
    describe = models.CharField(max_length=128, blank=True, verbose_name='需求描述', default=0)
    purchase_channel = models.CharField(max_length=128, blank=True, verbose_name='购买渠道描述', default='')
    addTime = models.IntegerField(default=0, verbose_name='添加时间')
    status = models.SmallIntegerField(default=0, verbose_name=u'状态{0:未通过,1:通过}')
    buyTime = models.IntegerField(default=0, verbose_name='购买时间')
    hint = models.CharField(max_length=128, blank=True, verbose_name='温馨提示', default='')

    class Meta:
        db_table = 'device_super_password'
        verbose_name = '超级密码请求表'
        verbose_name_plural = verbose_name


class VodHlsTag(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    uid = models.CharField(blank=True, db_index=True, max_length=32, verbose_name=u'设备UID')
    vod_hls_id = models.IntegerField(default=0, db_index=True, verbose_name='云存hlsId')
    tab_num = models.SmallIntegerField(default=0, verbose_name='所在表编号')
    ai_event_time = models.IntegerField(default=0, db_index=True, verbose_name='ai事件事件')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'vod_hls_tag'
        verbose_name = '云存hls标签'
        verbose_name_plural = verbose_name


class VodHlsTagType(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    tag_id = models.IntegerField(default=0, db_index=True, verbose_name='云存关联AI标签ID')
    type = models.SmallIntegerField(default=0, db_index=True, verbose_name='标签类型')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'vod_hls_tag_type'
        verbose_name = '云存hls关联标签类型'
        verbose_name_plural = verbose_name


class TestSerialRepetition(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    serial_number = models.CharField(blank=True, unique=True, db_index=True, max_length=20, default='',
                                     verbose_name='序列号')
    phone_model = models.CharField(max_length=64, default='', verbose_name='手机型号')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'test_serial_repetition'
        verbose_name = '测试序列号重复问题'
        verbose_name_plural = verbose_name


class TestDeviceFindSerial(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    serial_number = models.CharField(blank=True, db_index=True, max_length=20, default='',
                                     verbose_name='序列号')
    firmware_time_code = models.CharField(max_length=128, unique=True, default='', verbose_name='PC固件码+时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'test_device_find_serial'
        verbose_name = '查找设备序列号'
        verbose_name_plural = verbose_name


class SocketPowerStatistics(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    device_id = models.CharField(max_length=32, default='', verbose_name='设备id')
    serial_number = models.CharField(db_index=True, max_length=20, default='',
                                     verbose_name='序列号')
    electricity = models.DecimalField(default=0, max_digits=10, decimal_places=6, verbose_name='设备当日用电KWh')
    # 设备根据策略上报的w值，然后当日存在数据则累加
    watt = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name='每分钟消耗功率（瓦）')
    power = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name='负载功率w')
    accumulated_time = models.IntegerField(default=0, verbose_name='当天累计时长（秒）')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 's_socket_power_statistics'
        verbose_name = '插座电量统计'
        verbose_name_plural = verbose_name


class SocketInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    device_id = models.CharField(max_length=32, default='', verbose_name='设备id')
    serial_number = models.CharField(db_index=True, max_length=20,
                                     verbose_name='序列号')
    online = models.BooleanField(default=False, verbose_name='在线状态False：不在线，True：在线')
    type_switch = models.SmallIntegerField(default=0,
                                           verbose_name='开关类型 0：总开关，1：倒计时开关')
    status = models.BooleanField(default=False, verbose_name='开关状态 0：关闭，1：开启')
    start = models.BooleanField(default=False, verbose_name='倒计时状态 0：关闭，1：开启')
    count_down_time = models.IntegerField(default=0, verbose_name='倒计时时间戳')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 's_socket_info'
        verbose_name = '插座信息'
        verbose_name_plural = verbose_name


class SocketSchedule(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    device_id = models.CharField(max_length=32, default='', verbose_name='设备id')
    serial_number = models.CharField(db_index=True, max_length=20, default='',
                                     verbose_name='序列号')
    time_type = models.SmallIntegerField(default=0, verbose_name='排查时间类型 1:按时间 2：按时间段划分')
    switch_status = models.BooleanField(default=False, verbose_name='开关状态 0：关闭，1：开启')
    task_status = models.BooleanField(default=False, verbose_name='任务状态状态 0：关闭，1：启动')
    start_time = models.IntegerField(default=0, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, verbose_name='结束时间')
    repeat = models.SmallIntegerField(default=0,
                                      verbose_name='重复周期用数值表示 设备转二进制例127则二进制1111111')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 's_socket_schedule'
        verbose_name = '插座排程'
        verbose_name_plural = verbose_name


class SwitchDimmingSettings(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    device_id = models.CharField(max_length=32, default='', verbose_name='设备id')
    click_turn_on_speed = models.SmallIntegerField(default=0, verbose_name='单击开启速度')
    click_turn_off_speed = models.SmallIntegerField(default=0, verbose_name='单击关闭速度')
    double_click = models.CharField(max_length=8, default=0, verbose_name='双击')  # 0: 无, 1: 缓慢开/关, x%: 预设亮度
    press = models.CharField(max_length=8, default=0, verbose_name='长按')  # 0: 无, 1: 缓慢开/关, x%: 预设亮度
    double_press_click_turn_on_speed = models.SmallIntegerField(default=0, verbose_name='双击/长按开启速度')
    double_press_click_turn_off_speed = models.SmallIntegerField(default=0, verbose_name='双击/长按关闭速度')
    dimming_correction = models.CharField(max_length=8, default='', verbose_name='调光校正')

    class Meta:
        db_table = 'switch_dimming_settings'
        verbose_name = '智能开关调光设置'
        verbose_name_plural = verbose_name


class SwitchScheduler(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    device_id = models.CharField(max_length=32, default='', verbose_name='设备id')
    time_type_radio = models.SmallIntegerField(default=1, verbose_name='切换时间点/时间段')  # 1: 按时间点, 2: 按时间段
    time_point = models.IntegerField(default=0, verbose_name='时间点时间戳')
    start_time = models.IntegerField(default=0, verbose_name='时间段开始时间')
    end_time = models.IntegerField(default=0, verbose_name='时间段结束时间')
    actions = models.IntegerField(default=0, verbose_name='排程操作')  # 0：关闭 1：开启 x:预设亮度值 x:间隔时间（秒）
    actions_type = models.SmallIntegerField(default=0, verbose_name='操作类型')  # 1:开关开启或关闭；2:开启并预设亮度；3:开启/关闭切换
    slow_speed = models.SmallIntegerField(default=0, verbose_name='缓慢开/关速度')  # 秒
    repeat = models.CharField(default=0, max_length=13, verbose_name=u'重复周期')  # 0-6:星期日到星期六
    is_execute = models.SmallIntegerField(default=1, verbose_name='是否执行')  # 0：执行；1：不执行

    class Meta:
        db_table = 'switch_scheduler'
        verbose_name = '排程计划'
        verbose_name_plural = verbose_name


class ExchangeCode(models.Model):
    id = models.AutoField(primary_key=True)
    code = models.CharField(max_length=32, unique=True, verbose_name='兑换码')
    status = models.BooleanField(default=False, verbose_name='状态（0-未使用，1-已使用）')
    is_down = models.BooleanField(default=0, verbose_name='是否已下载 0-未下载,1-已下载')
    package_type = models.SmallIntegerField(default=0, verbose_name='套餐包类型 0-联通,1-五兴,2-其它')
    package_id = models.BigIntegerField(default=0, verbose_name='套餐包id')
    expire_time = models.IntegerField(default=0, verbose_name='过期时间')
    # 备用字段
    spare_1 = models.CharField(default='', blank=True, max_length=64, verbose_name=u'备用字段1')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'exchange_code'
        verbose_name = '套餐包兑换码'
        verbose_name_plural = verbose_name


class ICloudStoreMeal(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增ID')
    currency = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'货币符号')
    symbol = models.CharField(blank=True, default='$', max_length=32, verbose_name=u'符号')
    price = models.CharField(blank=True, max_length=32, verbose_name=u'价格')
    expire = models.IntegerField(default=0, blank=True, verbose_name=u'有效期')  # 单位月
    add_time = models.DateTimeField(blank=True, null=True, verbose_name=u'加入时间', auto_now_add=True)
    pay_type = models.ManyToManyField(to='Pay_Type', verbose_name='付款类型', db_table='icloud_store_meal_pay')
    update_time = models.DateTimeField(blank=True, verbose_name=u'更新时间', auto_now=True)
    is_show = models.SmallIntegerField(default=0, verbose_name=u'是否隐藏 [0=隐藏，1展示]')
    is_delete = models.SmallIntegerField(default=0, verbose_name=u'是否删除 [0=否，1=是]')
    lang = models.ManyToManyField(to='Lang', verbose_name='套餐语言', db_table='icloud_store_meal_lang')
    size = models.IntegerField(null=True, default=0, verbose_name='云盘容量大小')  # 单位GB
    bucket_id = models.SmallIntegerField(default=0, verbose_name='关联存储桶id')
    sort = models.IntegerField(default=99, blank=True, verbose_name=u'排序，越小越靠前')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'icloud_store_meal'
        verbose_name = u'云盘套餐'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class IcloudUseDetails(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    use_size = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name='已使用容量大小')  # 单位MB
    add_time = models.IntegerField(verbose_name='添加时间', default=0)
    upd_time = models.BigIntegerField(verbose_name='更新时间', default=0)
    detect_status = models.SmallIntegerField(default=0, verbose_name='开关状态')  # 0:关闭, 1:开启
    user_id = models.CharField(blank=True, max_length=32, verbose_name=u'用户id')
    bucket_id = models.SmallIntegerField(default=0, verbose_name='关联存储桶id')

    class Meta:
        db_table = 'icloud_use_details'
        verbose_name = '云盘使用表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class IcloudService(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    size = models.IntegerField(default=0, verbose_name='容量大小')  # 单位GB
    end_time = models.IntegerField(verbose_name='套餐结束时间', db_index=True, default=0)
    add_time = models.IntegerField(verbose_name='添加时间', default=0)
    upd_time = models.IntegerField(verbose_name='更新时间', default=0)
    use_status = models.IntegerField(verbose_name='使用状态', default=0)  # 0:使用中, 1:已过期
    use_details_id = models.IntegerField(default=0, verbose_name='关联云盘使用表id')
    type = models.SmallIntegerField(default=0, verbose_name='云盘购买类型')  # 0：注册永久送，1：购买云存附送，2：单独购买套餐
    order_id = models.CharField(default='', max_length=20, verbose_name='关联订单id')

    class Meta:
        db_table = 'icloud_service'
        verbose_name = '云盘服务表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class IcloudStorageRecord(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='回放列表主键')
    user_id = models.CharField(blank=True, max_length=32, verbose_name=u'用户id')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    nickname = models.CharField(max_length=20, verbose_name='设备昵称', db_index=True)
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    time_stamp = models.BigIntegerField(verbose_name='视频/图片名字时间戳', default=0, db_index=True)  # 单位毫秒
    sec = models.IntegerField(verbose_name='秒数', default=0)
    bucket_id = models.IntegerField(verbose_name='关联存储桶id', default=0)
    fg = models.CharField(max_length=20, verbose_name='ts个数,时间描述片段数',
                          default='')  # 阿里为时间片段数,亚马逊为一个32bit整型，前28bit代表ts文件的时长
    size = models.DecimalField(default=0, max_digits=4, decimal_places=2, verbose_name='视频/图片大小')  # 单位MB
    file_type = models.SmallIntegerField(default=0, verbose_name='文件类型')  # 0:图片, 1:ts视频, 2：MP4视频

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'icloud_storage_record'
        verbose_name = u'云盘信息记录表'
        verbose_name_plural = verbose_name
        ordering = ('-id',)


class IotCardUsageHistory(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='列表主键')
    iccid = models.CharField(default='', max_length=32, verbose_name=u'ICCID号')
    card_type = models.SmallIntegerField(default=0, verbose_name='卡类型，1:联通,2:电信,3:移动,4:其它,5:国际')
    cycle = models.IntegerField(default=0, verbose_name='帐期 如 202307')
    flow_total_usage = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=u'月流量用量(MB)')
    voice_total_usage = models.IntegerField(default=0, verbose_name='帐期已用语音总量（Min）')
    sms_total_usage = models.IntegerField(default=0, verbose_name='帐期已用短信总量（条）')
    cycle_start_time = models.DateTimeField(null=True, blank=True, verbose_name='帐期开始时间')
    cycle_end_time = models.DateTimeField(null=True, blank=True, verbose_name='帐期结束时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'iot_card_usage_history'
        verbose_name = '物联网卡用量历史'
        verbose_name_plural = verbose_name


class CityInformation(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    city_id = models.IntegerField(default=0, verbose_name='城市id')
    district = models.CharField(default='', max_length=32, verbose_name='区级名称')
    city = models.CharField(default='', max_length=32, verbose_name='市级名称')
    region = models.CharField(default='', max_length=30, verbose_name='省级名称')

    class Meta:
        db_table = 'city_information'
        verbose_name = '城市信息'
        verbose_name_plural = verbose_name


class IotCardOrderUsageHistory(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='列表主键')
    iccid = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'ICCID号')
    order_id = models.CharField(max_length=30, db_index=True, verbose_name='订单ID', blank=True, default='')
    serial_no = models.CharField(max_length=32, default='', verbose_name='设备序列号')
    card_type = models.SmallIntegerField(default=0, verbose_name='卡类型，1:联通,2:电信,3:移动,4:其它,5:国际')
    cycle = models.IntegerField(default=0, verbose_name='帐期 如 202307')
    cycle_date = models.IntegerField(default=0, verbose_name='帐期 如 1-31')
    total_traffic = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=u'订单流量用量(MB)')
    cycle_start_time = models.DateTimeField(null=True, blank=True, verbose_name='帐期开始时间')
    cycle_end_time = models.DateTimeField(null=True, blank=True, verbose_name='帐期结束时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')
    remark = models.CharField(blank=True, default='', max_length=200, verbose_name=u'备注')

    class Meta:
        db_table = 'iot_card_order_usage_history'
        verbose_name = '物联网卡订单用量历史'
        verbose_name_plural = verbose_name


class IPAddr(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    ip = models.CharField(default='', db_index=True, max_length=32, verbose_name='ip')
    district = models.CharField(default='', max_length=32, verbose_name='区')
    city = models.CharField(default='', max_length=32, verbose_name='市')
    region = models.CharField(default='', max_length=32, verbose_name='省/州')
    country_code = models.CharField(default='', max_length=8, verbose_name='国家编码')
    lat = models.FloatField(default=0, verbose_name='经度')
    lon = models.FloatField(default=0, verbose_name='纬度')
    is_geoip2 = models.BooleanField(default=False, verbose_name='是否为geoip2解析')

    class Meta:
        db_table = 'ip_addr'
        verbose_name = 'ip地址信息'


class OpenWeatherMapCallCount(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    month = models.CharField(default='', max_length=20, verbose_name='月份')
    count = models.IntegerField(default=1, verbose_name='api调用次数')

    class Meta:
        db_table = 'open_weather_map_call_count'
        verbose_name = 'OpenWeatherMap调用次数'


class DeviceLiveRestrict(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    device_type = models.IntegerField(default=0, verbose_name='设备类型id')
    device_name = models.CharField(blank=True, max_length=32, verbose_name='设备名称')
    device_info = models.JSONField(null=True, verbose_name='限制设备信息')
    is_del = models.BooleanField(blank=True, default=False, verbose_name=u'是否删除默认false')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'device_live_restrict'
        verbose_name = '设备直播限制表'
        verbose_name_plural = verbose_name


class SerialNumberPackage(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    serial_number = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'设备序列号')
    status = models.SmallIntegerField(default=1, verbose_name='状态，1:可激活,2:已激活')
    package_id = models.IntegerField(default=0, verbose_name='关联4G套餐表id')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(blank=True, max_length=32, verbose_name='创建人')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')
    updated_by = models.CharField(blank=True, max_length=32, verbose_name='修改人')

    class Meta:
        db_table = 'd_serial_number_package'
        verbose_name = '设备序列号关联套餐id表'
        verbose_name_plural = verbose_name


class CustomizedPush(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    title = models.CharField(default='', max_length=64, verbose_name='标题')
    msg = models.TextField(default='', verbose_name='内容')
    link = models.TextField(default='', verbose_name='链接')
    icon_link = models.TextField(default='', verbose_name='预览图链接')
    # 多选国家,设备型号,用逗号分开
    country = models.CharField(default='', max_length=320, verbose_name='国家')
    device_type = models.TextField(default='', verbose_name='设备类型')
    register_period = models.CharField(default='', max_length=32, verbose_name='注册年限')
    time_zone = models.CharField(default='', max_length=8, verbose_name='时区')
    push_time = models.CharField(default='', max_length=32, verbose_name='推送时间')
    push_timestamp = models.IntegerField(default=0, verbose_name='推送时间戳')
    push_app = models.CharField(default='', max_length=64, verbose_name='推送APP')
    # False:待推送, True:已推送
    push_satus = models.BooleanField(default=False, verbose_name='推送状态')

    class Meta:
        db_table = 'customized_push'
        verbose_name = '定制化推送'


class AbnormalOrder(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    order_id = models.CharField(max_length=30, db_index=True, verbose_name='订单ID', blank=True, default='')
    trade_no = models.CharField(blank=True, max_length=32, default='', verbose_name='第三方订单号')
    agreement_id = models.CharField(default='', blank=True, max_length=64, verbose_name=u'paypal协议id')
    # 0: PayPal自动续费, 1: PayPal普通支付, 2: 支付宝, 3: 微信
    pay_type = models.SmallIntegerField(default=0, verbose_name='支付方式')
    price = models.CharField(default='', max_length=16, verbose_name='价格')
    username = models.CharField(default='', max_length=50, verbose_name='用户名')
    pay_time = models.IntegerField(verbose_name='支付成功时间', default=0)
    upd_time = models.IntegerField(verbose_name='更新时间', default=0)
    status = models.SmallIntegerField(default=0, verbose_name='处理结果')  # 0：未处理，1：已处理
    meal_name = models.CharField(default='', blank=True, max_length=32, verbose_name='套餐名')

    class Meta:
        db_table = 'abnormal_order'
        verbose_name = '异常订单表'


class OrderPayLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键'),
    order_id = models.CharField(max_length=30, db_index=True, verbose_name='订单ID', blank=True, default='')
    order_no = models.CharField(max_length=30, verbose_name='订单号', blank=True, default='')
    trans_serial_no = models.CharField(max_length=30, verbose_name='流水号', blank=True, default='')
    business_name = models.CharField(max_length=30, verbose_name='业务名称', blank=True, default='')
    sender = models.CharField(max_length=30, verbose_name='发送方/调用方', blank=True, default='')
    api_url = models.CharField(max_length=64, verbose_name='接口地址', blank=True, default='')
    request_content = models.JSONField(null=True, verbose_name='请求内容')
    response_content = models.JSONField(null=True, verbose_name='响应内容')
    # SUCCESS, FAILED, EXCEPTION, ERROR
    response_times = models.BigIntegerField(verbose_name='接收调用耗时，响应时长，单位ms', default=0)
    access_result = models.CharField(max_length=30, verbose_name='接口调用状态', blank=True, default='')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'order_pay_log'
        verbose_name = '订单支付日志'


class DailyReconciliation(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    order_ids = models.CharField(blank=True, max_length=200, default='', verbose_name='异常订单号列表')
    paypal_total = models.CharField(default='', max_length=16, verbose_name='paypal每日收入')
    paypal_num = models.SmallIntegerField(default=0, verbose_name='paypal每日交易订单数量')
    ansjer_total = models.CharField(default='', max_length=16, verbose_name='后台每日收入')
    ansjer_num = models.SmallIntegerField(default=0, verbose_name='后台每日交易订单数量')
    time = models.IntegerField(verbose_name='日期', default=0)
    creat_time = models.IntegerField(verbose_name='创建时间', default=0)
    upd_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'daily_reconciliation'
        verbose_name = 'paypal每日对账'


class AppAdvertiseCampaign(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    image_url = models.CharField(default='', max_length=256, verbose_name='开屏广告图片url')
    pad_image_url = models.CharField(default='', max_length=256, verbose_name='开屏广告pad端图片url')
    banner_campaign = models.JSONField(default=list, verbose_name='轮播广告')
    campaign_url = models.CharField(default='', max_length=256, verbose_name='活动链接')
    campaign_name = models.CharField(default='', max_length=32, verbose_name='广告名称')
    campaign_type = models.JSONField(default=list, verbose_name='广告类型')  # 1：开屏广告 # 2：轮播广告
    device_type = models.JSONField(default=list, verbose_name='设备类型')
    ex_device_type = models.JSONField(default=list, verbose_name='排除设备类型')
    status = models.SmallIntegerField(default=0, verbose_name='广告状态')  # 0：关闭 1：开启 2：删除
    country = models.ManyToManyField(to="CountryModel", verbose_name='广告地区')
    unknown_country = models.SmallIntegerField(default=0, verbose_name='未知地区')  # 0表示不包括 1表示包括
    app_bundle_type = models.SmallIntegerField(default=0, verbose_name='上架APP')  # 0表示周视 1表示Zosismart
    campaign_start_date = models.IntegerField(default=0, verbose_name='广告开始日期')
    campaign_end_date = models.IntegerField(default=0, verbose_name='广告结束日期')
    campaign_show_stime = models.IntegerField(default=0, verbose_name='当天广告起始时间')
    campaign_show_etime = models.IntegerField(default=0, verbose_name='当天广告结束时间')
    create_time = models.IntegerField(default=0, verbose_name='广告创建时间')
    update_time = models.IntegerField(default=0, verbose_name='广告更新时间')

    class Meta:
        db_table = 'app_advertise_campaign'
        verbose_name = 'App广告活动表'


class OpenScreenCampaign(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    campaign_id = models.ForeignKey(AppAdvertiseCampaign, blank=True, to_field='id', null=True,
                                    on_delete=models.SET_NULL, db_constraint=False)
    user_id = models.CharField(default='', max_length=32, verbose_name='userID')
    status = models.SmallIntegerField(default=0, verbose_name='广告状态')
    # 0未展示 1未跳过 2已跳过 3点击广告
    update_time = models.IntegerField(default=0, verbose_name='更新时间')
    create_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'open_screen_campaign'
        verbose_name = '开屏广告表'


class AlexaOauth(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    user_id = models.CharField(default='', max_length=32, verbose_name='用户id')
    # 0: 未连接,1: 已连接
    link_status = models.PositiveSmallIntegerField(default=0, verbose_name='连接状态')
    alexa_api_endpoint = models.CharField(default='', max_length=32, verbose_name='alexa_api节点')
    amazon_access_token = models.TextField(default='', verbose_name='亚马逊访问令牌')
    amazon_refresh_token = models.TextField(default='', verbose_name='亚马逊刷新令牌')
    create_time = models.IntegerField(default=0, verbose_name='创建时间')
    update_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'alexa_oauth'
        verbose_name = 'Alexa认证信息表'


class AccessNumberTaskQueue(models.Model):
    id = models.AutoField(primary_key=True)
    iccid = models.CharField(db_index=True, max_length=32, verbose_name=u'完整的20位纯数字ICCID')
    access_number = models.CharField(max_length=32, verbose_name=u'接入号码')
    type = models.SmallIntegerField(default=1, verbose_name='操作类型,1:设备状态 2:网络状态')
    action = models.SmallIntegerField(default=1, verbose_name='操作类型,1:断网 2:恢复网络')
    status = models.SmallIntegerField(default=0, verbose_name='任务状态,0:未执行,1:成功,2:失败')
    previous_status = models.SmallIntegerField(default=0, verbose_name='修改前状态,1:断网 2:未断网')
    new_status = models.SmallIntegerField(default=0, verbose_name='修改后状态,1:断网 2:未断网')
    count = models.IntegerField(default=0, verbose_name='执行次数')
    result = models.JSONField(null=True, verbose_name='调用结果')
    reason = models.CharField(max_length=256, verbose_name=u'变更原因')
    completion_time = models.IntegerField(default=0, verbose_name='完成时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='修改时间')

    class Meta:
        db_table = 'access_number_task_queue'
        verbose_name = '接入号码任务队列'
        verbose_name_plural = verbose_name


class TimeZoneInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    tz = models.FloatField(default=0, verbose_name='时区')
    zone_info = models.CharField(default='', max_length=32, verbose_name='地区信息')

    class Meta:
        db_table = 'time_zone_info'
        verbose_name = '时区信息表'


class CNRegion(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    name = models.CharField(max_length=40, null=True, blank=True, verbose_name='区域名称')
    pid = models.IntegerField(null=True, blank=True, verbose_name='区域上级标识')
    sname = models.CharField(max_length=40, null=True, blank=True, verbose_name='地名简称')
    level = models.IntegerField(null=True, blank=True, verbose_name='区域等级')
    citycode = models.CharField(max_length=20, null=True, blank=True, verbose_name='区域编码')
    yzcode = models.CharField(max_length=20, null=True, blank=True, verbose_name='邮政编码')
    mername = models.CharField(max_length=100, null=True, blank=True, verbose_name='组合名称')
    Lng = models.FloatField(null=True, blank=True, verbose_name='经度')
    Lat = models.FloatField(null=True, blank=True, verbose_name='维度')
    pinyin = models.CharField(max_length=100, null=True, blank=True, verbose_name='拼音')

    class Meta:
        db_table = 'tb_cn_region'
        verbose_name = '国内省市区区域表'


class UserEmailSubscriptions(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    user_id = models.CharField(default='', max_length=32, verbose_name='用户id')
    email = models.CharField(default='', max_length=32, verbose_name='邮箱')
    phone = models.CharField(default='', max_length=32, verbose_name='手机号')
    status = models.SmallIntegerField(default=0, verbose_name='订阅状态,0未订阅,1订阅')
    push_sub_status = models.SmallIntegerField(default=0, verbose_name='定制化推送订阅状态,0未订阅,1订阅')
    list_id = models.CharField(default='', max_length=32, verbose_name='订阅列表id')
    sub_result = models.JSONField(null=True, verbose_name='订阅结果')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'user_email_subscriptions'
        verbose_name = '用户邮件订阅记录表'


class UserAudioVideoPush(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(default='', max_length=32, verbose_name='设备UID')
    buttonUser1 = models.CharField(default='', max_length=32, verbose_name='用户按钮1')
    buttonUser2 = models.CharField(default='', max_length=32, verbose_name='用户按钮2')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'user_audio_video_push'
        verbose_name = '用户音视频推送表'


class SerialNumberCheckLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    serial_number = models.CharField(blank=True, db_index=True, max_length=20, default='',
                                     verbose_name='6序列号')
    full_serial_number = models.CharField(blank=True, db_index=True, max_length=20, default='',
                                          verbose_name='完成序列号')
    count = models.IntegerField(default=1, verbose_name='计算')
    # 工位类型,1:三乡总装,2:三乡包装,3:三乡返工,4:三乡管理,5:珠海包装
    type = models.SmallIntegerField(default=0, verbose_name='分类')
    phone_model = models.CharField(max_length=64, default='', verbose_name='手机型号')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'serial_number_check_log'
        verbose_name = '序列号检查日志'
        verbose_name_plural = verbose_name


class SerialNumberRenovateLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    serial_number = models.CharField(blank=True, db_index=True, max_length=20, default='',
                                     verbose_name='6序列号')
    full_serial_number = models.CharField(blank=True, db_index=True, max_length=20, default='',
                                          verbose_name='完成序列号')
    operation_count = models.IntegerField(default=0, verbose_name='计算')
    count = models.IntegerField(default=0, verbose_name='翻新次数')
    # 翻新检查类型,1:翻新前端检查，2.翻新入库检查
    type = models.SmallIntegerField(default=1, verbose_name='翻新操作类型')
    phone_model = models.CharField(max_length=64, default='', verbose_name='手机型号')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'serial_number_renovate_log'
        verbose_name = '序列号翻新日志'
        verbose_name_plural = verbose_name


class RegionRestriction(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增id')
    statusName = models.CharField(max_length=255, unique=True)
    default_status = models.IntegerField(default=0, verbose_name='默认状态')
    country_code = models.JSONField(default=list, verbose_name='限制国家代码')
    region = models.JSONField(default=list, verbose_name='限制省/州')
    city = models.JSONField(default=list, verbose_name='限制市')
    district = models.JSONField(default=list, verbose_name='限制区')
    content = models.TextField(default='', verbose_name='备注')

    def __str__(self):
        return self.statusName

    class Meta:
        db_table = 'region_restriction'
        verbose_name = '地区筛选状态'


class DeviceWallpaper(models.Model):
    id = models.AutoField(primary_key=True)
    device_type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    storage_type = models.SmallIntegerField(default=1, verbose_name='存储类型,1:AWS,2:华为云')
    obj_name = models.CharField(max_length=120, default='', verbose_name='对象地址')
    obj_prefix = models.CharField(max_length=120, default='', verbose_name='对象前缀')
    classification = models.SmallIntegerField(default=1, verbose_name='语音分类。1：系统，2：自定义')
    uid = models.CharField(max_length=32, default='', db_index=True, verbose_name='关联设备UID')
    channel = models.IntegerField(default=0, verbose_name='通道号')
    status = models.SmallIntegerField(default=1, verbose_name='是否启用。0：不启用，1：启用')
    parent_id = models.IntegerField(default=0, verbose_name='父节点ID')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'device_wallpaper'
        verbose_name = '设备壁纸'
        verbose_name_plural = verbose_name


class StsFrequency(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    frequency = models.IntegerField(verbose_name='频率', default=0)
    type = models.SmallIntegerField(default=1, verbose_name='预警类型')  # 1:sts 2:token
    addTime = models.IntegerField(verbose_name='添加时间', default=0)
    updateTime = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'sts_frequency'
        verbose_name = 'sts统计表'
        verbose_name_plural = verbose_name
        ordering = ('id',)


class InAppPurchasePackage(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    subscription_group_id = models.CharField(default='', max_length=64, verbose_name='内购订阅组id')
    subscription_group = models.CharField(default='', max_length=64, verbose_name='内购订阅组')
    product_id = models.CharField(default='', max_length=64, verbose_name='内购商品id')
    package_type = models.SmallIntegerField(default=0, verbose_name='套餐类型')  # 0:非订阅, 1:订阅
    rank = models.ForeignKey(Store_Meal, blank=True, to_field='id', null=True, on_delete=models.SET_NULL,
                             verbose_name='关联云存套餐表')
    is_ai = models.SmallIntegerField(default=0, verbose_name='是否支持ai')  # 0:不支持, 1:支持
    is_coupon = models.SmallIntegerField(default=0, verbose_name='是否优惠套餐')  # 0:不是优惠套餐, 1:是优惠套餐
    app_type = models.SmallIntegerField(default=1, verbose_name='APP来源')  # 1：zosi，2：vsees
    created_time = models.IntegerField(verbose_name='创建时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'in_app_purchase_package'
        verbose_name = '苹果内购订阅套餐表'


class DeviceApplePackage(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    userID = models.CharField(default='', max_length=64, verbose_name='用户id')
    uid = models.CharField(max_length=20, verbose_name='设备UID', db_index=True)
    package_id = models.ForeignKey(InAppPurchasePackage, blank=True, to_field='id', null=True,
                                   on_delete=models.SET_NULL, verbose_name='关联苹果内购订阅套餐表')
    subscription_status = models.SmallIntegerField(default=0, verbose_name='订阅状态')  # 0:未订阅, 1:订阅 2:订阅已过期 3:取消订阅
    original_transaction_id = models.CharField(default='', blank=True, max_length=64,
                                               verbose_name=u'苹果内购originalTransactionId')
    created_time = models.IntegerField(verbose_name='创建时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'device_apple_package'
        verbose_name = '设备绑定内购套餐表'


class FreeEvaluationActivity(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    activity_name = models.CharField(default='', max_length=64, verbose_name='活动名称')
    product_name = models.CharField(default='', max_length=20, verbose_name='产品名')
    carousel_image_url = models.TextField(default='', verbose_name='轮播图地址')
    details_image_url = models.TextField(default='', verbose_name='详情图地址')
    issue = models.SmallIntegerField(default=0, verbose_name='活动期数')
    product_number = models.SmallIntegerField(default=0, verbose_name='物品数量')
    original_price = models.CharField(default='0', max_length=10, verbose_name='物品原价')
    is_show = models.SmallIntegerField(default=0, verbose_name='是否展示')  # 0:不展示；1：展示
    created_time = models.IntegerField(verbose_name='创建时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'free_evaluation_activity'
        verbose_name = '新品体验官'


class ActivityTime(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    activity_id = models.IntegerField(default=0, verbose_name='关联活动id')
    node_content = models.CharField(default='', max_length=10, verbose_name='节点内容')
    start_time = models.IntegerField(verbose_name='开始时间', default=0)
    end_time = models.IntegerField(verbose_name='结束时间', default=0)
    sort = models.SmallIntegerField(verbose_name='排序', default=0)

    class Meta:
        db_table = 'activity_time'
        verbose_name = '活动时间表'


class ActivityUser(models.Model):
    id = models.AutoField(primary_key=True, verbose_name=u'自增标记ID')
    activity_id = models.IntegerField(default=0, verbose_name='关联活动id')
    user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id')
    user_name = models.CharField(default='', max_length=15, verbose_name='用户名')
    phone = models.CharField(default='', max_length=15, verbose_name='手机号')
    address = models.CharField(default='', max_length=50, verbose_name='用户地址')
    sex = models.SmallIntegerField(verbose_name='性别', default=0)  # 0:女；1：男
    age = models.SmallIntegerField(verbose_name='年龄', default=0)
    usage_environment = models.CharField(default='', max_length=50, verbose_name='使用环境')
    is_reports = models.SmallIntegerField(verbose_name='是否输出过体验报告', default=0)  # 0：未输出；1：输出过
    is_selected = models.SmallIntegerField(verbose_name='是否入选', default=0)  # 0：未入选；1：入选
    created_time = models.IntegerField(verbose_name='创建时间', default=0)
    update_time = models.IntegerField(verbose_name='更新时间', default=0)

    class Meta:
        db_table = 'activity_user'
        verbose_name = '活动人员表'


class PushLog(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    uid = models.CharField(max_length=32, default='', db_index=True, verbose_name='设备UID')
    event_type = models.CharField(default='', max_length=100, verbose_name='事件类型')
    push_type = models.SmallIntegerField(default=0, verbose_name='推送类型')
    push_result = models.BooleanField(default=False, verbose_name='推送结果')
    content = models.TextField(default='', verbose_name='推送字段值')
    created_time = models.IntegerField(default=0, verbose_name='触发时间')

    class Meta:
        db_table = 'push_log'
        verbose_name = '推送日志'
        app_label = 'PushModel'


class CustomCustomerOrderInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    order_number = models.CharField(default='', db_index=True, max_length=32, verbose_name=u'生产编号')
    name = models.EmailField(max_length=64, db_index=True, verbose_name=u'用户名', default='', blank=True)
    email = models.EmailField(max_length=64, verbose_name=u'邮箱', default='', blank=True)
    country_id = models.IntegerField(blank=True, default=0, verbose_name='国家')
    quantity = models.IntegerField(default=0, verbose_name='数量')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'custom_customer_order_info'
        verbose_name = '定制客户信息'


class CustomCustomerDevice(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    c_id = models.IntegerField(default=0, verbose_name=u'关联定制客户id')
    serial_number = models.CharField(blank=True, max_length=9, default='', verbose_name='关联序列号')
    uid = models.CharField(blank=True, max_length=32, default='', verbose_name='关联uid')
    type = models.IntegerField(default=0, blank=True, verbose_name=u'设备类型')
    full_code = models.EmailField(max_length=64, db_index=True, verbose_name=u'完整编码(app扫的完整数据)', default='',
                                  blank=True)
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'custom_customer_device'
        verbose_name = '定制客户设备'


class SerialUnbindUID(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    serial = models.CharField(default='', max_length=9, db_index=True, verbose_name='序列号')
    uid = models.CharField(default='', max_length=32, verbose_name='设备uid')
    # 0: 未清除uid数据, 1: 已清除uid数据
    status = models.IntegerField(default=0, verbose_name='状态')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'unbound_serial'
        verbose_name = '序列号解绑uid'


class UserSetStatus(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    user_id = models.CharField(default='', max_length=32, verbose_name='关联用户id', db_index=True)
    region_restriction_id = models.ForeignKey(RegionRestriction, blank=True, to_field='id', null=True,
                                              on_delete=models.SET_NULL, verbose_name='关联地区筛选状态表')
    status = models.IntegerField(default=0, verbose_name='状态')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    end_time = models.IntegerField(default=0, verbose_name='结束时间')

    class Meta:
        db_table = 'user_set_status'
        verbose_name = '用户设置状态'


class InAppRefund(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    uid = models.CharField(default='', max_length=32, db_index=True, verbose_name='设备uid')
    transaction_id = models.CharField(default='', max_length=32, verbose_name='苹果事务id')
    orderID = models.CharField(blank=True, max_length=20, verbose_name=u'订单id')
    app_type = models.SmallIntegerField(default=0, verbose_name='应用类型')  # 1是zosiSmart 2是Vsees
    # 0不同意 1同意
    refund_preference = models.IntegerField(default=0, verbose_name='是否同意退款')
    # 0申请退款 1已提交退款建议 2退款成功 3退款失败 4提前添加退款建议
    refund_progress = models.IntegerField(default=0, verbose_name='退款进度')
    app_account_token = models.TextField(blank=True, default='', verbose_name=u'参数内容')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    put_time = models.IntegerField(default=0, verbose_name='提交时间')

    class Meta:
        db_table = 'in_app_refund'
        verbose_name = '退款状态'


class DeviceVersionInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    d_code = models.CharField(max_length=32, verbose_name='设备产品码', default='')
    software_ver = models.CharField(max_length=32, verbose_name='设备版本', default='')
    firmware_ver = models.CharField(max_length=32, verbose_name='固件版本', default='')
    video_code = models.SmallIntegerField(default=0, verbose_name='编码类型')  # 0:264,1:265
    region_alexa = models.CharField(max_length=8, verbose_name='设备Alexa区域', default='ALL',
                                    null=True)  # ALL, CN, EU, US
    supports_human_tracking = models.BooleanField(default=False, verbose_name='是否支持人形追踪')
    supports_custom_voice = models.BooleanField(default=False, verbose_name='是否支持自定义语音')
    supports_dual_band_wifi = models.BooleanField(default=False, verbose_name='是否支持双频Wifi')
    supports_four_point = models.BooleanField(default=False, verbose_name='是否支持预置点')
    supports_4g = models.BooleanField(default=False, verbose_name='是否支持4G')
    supports_ptz = models.BooleanField(default=False, verbose_name='是否支持云台')
    supports_ai = models.BooleanField(default=False, verbose_name='是否支持AI')
    supports_cloud_storage = models.BooleanField(default=False, verbose_name='是否支持云存储')
    supports_alexa = models.BooleanField(default=False, verbose_name='是否支持Alexa')
    device_type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    resolution = models.CharField(max_length=20, verbose_name='分辨率', default='')
    ai_type = models.IntegerField(default=0, verbose_name='检测类型')  # 智能算法值
    supports_alarm = models.SmallIntegerField(default=-1, verbose_name='是否支持声光报警')
    supports_night_vision = models.SmallIntegerField(default=-1, verbose_name='是否支持夜视模式')
    screen_channels = models.IntegerField(default=1, verbose_name='屏幕通道数')  # 默认为0
    network_type = models.IntegerField(default=1, verbose_name='网络类型')  # 1：无线，2：有线，3：无线+有线,4:4G
    other_features = models.JSONField(null=True, verbose_name='其它功能')
    electricity_statistics = models.IntegerField(default=0, verbose_name='电量显示')
    supports_pet_tracking = models.SmallIntegerField(default=0, verbose_name='是否支持宠物追踪')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_version_info'
        verbose_name = '设备版本信息'


class VodHlsBase(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    uid = models.CharField(max_length=20, db_index=True, verbose_name='uid')
    channel = models.SmallIntegerField(default=0, verbose_name='通道')
    start_time = models.IntegerField(default=0, db_index=True, verbose_name='开始时间')
    end_time = models.IntegerField(default=0, db_index=True, verbose_name='结束时间')
    sec = models.IntegerField(default=0, verbose_name='秒数')
    bucket_id = models.SmallIntegerField(default=1, blank=True, verbose_name='关联vod_bucket表id')
    fg = models.CharField(default='', max_length=20, verbose_name='ts文件信息数据')

    def __str__(self):
        return self.id

    class Meta:
        db_table = 'vod_hls_base'
        verbose_name = '云存回放信息表'
        ordering = ('-id',)
        abstract = True


class VodHls01(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_01'
        verbose_name = '云存回放信息表01'


class VodHls02(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_02'
        verbose_name = '云存回放信息表02'


class VodHls03(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_03'
        verbose_name = '云存回放信息表03'


class VodHls04(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_04'
        verbose_name = '云存回放信息表04'


class VodHls05(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_05'
        verbose_name = '云存回放信息表05'


class VodHls06(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_06'
        verbose_name = '云存回放信息表06'


class VodHls07(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_07'
        verbose_name = '云存回放信息表07'


class VodHls08(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_08'
        verbose_name = '云存回放信息表08'


class VodHls09(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_09'
        verbose_name = '云存回放信息表09'


class VodHls10(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_10'
        verbose_name = '云存回放信息表10'


class VodHls11(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_11'
        verbose_name = '云存回放信息表11'


class VodHls12(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_12'
        verbose_name = '云存回放信息表12'


class VodHls13(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_13'
        verbose_name = '云存回放信息表13'


class VodHls14(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_14'
        verbose_name = '云存回放信息表14'


class VodHls15(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_15'
        verbose_name = '云存回放信息表15'


class VodHls16(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_16'
        verbose_name = '云存回放信息表16'


class VodHls17(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_17'
        verbose_name = '云存回放信息表17'


class VodHls18(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_18'
        verbose_name = '云存回放信息表18'


class VodHls19(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_19'
        verbose_name = '云存回放信息表19'


class VodHls20(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_20'
        verbose_name = '云存回放信息表20'


class VodHls21(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_21'
        verbose_name = '云存回放信息表21'


class VodHls22(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_22'
        verbose_name = '云存回放信息表22'


class VodHls23(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_23'
        verbose_name = '云存回放信息表23'


class VodHls24(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_24'
        verbose_name = '云存回放信息表24'


class VodHls25(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_25'
        verbose_name = '云存回放信息表25'


class VodHls26(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_26'
        verbose_name = '云存回放信息表26'


class VodHls27(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_27'
        verbose_name = '云存回放信息表27'


class VodHls28(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_28'
        verbose_name = '云存回放信息表28'


class VodHls29(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_29'
        verbose_name = '云存回放信息表29'


class VodHls30(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_30'
        verbose_name = '云存回放信息表30'


class VodHls31(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_31'
        verbose_name = '云存回放信息表31'


class VodHls32(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_32'
        verbose_name = '云存回放信息表32'


class VodHls33(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_33'
        verbose_name = '云存回放信息表33'


class VodHls34(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_34'
        verbose_name = '云存回放信息表34'


class VodHls35(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_35'
        verbose_name = '云存回放信息表35'


class VodHls36(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_36'
        verbose_name = '云存回放信息表36'


class VodHls37(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_37'
        verbose_name = '云存回放信息表37'


class VodHls38(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_38'
        verbose_name = '云存回放信息表38'


class VodHls39(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_39'
        verbose_name = '云存回放信息表39'


class VodHls40(VodHlsBase):
    class Meta:
        db_table = 'vod_hls_40'
        verbose_name = '云存回放信息表40'


class WeChatMiniProgram(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    login_status = models.CharField(default='', max_length=128, verbose_name='自定义登录态')
    openid = models.CharField(default='', max_length=32, verbose_name='用户唯一标识')
    unionid = models.CharField(default='', max_length=32, verbose_name='用户在开放平台的唯一标识符')
    session_key = models.CharField(default='', max_length=150, verbose_name='会话密钥')
    phone_number = models.CharField(default='', max_length=32, verbose_name='手机号')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'wechat_mini_program'
        verbose_name = '微信小程序'


class CountryAPN(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    iso = models.CharField(max_length=100, verbose_name="国家代码")
    apn_name = models.CharField(max_length=100, verbose_name="APN名称")
    apn_address = models.CharField(max_length=100, verbose_name="APN地址")
    username = models.CharField(max_length=100, blank=True, null=True, verbose_name="用户名")
    password = models.CharField(max_length=100, blank=True, null=True, verbose_name="密码")
    # 鉴权类型: 无、PAP、CHAP、PAP\PHCP
    auth_type = models.CharField(max_length=50, blank=True, null=True, verbose_name="APN鉴权类型")
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'country_apn'
        verbose_name = 'APN配置表'


class DeviceGroup(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    user_id = models.CharField(default='', max_length=32, verbose_name='用户id')
    group_name = models.CharField(default='', max_length=32, verbose_name='组名')

    class Meta:
        db_table = 'device_group'
        verbose_name = '设备分组'


class DeviceNetInfo(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    device_id = models.CharField(default='', max_length=32, verbose_name='关联设备信息表id')
    wifi_name = models.CharField(default='', max_length=64, verbose_name='wifi名称')
    wifi_password = models.CharField(default='', max_length=64, verbose_name='wifi密码')

    class Meta:
        db_table = 'device_net_info'
        verbose_name = '设备网络信息'


class DeviceDailyReport(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    device_id = models.CharField(default='', max_length=32, verbose_name='设备ID')
    type = models.SmallIntegerField(default=0, verbose_name=u'统计类型0:默认1:电耗统计')
    battery_level = models.IntegerField(default=0, verbose_name='23:59电量百分比')
    report_date = models.DateTimeField(blank=True, null=True, verbose_name=u'统计日期时间')
    report_time = models.IntegerField(default=0, verbose_name='设备上报时间戳')
    human_detection = models.IntegerField(default=0, verbose_name='人形检测次数')
    working_hours = models.IntegerField(default=0, verbose_name='工作时长/秒')
    wake_sleep = models.IntegerField(default=0, verbose_name='唤醒休眠次数')
    pir_wakeup_count = models.IntegerField(default=0, verbose_name='PIR唤醒次数')
    mqtt_wakeup_count = models.IntegerField(default=0, verbose_name='mqtt唤醒次数')
    channel = models.IntegerField(default=1, blank=True, verbose_name=u'设备通道')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'device_daily_report'
        verbose_name = '设备日报记录表'
        verbose_name_plural = verbose_name
        app_label = 'PushModel'


class AbnormalEvent(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    uid = models.CharField(default='', max_length=20, verbose_name='uid')
    device_type = models.IntegerField(default=0, verbose_name='设备类型')
    version = models.CharField(default='', max_length=64, verbose_name='设备版本')
    event_code = models.CharField(default='', max_length=16, verbose_name='异常事件编码')
    content = models.TextField(default='', verbose_name='异常内容')
    event_time = models.IntegerField(default=0, verbose_name='异常事件触发时间')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')

    class Meta:
        db_table = 'abnormal_event'
        verbose_name = '异常事件'
        app_label = 'PushModel'


class AbnormalEventCode(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    event_code = models.CharField(default='', max_length=16, verbose_name='异常事件编码')
    event = models.CharField(default='', max_length=16, verbose_name='异常事件')

    class Meta:
        db_table = 'abnormal_event_code'
        verbose_name = '异常事件编码'
        app_label = 'PushModel'


class BaiduBigModelLicense(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    serial = models.CharField(default='', max_length=9, verbose_name='序列号')
    license_name = models.CharField(default='', max_length=32, verbose_name='许可证名称')
    # 使用状态,0: 未使用, 1: 已使用
    use_status = models.PositiveSmallIntegerField(default=0, verbose_name='使用状态')
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')

    class Meta:
        db_table = 'baidu_big_model_license'
        verbose_name = '百度大模型许可证'


class DictCategory(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    code = models.CharField(max_length=50, unique=True, verbose_name="类别编码")
    # 1:表示后台 2:表示APP 3:表示其他程序
    scenes = models.IntegerField(default=1, verbose_name="应用场景")
    status = models.BooleanField(default=True, verbose_name="是否启用")
    ext_data = models.JSONField(null=True, verbose_name='额外配置')
    remark = models.TextField(blank=True, verbose_name="备注")

    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(max_length=50, blank=True, verbose_name="创建人")
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    updated_by = models.CharField(max_length=50, blank=True, verbose_name="更新人")

    class Meta:
        db_table = 'dict_category'
        verbose_name = '通用数据字典主表'


class DictItem(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    category = models.ForeignKey(DictCategory, related_name='items', on_delete=models.CASCADE, verbose_name="类别id")
    code = models.CharField(max_length=100, verbose_name="选项编码")
    sort = models.IntegerField(default=0, verbose_name="排序")
    status = models.BooleanField(default=True, verbose_name="是否启用")
    remark = models.TextField(blank=True, verbose_name="备注")

    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(max_length=50, blank=True, verbose_name="创建人")
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    updated_by = models.CharField(max_length=50, blank=True, verbose_name="更新人")

    class Meta:
        db_table = 'dict_item'
        unique_together = ('category', 'code')
        verbose_name = '通用数据字典子表'


class DictCategoryI18n(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    category = models.ForeignKey(DictCategory, related_name='translations', on_delete=models.CASCADE,
                                 verbose_name="类别id")
    lang_code = models.CharField(max_length=10, verbose_name="语言代码")
    name = models.CharField(max_length=100, verbose_name="类别名称")
    remark = models.TextField(blank=True, verbose_name="备注")

    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(max_length=50, blank=True, verbose_name="创建人")
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    updated_by = models.CharField(max_length=50, blank=True, verbose_name="更新人")

    class Meta:
        db_table = 'dict_category_i18n'
        unique_together = ('category', 'lang_code')
        verbose_name = "系统多语言表"


class DictItemI18n(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    item = models.ForeignKey(DictItem, related_name='translations', on_delete=models.CASCADE, verbose_name="选项id")
    lang_code = models.CharField(max_length=10, verbose_name="语言代码")
    name = models.CharField(max_length=100, verbose_name="选项名称")
    remark = models.TextField(blank=True, verbose_name="备注")

    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(max_length=50, blank=True, verbose_name="创建人")
    updated_time = models.IntegerField(default=0, verbose_name='更新时间')
    updated_by = models.CharField(max_length=50, blank=True, verbose_name="更新人")

    class Meta:
        db_table = 'dict_item_i18n'
        unique_together = ('item', 'lang_code')
        verbose_name = "字典项多语言表"


class ProductsScheme(models.Model):
    id = models.AutoField(primary_key=True, verbose_name='自增标记ID')
    order_number = models.CharField(max_length=100, verbose_name='关联制作单号', blank=True)
    storage_code = models.CharField(max_length=50,unique=True,verbose_name='入库编码')
    device_type = models.SmallIntegerField(default=0, verbose_name='设备类型')
    flash = models.CharField(max_length=50, verbose_name='闪存', blank=True)
    ddr = models.CharField(max_length=50, verbose_name='DDR', blank=True)
    main_controller = models.CharField(max_length=50, verbose_name='主控', blank=True)
    wifi = models.CharField(max_length=50, verbose_name='Wifi', blank=True)
    four_g = models.CharField(max_length=50, verbose_name='4G', blank=True)
    ad = models.CharField(max_length=50, verbose_name='AD', blank=True)
    sensor = models.CharField(max_length=50, verbose_name='传感器', blank=True)
    order_quantity = models.IntegerField(verbose_name='订单数量', default=0)
    remark = models.TextField(blank=True, verbose_name="备注")
    created_time = models.IntegerField(default=0, verbose_name='创建时间')
    created_by = models.CharField(max_length=64, verbose_name='创建人')
    updated_time = models.IntegerField(default=0, verbose_name='创建时间')
    updated_by = models.CharField(max_length=64, blank=True, verbose_name="更新人")
    deleted = models.BooleanField(default=False, verbose_name='逻辑删除')

    class Meta:
        db_table = 'products_scheme'
        verbose_name = "产品方案"
