You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
954 B
29 lines
954 B
from tortoise import fields, models
|
|
|
|
from conf import setting
|
|
|
|
|
|
class Terminal(models.Model):
|
|
id = fields.UUIDField(pk=True)
|
|
name = fields.CharField(null=True, max_length=255, description='终端名称')
|
|
title = fields.CharField(null=True, max_length=255, description='终端标题')
|
|
login_count = fields.SmallIntField(default=1, description='核验账号数')
|
|
index_of_user = fields.SmallIntField(description='以第几人为使用者')
|
|
|
|
created_at = fields.DatetimeField(auto_now_add=True)
|
|
updated_at = fields.DatetimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
table = 'terminals'
|
|
table_description = '终端表'
|
|
|
|
def as_json(self):
|
|
return dict(
|
|
name=self.name,
|
|
title=self.title,
|
|
login_count=self.login_count,
|
|
login_attempt_duration=setting.LOGIN_ATTEMPT_DURATION,
|
|
params=self.params,
|
|
index_of_user=self.index_of_user,
|
|
)
|