sage/wwwroot/hotspot/stats.dspy
yumoqing 71ecb8fea1 feat: add hotspot radar module (热点雷达系统)
- Add hotspot_source/hotspot_item/hotspot_analysis table definitions
- Add MySQL DDL for all three tables with indexes
- Create hotspot dashboard UI (index.ui) with stats, tabs for CRUD
- Add DSPY endpoints: stats, fetch_now (RSS/API), analyze (auto-classify)
- Register paths in load_path.py with logined access
- Add '热点雷达' menu entry
2026-08-01 10:39:52 +08:00

25 lines
863 B
Plaintext

from appPublic.uniqueID import getID
from sqlor.dbpools import DBPools
async def main(request):
db = DBPools()
async with db.sqlorContext('sage') as sor:
items = await sor.R('hotspot_item', {'order': 'fetch_time desc'})
sources = await sor.R('hotspot_source', {})
total = len(items)
rising = sum(1 for i in items if i.get('status') == 'rising')
hot = sum(1 for i in items if i.get('status') == 'hot')
cooling = sum(1 for i in items if i.get('status') == 'cooling')
expired = sum(1 for i in items if i.get('status') == 'expired')
sources_count = len([s for s in sources if s.get('enabled') == '1'])
return {
'total': total,
'rising': rising,
'hot': hot,
'cooling': cooling,
'expired': expired,
'sources': sources_count
}