fix 优化推荐跳转
feat 消息落库
This commit is contained in:
@ -200,6 +200,7 @@ class DownloadFiles(Base):
|
||||
result = db.query(DownloadFiles).filter(DownloadFiles.savepath == savepath).all()
|
||||
return list(result)
|
||||
|
||||
@staticmethod
|
||||
@db_update
|
||||
def delete_by_fullpath(db: Session, fullpath: str):
|
||||
db.query(DownloadFiles).filter(DownloadFiles.fullpath == fullpath,
|
||||
|
36
app/db/models/message.py
Normal file
36
app/db/models/message.py
Normal file
@ -0,0 +1,36 @@
|
||||
from sqlalchemy import Column, Integer, String, Sequence
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.db import db_query, Base
|
||||
|
||||
|
||||
class Message(Base):
|
||||
"""
|
||||
消息表
|
||||
"""
|
||||
id = Column(Integer, Sequence('id'), primary_key=True, index=True)
|
||||
# 消息渠道
|
||||
channel = Column(String, nullable=False)
|
||||
# 消息类型
|
||||
mtype = Column(String, nullable=False)
|
||||
# 标题
|
||||
title = Column(String)
|
||||
# 文本内容
|
||||
text = Column(String)
|
||||
# 图片
|
||||
image = Column(String)
|
||||
# 链接
|
||||
link = Column(String)
|
||||
# 用户ID
|
||||
userid = Column(String)
|
||||
# 登记时间
|
||||
reg_time = Column(String)
|
||||
# 消息方向:0-接收息,1-发送消息
|
||||
action = Column(Integer)
|
||||
|
||||
@staticmethod
|
||||
@db_query
|
||||
def list_by_page(db: Session, page: int = 1, count: int = 30):
|
||||
result = db.query(Message).order_by(Message.reg_time.desc()).offset((page - 1) * count).limit(
|
||||
count).all()
|
||||
return list(result)
|
Reference in New Issue
Block a user