增加后台会话撤销并统一拼单业务状态

This commit is contained in:
yml2213
2026-08-18 18:36:48 +08:00
parent 4867861b8b
commit 323b9ea34c
7 changed files with 164 additions and 13 deletions
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS admin_sessions (
id BIGSERIAL PRIMARY KEY,
session_id TEXT NOT NULL UNIQUE,
user_id BIGINT NOT NULL REFERENCES admin_users(id) ON DELETE CASCADE,
status TEXT NOT NULL DEFAULT 'active',
issued_at TIMESTAMPTZ NOT NULL,
last_seen_at TIMESTAMPTZ NOT NULL,
expires_at TIMESTAMPTZ NOT NULL,
revoked_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_admin_sessions_user_status
ON admin_sessions(user_id, status, expires_at DESC);
COMMENT ON TABLE admin_sessions IS '后台登录会话,支持单设备退出和服务端撤销';