UI优化完善初版
This commit is contained in:
@@ -29,12 +29,12 @@ def get_status(db: Session = Depends(get_db)):
|
||||
by_status_result = db.query(Topic.status, func.count()).group_by(Topic.status).all()
|
||||
by_status = {status: count for status, count in by_status_result}
|
||||
|
||||
# 确保返回所有状态
|
||||
# 确保返回所有状态(数据库存中文,返回前端需要英文)
|
||||
status_map = {
|
||||
'pending': by_status.get('pending', 0),
|
||||
'review': by_status.get('review', 0),
|
||||
'ready': by_status.get('ready', 0),
|
||||
'published': by_status.get('published', 0)
|
||||
'pending': by_status.get('待处理', 0),
|
||||
'review': by_status.get('待审查', 0),
|
||||
'ready': by_status.get('待发布', 0),
|
||||
'published': by_status.get('已发布', 0)
|
||||
}
|
||||
|
||||
# 计算今日新增
|
||||
@@ -46,10 +46,10 @@ def get_status(db: Session = Depends(get_db)):
|
||||
return {
|
||||
"stats": {
|
||||
"total": total,
|
||||
"pending": status_map['待处理'],
|
||||
"review": status_map['待审查'],
|
||||
"ready": status_map['待发布'],
|
||||
"published": status_map['已发布'],
|
||||
"pending": status_map['pending'],
|
||||
"review": status_map['review'],
|
||||
"ready": status_map['ready'],
|
||||
"published": status_map['published'],
|
||||
"today": today_count
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user