43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from tortoise import fields
|
|
from tortoise.models import Model
|
|
|
|
|
|
class BaseKeyword(Model):
|
|
id = fields.IntField(pk=True)
|
|
city = fields.CharField(max_length=64)
|
|
job = fields.CharField(max_length=128)
|
|
last_requested_date = fields.DateField(null=True)
|
|
last_requested_at = fields.DatetimeField(null=True)
|
|
|
|
# 爬取状态管理
|
|
crawl_status = fields.CharField(max_length=16, default="idle")
|
|
last_completed_page = fields.IntField(default=0)
|
|
total_pages = fields.IntField(default=0)
|
|
jobs_found = fields.IntField(default=0)
|
|
crawl_started_at = fields.DatetimeField(null=True)
|
|
crawler_id = fields.CharField(max_length=64, default="")
|
|
error_message = fields.TextField(default="")
|
|
retry_count = fields.IntField(default=0)
|
|
|
|
created_at = fields.DatetimeField(auto_now_add=True)
|
|
updated_at = fields.DatetimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
|
|
class BossKeyword(BaseKeyword):
|
|
class Meta:
|
|
table = "boss_keyword"
|
|
|
|
|
|
class QcwyKeyword(BaseKeyword):
|
|
class Meta:
|
|
table = "qcwy_keyword"
|
|
|
|
|
|
class ZhilianKeyword(BaseKeyword):
|
|
class Meta:
|
|
table = "zhilian_keyword"
|
|
|