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.
36 lines
1.4 KiB
36 lines
1.4 KiB
# -*- coding: utf-8 -*-
|
|
|
|
from typing import Optional, Iterable
|
|
|
|
from tortoise import fields, BaseDBAsyncClient
|
|
from tortoise.models import Model
|
|
import utils.date_format as date_format
|
|
|
|
|
|
class MonitorTask(Model):
|
|
"""
|
|
任务实体
|
|
"""
|
|
id = fields.IntField(pk=True, autoincrement=True, description="ID")
|
|
keyword = fields.CharField(null=True, max_length=255, description="关键词")
|
|
lang = fields.CharField(null=True, max_length=50, description="语言")
|
|
platform = fields.CharField(null=True, max_length=30, description="媒体平台")
|
|
gather_date = fields.CharField(null=True, max_length=30, description="采集日期")
|
|
gather_time = fields.CharField(null=True, max_length=30, description="采集时间")
|
|
setting_time = fields.CharField(null=True, max_length=30, description="设定时间")
|
|
status = fields.IntField(null=True, max_length=1, description="任务状态 1 待执行 2 进行中 3 已完成")
|
|
create_time = fields.BigIntField(null=True, max_length=16, description="创建时间")
|
|
update_time = fields.BigIntField(null=True, max_length=16, description="更新时间")
|
|
|
|
class Meta:
|
|
table = "aux_monitor_task"
|
|
|
|
async def _pre_save(
|
|
self,
|
|
using_db: Optional[BaseDBAsyncClient] = None,
|
|
update_fields: Optional[Iterable[str]] = None,
|
|
) -> None:
|
|
if not self.id:
|
|
self.create_time = date_format.timestamp()
|
|
self.update_time = date_format.timestamp()
|
|
|