From 76573731c61f06cd95542de6aae56f417e920689 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 1 Jun 2023 18:52:15 +0800 Subject: [PATCH 1/2] fix --- product/internal/logic/getproductlistlogic.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/product/internal/logic/getproductlistlogic.go b/product/internal/logic/getproductlistlogic.go index be15ff1c..599a678f 100644 --- a/product/internal/logic/getproductlistlogic.go +++ b/product/internal/logic/getproductlistlogic.go @@ -4,10 +4,9 @@ import ( "context" "errors" "fusenapi/model" - "fusenapi/utils/image" - "fusenapi/product/internal/svc" "fusenapi/product/internal/types" + "fusenapi/utils/image" "github.com/zeromicro/go-zero/core/logx" ) From 4df573bbc7445e19475ab01cd347a547738b388f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Fri, 2 Jun 2023 10:08:22 +0800 Subject: [PATCH 2/2] fix --- utils/image/image_size.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/utils/image/image_size.go b/utils/image/image_size.go index 9421cc8e..df541589 100644 --- a/utils/image/image_size.go +++ b/utils/image/image_size.go @@ -14,15 +14,12 @@ func GetCurrentSize(clientSize uint32) uint32 { } //小于最小尺寸则返回规则最小尺寸 if clientSize < newSizeArray[0] { - return clientSize + return newSizeArray[0] } - for k, v := range newSizeArray { - if v == clientSize { + for _, v := range newSizeArray { + if v >= clientSize { return v } - if clientSize > v && k < lenNewSize-1 && clientSize < newSizeArray[k+1] { - return newSizeArray[k+1] - } } return clientSize }