refactor(用户管理): 优化用户列表查询和备注字段处理 feat(估值): 评估报告和证书URL改为数组类型并添加下载地址 docs: 添加交易管理与用户备注功能增强实施计划 fix(邮件): 修复邮件发送接口的多附件支持问题 style: 清理注释代码和格式化文件
67 lines
3.7 KiB
Python
67 lines
3.7 KiB
Python
from tortoise import fields
|
|
|
|
from .base import BaseModel, TimestampMixin
|
|
|
|
|
|
class InvoiceHeader(BaseModel, TimestampMixin):
|
|
app_user_id = fields.IntField(null=True, description="App用户ID", index=True)
|
|
company_name = fields.CharField(max_length=128, description="公司名称", index=True)
|
|
tax_number = fields.CharField(max_length=32, description="公司税号", index=True)
|
|
register_address = fields.CharField(max_length=256, description="注册地址")
|
|
register_phone = fields.CharField(max_length=32, description="注册电话")
|
|
bank_name = fields.CharField(max_length=128, description="开户银行")
|
|
bank_account = fields.CharField(max_length=64, description="银行账号")
|
|
email = fields.CharField(max_length=128, description="接收邮箱")
|
|
is_default = fields.BooleanField(default=False, description="是否默认抬头", index=True)
|
|
|
|
class Meta:
|
|
table = "invoice_header"
|
|
table_description = "发票抬头"
|
|
|
|
|
|
class Invoice(BaseModel, TimestampMixin):
|
|
ticket_type = fields.CharField(max_length=16, description="票据类型: electronic|paper", index=True)
|
|
invoice_type = fields.CharField(max_length=16, description="发票类型: special|normal", index=True)
|
|
phone = fields.CharField(max_length=20, description="手机号", index=True)
|
|
email = fields.CharField(max_length=128, description="接收邮箱")
|
|
company_name = fields.CharField(max_length=128, description="公司名称", index=True)
|
|
tax_number = fields.CharField(max_length=32, description="公司税号", index=True)
|
|
register_address = fields.CharField(max_length=256, description="注册地址")
|
|
register_phone = fields.CharField(max_length=32, description="注册电话")
|
|
bank_name = fields.CharField(max_length=128, description="开户银行")
|
|
bank_account = fields.CharField(max_length=64, description="银行账号")
|
|
status = fields.CharField(max_length=16, description="状态: pending|invoiced|rejected|refunded", index=True, default="pending")
|
|
app_user_id = fields.IntField(null=True, description="App用户ID", index=True)
|
|
header = fields.ForeignKeyField("models.InvoiceHeader", related_name="invoices", null=True, description="抬头关联")
|
|
wechat = fields.CharField(max_length=64, null=True, description="微信号", index=True)
|
|
|
|
class Meta:
|
|
table = "invoice"
|
|
table_description = "发票记录"
|
|
|
|
|
|
class PaymentReceipt(BaseModel, TimestampMixin):
|
|
invoice = fields.ForeignKeyField("models.Invoice", related_name="receipts", description="关联发票")
|
|
url = fields.CharField(max_length=512, description="付款凭证图片地址")
|
|
note = fields.CharField(max_length=256, null=True, description="备注")
|
|
verified = fields.BooleanField(default=False, description="是否已核验")
|
|
extra = fields.JSONField(null=True, description="额外信息:邮件发送相关")
|
|
|
|
class Meta:
|
|
table = "payment_receipt"
|
|
table_description = "对公转账付款凭证"
|
|
|
|
|
|
class EmailSendLog(BaseModel, TimestampMixin):
|
|
email = fields.CharField(max_length=255, description="目标邮箱", index=True)
|
|
subject = fields.CharField(max_length=255, null=True, description="主题")
|
|
body_summary = fields.CharField(max_length=512, null=True, description="正文摘要")
|
|
file_name = fields.CharField(max_length=255, null=True, description="附件文件名")
|
|
file_url = fields.CharField(max_length=512, null=True, description="附件URL")
|
|
status = fields.CharField(max_length=16, description="状态: OK|FAIL", index=True)
|
|
error = fields.TextField(null=True, description="错误信息")
|
|
|
|
class Meta:
|
|
table = "email_send_log"
|
|
table_description = "邮件发送日志"
|