diff --git a/app/api/endpoints/community_timeperiod.py b/app/api/endpoints/community_timeperiod.py index 5b1bec9..154751a 100644 --- a/app/api/endpoints/community_timeperiod.py +++ b/app/api/endpoints/community_timeperiod.py @@ -116,9 +116,16 @@ async def get_community_time_periods( """获取社区的配送时段列表""" try: # 查询社区的配送时段 - community_time_periods = db.query(CommunityTimePeriodDB, TimePeriodDB.name.label("time_period_name"),TimePeriodDB.from_time.label("time_period_from_time"), TimePeriodDB.to_time.label("time_period_to_time")).join(TimePeriodDB).filter( - CommunityTimePeriodDB.community_id == community_id - ).order_by(TimePeriodDB.from_time).all() + community_time_periods = db.query(CommunityTimePeriodDB,\ + TimePeriodDB.name.label("time_period_name"),\ + TimePeriodDB.from_time.label("time_period_from_time"), \ + TimePeriodDB.to_time.label("time_period_to_time"))\ + .join(TimePeriodDB, CommunityTimePeriodDB.time_period_id == TimePeriodDB.id)\ + .filter( + CommunityTimePeriodDB.community_id == community_id + )\ + .order_by(TimePeriodDB.from_time)\ + .all() result = [] tomorrow_count=0 diff --git a/app/api/endpoints/partner.py b/app/api/endpoints/partner.py index 48f59bb..b45642f 100644 --- a/app/api/endpoints/partner.py +++ b/app/api/endpoints/partner.py @@ -108,6 +108,8 @@ async def partner_community_list( .limit(limit)\ .all() + # 获取总数 + # 防止慢查询 total_count = db.query(CommunitySetMapping.community_id)\ .join(CommunitySet, CommunitySetMapping.set_id == CommunitySet.id)\ .filter(CommunitySet.user_id == current_user.userid)\ diff --git a/app/core/qwen_client.py b/app/core/qwen_client.py index e758546..a54a340 100644 --- a/app/core/qwen_client.py +++ b/app/core/qwen_client.py @@ -35,14 +35,14 @@ class QwenClient: messages = [ { "role": "system", - "content": "你是一个专门识别快递取件码的助手。请准确提取图片中的所有取件码信息。" + "content": "你是一个专门识别快递的取件码,运单号的助手。请准确提取图片中的所有取件码和运单号信息。" }, { "role": "user", "content": [ { "type": "text", - "text": "请识别图中驿站的所有取件码,以[{\"station\":\"驿站名字\",\"pickup_codes\":[\"3232\",\"2323\"]}]的格式返回。只返回JSON格式数据,不要其他解释。" + "text": "请识别图中驿站的所有取件码或者运单号,以[{\"station\":\"驿站名字\",\"pickup_codes\":[\"3232\",\"2323\"]}]的格式返回。只返回JSON格式数据,不要其他解释。" }, { "type": "image", diff --git a/app/models/order.py b/app/models/order.py index 23443bb..a885119 100644 --- a/app/models/order.py +++ b/app/models/order.py @@ -117,7 +117,7 @@ class ShippingOrderPackageDB(Base): orderid = Column(String(32), ForeignKey("shipping_orders.orderid"), index=True) station_id = Column(Integer, nullable=True) station_name = Column(String(50), nullable=False) - pickup_codes = Column(String(100), nullable=False) + pickup_codes = Column(String(500), nullable=False) create_time = Column(DateTime(timezone=True), server_default=func.now()) # Pydantic 模型