diff --git a/api/creator/service.py b/api/creator/service.py index 59b42e0..06e7a92 100644 --- a/api/creator/service.py +++ b/api/creator/service.py @@ -141,7 +141,10 @@ async def latest_notes(session: AsyncSession, account_id: int) -> List[Dict[str, & (CreatorNoteStat.captured_at == newest.c.captured_at), ) .where(CreatorNoteStat.account_id == account_id) - .order_by(CreatorNoteStat.publish_time.desc().nullslast()) + # 不要用 nullslast():那是 PostgreSQL 语法,MySQL 5.7 会直接抛 1064 语法错误。 + # MySQL 把 NULL 视为比任何值都小,所以 DESC 天然把未解析出发布时间的排在最后。 + # 这个 bug 只在真机上才暴露 —— SQLite 从 3.30 起支持 NULLS LAST,测试环境测不出来。 + .order_by(CreatorNoteStat.publish_time.desc()) ) ).all() return [_note_dict(row) for row in rows]