fix: remove status column

This commit is contained in:
ymq 2026-08-12 12:06:38 +08:00
parent 38a69defae
commit 41f0a585cd

View File

@ -1,24 +1,13 @@
# check_users.dspy - 检查用户表
# check_users.dspy
dbname = get_module_dbname('rbac')
async with DBPools().sqlorContext(dbname) as sor:
recs = await sor.sqlExe("SELECT id, username, status FROM users LIMIT 10", {})
users = []
for r in (recs or []):
users.append({
"id": getattr(r, "id", ""),
"username": getattr(r, "username", ""),
"status": getattr(r, "status", ""),
})
recs = await sor.sqlExe("SELECT id, username FROM users LIMIT 10", {})
users = [{"id": getattr(r, "id", ""), "username": getattr(r, "username", "")} for r in (recs or [])]
admin = await sor.sqlExe("SELECT id, username, password, status FROM users WHERE username='admin'", {})
admin = await sor.sqlExe("SELECT id, username, password FROM users WHERE username='admin'", {})
admin_info = None
for a in (admin or []):
admin_info = {
"id": getattr(a, "id", ""),
"username": getattr(a, "username", ""),
"password_hash": getattr(a, "password", "")[:40],
"status": getattr(a, "status", ""),
}
admin_info = {"id": getattr(a, "id", ""), "username": getattr(a, "username", ""), "password_hash": getattr(a, "password", "")[:40]}
return json.dumps({"users": users, "admin": admin_info}, ensure_ascii=False)