From 2587b307f9940c4a444b0ddfb9d3de20429327dc Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 16 Mar 2025 17:23:52 +0800 Subject: [PATCH] update --- app/api/endpoints/order.py | 27 ++++----------------------- jobs.sqlite | Bin 24576 -> 24576 bytes 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/app/api/endpoints/order.py b/app/api/endpoints/order.py index 3cdfcb0..1ae8e75 100644 --- a/app/api/endpoints/order.py +++ b/app/api/endpoints/order.py @@ -178,22 +178,6 @@ def format_delivery_time(delivery_date: datetime, time_period_name: str) -> str: else: return f"{delivery_date.strftime('%m-%d')} {time_period_name}" -def has_consecutive_weekdays(weekdays): - if not weekdays or len(weekdays) <= 1: - return True - - days = sorted(weekdays) - - # 处理环绕情况 - if 1 in days and 7 in days and abs(days.index(1) - days.index(7)) == 1: - # 特殊处理周日和周一的连接 - temp = days.copy() - temp.remove(1 if days.index(1) == 0 else 7) - return all(temp[i] - temp[i-1] == 1 for i in range(1, len(temp))) - - # 普通情况 - return all(days[i] - days[i-1] == 1 for i in range(1, len(days))) - @router.post("/pre-order", response_model=ResponseModel) async def pre_order( request: OrderPriceCalculateRequest, @@ -211,13 +195,10 @@ async def pre_order( # 检查是否在服务时间 if community.weekdays and request.delivery_date: if request.delivery_date.isoweekday() not in community.weekdays: - if has_consecutive_weekdays(community.weekdays): - message = f"本小区的服务时间为: 周{community.weekdays[0]}-{community.weekdays[-1]}" - else: - message = f"本小区的服务时间为: " - for day in community.weekdays: - message += f"周{day}, " - message = message[:-2] + message = f"本小区的服务时间为: " + for day in community.weekdays: + message += f"周{day}, " + message = message[:-2] return error_response(code=400, message=message) # 检查是否有配送员在线 diff --git a/jobs.sqlite b/jobs.sqlite index a8b425ba52103a059b4368d3ee5453af82361045..d3d2bca9c5c71ae1daf8b3c36408398f41b9b9c1 100644 GIT binary patch delta 19 acmZoTz}Rqrae_3X?nD`9M%|4G3*rGo3kHe+ delta 19 acmZoTz}Rqrae_3X_Cy(HM(vFW3*rGn?FNPb