fix: users表列名修正 userorgid→orgid

This commit is contained in:
yumoqing 2026-07-21 14:06:05 +08:00
parent 05584d8871
commit 993c293b56

View File

@ -60,12 +60,12 @@ async def get_realtime_amount(sor, today, scope=None, org_filter=None):
async def get_total_users_count(sor, scope=None, org_filter=None): async def get_total_users_count(sor, scope=None, org_filter=None):
"""用户总数""" """用户总数"""
if scope == CUSTOMER and org_filter: if scope == CUSTOMER and org_filter:
sql = "SELECT COUNT(*) as cnt FROM users WHERE userorgid = ${org}$" sql = "SELECT COUNT(*) as cnt FROM users WHERE orgid = ${org}$"
ns = {'org': org_filter} ns = {'org': org_filter}
elif scope == DISTRIBUTOR and org_filter: elif scope == DISTRIBUTOR and org_filter:
# 分销商下所有客户机构的用户 # 分销商下所有客户机构的用户
sql = ("SELECT COUNT(DISTINCT u.id) as cnt FROM users u " sql = ("SELECT COUNT(DISTINCT u.id) as cnt FROM users u "
"JOIN organization o ON o.id = u.userorgid " "JOIN organization o ON o.id = u.orgid "
"WHERE o.resellerid = ${org}$") "WHERE o.resellerid = ${org}$")
ns = {'org': org_filter} ns = {'org': org_filter}
else: else: