diff --git a/app/api/endpoints/community_timeperiod.py b/app/api/endpoints/community_timeperiod.py index 8e7fe88..8e86793 100644 --- a/app/api/endpoints/community_timeperiod.py +++ b/app/api/endpoints/community_timeperiod.py @@ -249,7 +249,9 @@ async def get_group_by_community( ): """根据社区进行 group 的配送时段列表""" try: - communities = db.query(CommunityDB).offset(skip).limit(limit).all() + communities = db.query(CommunityDB).order_by(CommunityDB.id.desc()).offset(skip).limit(limit).all() + + total = db.query(CommunityDB).count() #3. 根据社区进行 group 的配送时段列表 communities_with_time_periods = [] @@ -269,8 +271,7 @@ async def get_group_by_community( "capacity": ctp.CommunityTimePeriodDB.capacity } for ctp in community_time_periods] }) - - return success_response(data=communities_with_time_periods) + return success_response(data={"total": total, "items": communities_with_time_periods}) except Exception as e: logging.exception(f"获取社区配送时段列表失败: {str(e)}") diff --git a/jobs.sqlite b/jobs.sqlite index 7278e9e..3eb3e1b 100644 Binary files a/jobs.sqlite and b/jobs.sqlite differ