diff --git a/product/internal/logic/getproductlistlogic.go b/product/internal/logic/getproductlistlogic.go index 89bf2c7c..4a508910 100644 --- a/product/internal/logic/getproductlistlogic.go +++ b/product/internal/logic/getproductlistlogic.go @@ -2,7 +2,6 @@ package logic import ( "context" - "errors" "fusenapi/model" "fusenapi/product/internal/svc" "fusenapi/product/internal/types" @@ -30,10 +29,7 @@ func NewGetProductListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, loginInfo auth.UserInfo) (resp *types.Response, err error) { //校验前台登录情况 if loginInfo.UserId == 0 { - return &types.Response{ - Code: 401, - Message: "please sign in", - }, nil + return &types.Response{Code: 402, Message: "please sign in"}, nil } //获取合适尺寸 if req.Size > 0 { @@ -46,7 +42,7 @@ func (l *GetProductListLogic) GetProductList(req *types.GetProductListReq, login return nil, err } if userInfo.Id == 0 { - return nil, errors.New("user not exists") + return &types.Response{Code: 402, Message: "please sign in"}, nil } return } diff --git a/utils/image/image_size.go b/utils/image/image_size.go index df541589..a0da0bd8 100644 --- a/utils/image/image_size.go +++ b/utils/image/image_size.go @@ -13,7 +13,7 @@ func GetCurrentSize(clientSize uint32) uint32 { return newSizeArray[lenNewSize-1] } //小于最小尺寸则返回规则最小尺寸 - if clientSize < newSizeArray[0] { + if clientSize <= newSizeArray[0] { return newSizeArray[0] } for _, v := range newSizeArray {