This commit is contained in:
jxxghp
2024-03-16 15:31:04 +08:00
parent d0af1bf075
commit 9acf05f334
7 changed files with 29 additions and 15 deletions

View File

@ -1,5 +1,6 @@
import json
import time
from typing import Optional, Union
from typing import Optional
from sqlalchemy.orm import Session
@ -25,6 +26,7 @@ class MessageOper(DbOper):
link: str = None,
userid: str = None,
action: int = 1,
note: dict = None,
**kwargs):
"""
新增媒体服务器数据
@ -36,6 +38,7 @@ class MessageOper(DbOper):
:param link: 链接
:param userid: 用户ID
:param action: 消息方向0-接收息1-发送消息
:param note: 附件json
"""
kwargs.update({
"channel": channel.value if channel else '',
@ -46,7 +49,8 @@ class MessageOper(DbOper):
"link": link,
"userid": userid,
"action": action,
"reg_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
"reg_time": time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),
"note": json.dumps(note or {})
})
Message(**kwargs).create(self._db)

View File

@ -23,12 +23,12 @@ class Message(Base):
link = Column(String)
# 用户ID
userid = Column(String)
# 用户名
username = Column(String)
# 登记时间
reg_time = Column(String)
# 消息方向0-接收息1-发送消息
action = Column(Integer)
# 附件json
note = Column(String)
@staticmethod
@db_query