mirror of
https://github.com/ChenXu233/nonebot_plugin_dialectlist.git
synced 2025-02-08 03:46:21 +08:00
🐛 修复排名错位的问题
This commit is contained in:
parent
44fd75e570
commit
065619f0a8
@ -46,15 +46,12 @@ async def ensure_group(matcher: Matcher, session: Session = Depends(extract_sess
|
|||||||
|
|
||||||
|
|
||||||
async def persist_id2user_id(ids: List) -> List[str]:
|
async def persist_id2user_id(ids: List) -> List[str]:
|
||||||
whereclause: List[ColumnElement[bool]] = []
|
user_ids = []
|
||||||
whereclause.append(or_(*[SessionModel.id == id for id in ids]))
|
|
||||||
statement = (
|
|
||||||
select(SessionModel).where(*whereclause)
|
|
||||||
# .join(SessionModel, SessionModel.id == MessageRecord.session_persist_id)
|
|
||||||
)
|
|
||||||
async with get_session() as db_session:
|
async with get_session() as db_session:
|
||||||
records = (await db_session.scalars(statement)).all()
|
for i in ids:
|
||||||
return [i.id1 for i in records]
|
user_id = (await db_session.scalar(select(SessionModel).where(or_(*[SessionModel.id == i])))).id1 # type: ignore
|
||||||
|
user_ids.append(user_id)
|
||||||
|
return user_ids
|
||||||
|
|
||||||
|
|
||||||
async def user_id2persist_id(ids: List[str]) -> List[int]:
|
async def user_id2persist_id(ids: List[str]) -> List[int]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user