From 88cda528f4ff8abba50d3cc707afc13020daeb7e Mon Sep 17 00:00:00 2001 From: ping <1017253325@qq.com> Date: Mon, 8 Jun 2026 17:32:45 +0800 Subject: [PATCH] update token report --- b/cntoai/model_usage_admin_report.dspy | 4 ++-- b/cntoai/model_usage_user_report.dspy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/b/cntoai/model_usage_admin_report.dspy b/b/cntoai/model_usage_admin_report.dspy index cdd1f91..04e6861 100644 --- a/b/cntoai/model_usage_admin_report.dspy +++ b/b/cntoai/model_usage_admin_report.dspy @@ -178,7 +178,7 @@ async def _query_model_usage_rows(sor, conditions, limit=None, offset=None): sql = """ SELECT id, userid, llmid, original_price, orderid, bill_status, usage_content, created_at FROM model_usage - WHERE %s AND bill_status = '0' + WHERE %s AND bill_status != '0' ORDER BY created_at DESC """ % where_clause if limit is not None: @@ -188,7 +188,7 @@ async def _query_model_usage_rows(sor, conditions, limit=None, offset=None): async def _count_model_usage(sor, conditions): where_clause = ' AND '.join(conditions) if conditions else '1 = 1' - sql = 'SELECT COUNT(*) AS total_count FROM model_usage WHERE %s AND bill_status = "0"' % where_clause + sql = 'SELECT COUNT(*) AS total_count FROM model_usage WHERE %s AND bill_status != "0"' % where_clause return (await sor.sqlExe(sql, {}))[0]['total_count'] diff --git a/b/cntoai/model_usage_user_report.dspy b/b/cntoai/model_usage_user_report.dspy index ce827ba..aba1c67 100644 --- a/b/cntoai/model_usage_user_report.dspy +++ b/b/cntoai/model_usage_user_report.dspy @@ -155,7 +155,7 @@ async def _query_model_usage_rows(sor, conditions, limit=None, offset=None): sql = """ SELECT id, userid, llmid, original_price, orderid, bill_status, usage_content, created_at FROM model_usage - WHERE %s AND bill_status = '0' + WHERE %s AND bill_status != '0' ORDER BY created_at DESC """ % where_clause if limit is not None: @@ -165,7 +165,7 @@ async def _query_model_usage_rows(sor, conditions, limit=None, offset=None): async def _count_model_usage(sor, conditions): where_clause = ' AND '.join(conditions) if conditions else '1 = 1' - sql = 'SELECT COUNT(*) AS total_count FROM model_usage WHERE %s' % where_clause + sql = 'SELECT COUNT(*) AS total_count FROM model_usage WHERE %s AND bill_status != "0"' % where_clause return (await sor.sqlExe(sql, {}))[0]['total_count']