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 a8b425b..d3d2bca 100644 Binary files a/jobs.sqlite and b/jobs.sqlite differ