合并login

Change-Id: Ie06ed019cbb00d52e0b9e1f3c7a56c947b57a42c
diff --git a/Merge/back_trm/app/models/__pycache__/logs.cpython-310.pyc b/Merge/back_trm/app/models/__pycache__/logs.cpython-310.pyc
new file mode 100644
index 0000000..f1e86e3
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/logs.cpython-310.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/syscost.cpython-310.pyc b/Merge/back_trm/app/models/__pycache__/syscost.cpython-310.pyc
new file mode 100644
index 0000000..9831ffd
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/syscost.cpython-310.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/logs.py b/Merge/back_trm/app/models/logs.py
new file mode 100644
index 0000000..ac8cf1c
--- /dev/null
+++ b/Merge/back_trm/app/models/logs.py
@@ -0,0 +1,19 @@
+from sqlalchemy import Column, BigInteger, Integer, Enum, Text, String, TIMESTAMP, ForeignKey, Index
+from sqlalchemy.sql import func
+from . import Base  # adjust if Base lives elsewhere
+
+class Log(Base):
+    __tablename__ = 'logs'
+    __table_args__ = (
+        Index('user_id', 'user_id'),
+        Index('idx_logs_created', 'created_at'),
+    )
+
+    id = Column(BigInteger, primary_key=True, autoincrement=True, comment='日志ID')
+    user_id = Column(Integer, ForeignKey('users.id', ondelete='SET NULL'), comment='用户ID')
+    type = Column(Enum('access', 'error', 'behavior', 'system',
+                       name='logs_type_enum'), nullable=False, comment='日志类型')
+    content = Column(Text, nullable=False, comment='日志内容')
+    ip = Column(String(45), nullable=True, comment='IP地址')
+    created_at = Column(TIMESTAMP, server_default=func.current_timestamp(),
+                        nullable=True, comment='记录时间')
diff --git a/Merge/back_trm/app/models/syscost.py b/Merge/back_trm/app/models/syscost.py
new file mode 100644
index 0000000..bbde029
--- /dev/null
+++ b/Merge/back_trm/app/models/syscost.py
@@ -0,0 +1,15 @@
+from sqlalchemy import Column, BigInteger, DateTime, String, Float, func
+from sqlalchemy.ext.declarative import declarative_base
+
+Base = declarative_base()
+
+class PerformanceData(Base):
+    __tablename__ = 'performance_data'
+
+    id = Column(BigInteger, primary_key=True, autoincrement=True)
+    record_time = Column(DateTime, nullable=False, server_default=func.now(), comment='记录时间')
+    endpoint = Column(String(255), nullable=True, comment='请求接口路径')
+    elapsed_time = Column(Float, nullable=False, comment='总耗时(秒)')
+    cpu_user = Column(Float, nullable=False, comment='用户态 CPU 时间差(秒)')
+    cpu_system = Column(Float, nullable=False, comment='系统态 CPU 时间差(秒)')
+    memory_rss = Column(BigInteger, nullable=False, comment='RSS 内存增量(字节)')
\ No newline at end of file