diff --git a/Dockerfile b/Dockerfile index 00ec992..85474c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,8 +35,8 @@ COPY requirements.txt . COPY app app/ # 安装Python依赖 -RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ --no-cache-dir -r requirements.txt \ - && pip install --no-cache-dir uvicorn +RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt \ + && pip install uvicorn # 暴露端口 EXPOSE 8000 diff --git a/app/api/endpoints/order.py b/app/api/endpoints/order.py index 6eef8ef..ff14bb6 100644 --- a/app/api/endpoints/order.py +++ b/app/api/endpoints/order.py @@ -686,6 +686,7 @@ async def get_user_orders( PointProductOrderDB.delivery_order_id == order.orderid ).all() + orders.append({ "orderid": order.orderid, "userid": order.userid, @@ -902,6 +903,20 @@ async def deliveryman_orders( sub_orders = db.query(PointProductOrderDB).filter( PointProductOrderDB.delivery_order_id == order.orderid ).all() + + # 计算配送时间 + delivery_time = "预计 今日 送达" + + # 如果配送时段不为空,则使用配送时段的时间 + if order.time_period_id: + if order.delivery_date == datetime.now().date(): + delivery_time = f"今日 {order.time_period_name}" + elif order.delivery_date == datetime.now().date() + timedelta(days=1): + delivery_time = f"明日 {order.time_period_name}" + else: + delivery_time = f"{order.delivery_date} {order.time_period_name}" + else: + delivery_time = f"今日" orders.append({ "orderid": order.orderid, @@ -913,6 +928,7 @@ async def deliveryman_orders( "pickup_images_count": order.pickup_images_count, "create_time": order.create_time, "delivery_method": order.delivery_method, + "delivery_time": delivery_time, "original_amount": order.original_amount, "coupon_discount_amount": order.coupon_discount_amount, "point_discount_amount": order.point_discount_amount,