chenchaoyun commited on
Commit
dae0157
·
1 Parent(s): 284886e
Files changed (1) hide show
  1. database.py +7 -6
database.py CHANGED
@@ -231,12 +231,13 @@ async def count_image_records(
231
  async def fetch_today_category_counts() -> List[Dict[str, Any]]:
232
  """统计当天按类别分组的数量"""
233
  query = """
234
- SELECT
235
- COALESCE(category, 'unknown') AS category,
236
- COUNT(*) AS count
237
- FROM tpl_app_processed_images
238
- WHERE DATE(last_modified) = CURDATE()
239
- GROUP BY COALESCE(category, 'unknown')
 
240
  """
241
  rows = await fetch_all(query)
242
  return [
 
231
  async def fetch_today_category_counts() -> List[Dict[str, Any]]:
232
  """统计当天按类别分组的数量"""
233
  query = """
234
+ SELECT
235
+ COALESCE(category, 'unknown') AS category,
236
+ COUNT(*) AS count
237
+ FROM tpl_app_processed_images
238
+ WHERE last_modified >= CURDATE()
239
+ AND last_modified < DATE_ADD(CURDATE(), INTERVAL 1 DAY)
240
+ GROUP BY COALESCE(category, 'unknown')
241
  """
242
  rows = await fetch_all(query)
243
  return [