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.
39 lines
1.7 KiB
39 lines
1.7 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 MonitorResult(Model):
|
|
"""
|
|
结果实体
|
|
"""
|
|
id = fields.IntField(pk=True, autoincrement=True, description="ID")
|
|
keyword = fields.CharField(null=True, max_length=120, description="关键词")
|
|
title = fields.CharField(null=True, max_length=255, description="文章标题")
|
|
url = fields.CharField(null=True, max_length=500, description="文章地址")
|
|
publish_time = fields.BigIntField(null=True, max_length=20, description="发布时间")
|
|
platform = fields.CharField(null=True, max_length=20, description="平台")
|
|
gather_time = fields.CharField(null=True, description="设定采集时间", max_length=30)
|
|
content = fields.TextField(null=True, description="文章内容")
|
|
image = fields.CharField(null=True, max_length=255, description="结果截图")
|
|
is_del = fields.IntField(null=True, max_length=1, description="删除状态")
|
|
create_time = fields.BigIntField(null=True, max_length=20, description="创建时间")
|
|
update_time = fields.BigIntField(null=True, max_length=20, description="更新时间")
|
|
delete_time = fields.BigIntField(null=True, max_length=20, description="删除时间")
|
|
|
|
class Meta:
|
|
table = "aux_monitor_result"
|
|
|
|
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()
|
|
|