From 2fa1ed11e1ba398ccff9de075b8f6b1b41ad9e8f Mon Sep 17 00:00:00 2001 From: aaron <> Date: Sun, 23 Feb 2025 22:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9B=BE=E7=89=87=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/merchant_order.py | 8 ++++---- app/models/community.py | 2 +- app/models/merchant.py | 2 +- app/models/merchant_product.py | 2 +- app/models/order.py | 4 ++-- app/models/point_product.py | 2 +- app/models/user.py | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/api/endpoints/merchant_order.py b/app/api/endpoints/merchant_order.py index 7c5a7a9..50f69c0 100644 --- a/app/api/endpoints/merchant_order.py +++ b/app/api/endpoints/merchant_order.py @@ -136,7 +136,7 @@ async def get_user_orders( "update_time": order.MerchantOrderDB.update_time, # 商品信息 "product_name": order.product_name, - "product_image": process_image(order.product_image).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build(), + "product_image": process_image(order.product_image).thumbnail(width=800, height=800).format(ImageFormat.WEBP).build(), "product_tags": order.product_tags, # 商家信息 "merchant_id": order.merchant_id, @@ -338,7 +338,7 @@ async def get_order_detail( # 商品信息 "product_name": order.product_name, "product_tags": order.product_tags, - "product_image": process_image(order.product_image).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build(), + "product_image": process_image(order.product_image).thumbnail(width=800, height=800).format(ImageFormat.WEBP).build(), # 商家信息 "merchant_name": order.merchant_name, "merchant_latitude": order.merchant_latitude, @@ -393,7 +393,7 @@ async def get_order_qrcode( # 如果已经有二维码,直接返回 if order.qrcode_url: - url = process_image(order.qrcode_url).thumbnail(800, 800).format(ImageFormat.WEBP).quality(90).build() + url = process_image(order.qrcode_url).thumbnail(800, 800).format(ImageFormat.WEBP).build() return success_response(data={"qrcode_url":url}) try: @@ -429,7 +429,7 @@ async def get_order_qrcode( order.qrcode_url = url db.commit() - process_url = process_image(url).thumbnail(800, 800).format(ImageFormat.WEBP).quality(90).build() + process_url = process_image(url).thumbnail(800, 800).format(ImageFormat.WEBP).build() return success_response(data={"qrcode_url": process_url}) except Exception as e: db.rollback() diff --git a/app/models/community.py b/app/models/community.py index 222c7f7..8b643e2 100644 --- a/app/models/community.py +++ b/app/models/community.py @@ -26,7 +26,7 @@ class CommunityDB(Base): @property def optimized_qy_group_qrcode(self): if self.qy_group_qrcode: - return process_image(self.qy_group_qrcode).thumbnail(600, 600).format(ImageFormat.WEBP).build() + return process_image(self.qy_group_qrcode).thumbnail(800, 800).format(ImageFormat.WEBP).build() return None # Pydantic 模型 diff --git a/app/models/merchant.py b/app/models/merchant.py index b52001d..a6ee3a7 100644 --- a/app/models/merchant.py +++ b/app/models/merchant.py @@ -29,7 +29,7 @@ class MerchantDB(Base): @property def optimized_brand_image_url(self): - return process_image(self.brand_image_url).quality(80).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build() + return process_image(self.brand_image_url).thumbnail(width=800, height=800).format(ImageFormat.WEBP).build() class MerchantCreate(BaseModel): user_id: int diff --git a/app/models/merchant_product.py b/app/models/merchant_product.py index 492520e..96d6403 100644 --- a/app/models/merchant_product.py +++ b/app/models/merchant_product.py @@ -33,7 +33,7 @@ class MerchantProductDB(Base): @property def optimized_image_url(self): - return process_image(self.image_url).quality(80).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build() + return process_image(self.image_url).thumbnail(width=800, height=800).format(ImageFormat.WEBP).build() # Pydantic 模型 class MerchantProductCreate(BaseModel): diff --git a/app/models/order.py b/app/models/order.py index 0fe8453..8598575 100644 --- a/app/models/order.py +++ b/app/models/order.py @@ -85,13 +85,13 @@ class ShippingOrderDB(Base): @property def optimized_complete_images(self): if self.complete_images: - return [process_image(image).quality(80).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build() for image in self.complete_images.split(",")] + return [process_image(image).format(ImageFormat.WEBP).build() for image in self.complete_images.split(",")] return [] @property def optimized_pickup_images(self): if self.pickup_images: - return [process_image(image).quality(80).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build() for image in self.pickup_images.split(",")] + return [process_image(image).format(ImageFormat.WEBP).build() for image in self.pickup_images.split(",")] return [] class ShippingOrderPackageDB(Base): diff --git a/app/models/point_product.py b/app/models/point_product.py index 1b946b1..e69f36a 100644 --- a/app/models/point_product.py +++ b/app/models/point_product.py @@ -23,7 +23,7 @@ class PointProductDB(Base): def optimized_product_image(self): """获取优化后的商品图片""" if self.product_image: - return process_image(self.product_image).thumbnail(400, 400).format(ImageFormat.WEBP).build() + return process_image(self.product_image).thumbnail(800, 800).format(ImageFormat.WEBP).build() return None # Pydantic 模型 diff --git a/app/models/user.py b/app/models/user.py index bcfef03..80c5f1d 100644 --- a/app/models/user.py +++ b/app/models/user.py @@ -44,7 +44,7 @@ class UserDB(Base): @property def optimized_avatar(self): - return process_image(self.avatar).quality(80).thumbnail(width=450, height=450).format(ImageFormat.WEBP).build() + return process_image(self.avatar).thumbnail(width=800, height=800).format(ImageFormat.WEBP).build() # Pydantic 模型 class UserLogin(BaseModel):