2025-04-30 16:57:46 +08:00
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
接口定义历史模型
|
|
|
|
|
对应interfacedefhistory表
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import datetime
|
|
|
|
|
from sqlalchemy import Column, String, Integer, DateTime, UniqueConstraint, Index
|
|
|
|
|
from sqlalchemy.dialects.mysql import LONGTEXT
|
|
|
|
|
from data.models.base import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InterfaceDefHistory(BaseModel):
|
|
|
|
|
"""
|
|
|
|
|
接口定义历史模型
|
|
|
|
|
对应interfacedefhistory表
|
|
|
|
|
功能:存储系统接口的定义和版本历史
|
|
|
|
|
"""
|
2025-07-14 10:29:37 +08:00
|
|
|
|
__tablename__ = 'vwed_interfacedefhistory'
|
2025-04-30 16:57:46 +08:00
|
|
|
|
|
|
|
|
|
# 唯一约束和索引
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
UniqueConstraint('method', 'url', 'version', name='uniq'),
|
|
|
|
|
Index('idx_interfacedefhistory_method', 'method'),
|
|
|
|
|
Index('idx_interfacedefhistory_url', 'url'),
|
|
|
|
|
Index('idx_interfacedefhistory_version', 'version'),
|
|
|
|
|
Index('idx_interfacedefhistory_created_at', 'created_at'),
|
|
|
|
|
{
|
|
|
|
|
'mysql_engine': 'InnoDB',
|
|
|
|
|
'mysql_charset': 'utf8mb4',
|
|
|
|
|
'mysql_collate': 'utf8mb4_general_ci',
|
|
|
|
|
'info': {'order_by': 'created_at DESC'}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
id = Column(String(255), primary_key=True, nullable=False, comment='接口定义历史记录ID')
|
|
|
|
|
detail = Column(LONGTEXT, comment='接口详细定义(JSON格式)')
|
2025-07-14 10:29:37 +08:00
|
|
|
|
name = Column(String(255), nullable=False,comment='接口名称')
|
|
|
|
|
method = Column(String(255), nullable=False, comment='请求方法(GET, POST)')
|
|
|
|
|
is_mobile_ask = Column(Integer, comment='是否为手持端任务(0:否,1:是)')
|
2025-04-30 16:57:46 +08:00
|
|
|
|
url = Column(String(255), nullable=False, comment='接口URL')
|
|
|
|
|
version = Column(Integer, comment='版本号')
|
2025-07-14 10:29:37 +08:00
|
|
|
|
type = Column(Integer, comment='接口类型 (1:公共接口,2:手持端接口)')
|
2025-04-30 16:57:46 +08:00
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
return f"<InterfaceDefHistory(id='{self.id}', method='{self.method}', url='{self.url}', version='{self.version}')>"
|