From 76412c96ce770db56824426e8e2d127a48671276 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 25 Oct 2023 18:21:06 +0800 Subject: [PATCH 1/5] fix --- model/gmodel/fs_product_logic.go | 8 ++++++-- .../internal/logic/getrecommendproductlistlogic.go | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/model/gmodel/fs_product_logic.go b/model/gmodel/fs_product_logic.go index 1e7d87e9..e2e16e42 100755 --- a/model/gmodel/fs_product_logic.go +++ b/model/gmodel/fs_product_logic.go @@ -89,8 +89,12 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r return resp, err } func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) { - err = p.db.WithContext(ctx).Model(&FsProduct{}). - Where("`is_del` =? and `is_shelf` = ? and `id` not in(?)", 0, 1, notInProductIds).Order("RAND()").Limit(limit).Find(&resp).Error + db := p.db.WithContext(ctx).Model(&FsProduct{}). + Where("`is_del` =? and `is_shelf` = ? ", 0, 1) + if len(notInProductIds) > 0 { + db = db.Where("`id` not in(?)", notInProductIds) + } + err = db.Order("RAND()").Limit(limit).Find(&resp).Error return resp, err } func (p *FsProductModel) FindAllOnlyByIds(ctx context.Context, ids []int64) (resp []FsProduct, err error) { diff --git a/server/product/internal/logic/getrecommendproductlistlogic.go b/server/product/internal/logic/getrecommendproductlistlogic.go index 013abab1..072b9164 100644 --- a/server/product/internal/logic/getrecommendproductlistlogic.go +++ b/server/product/internal/logic/getrecommendproductlistlogic.go @@ -3,6 +3,7 @@ package logic import ( "encoding/json" "errors" + "fmt" "fusenapi/constants" "fusenapi/model/gmodel" "fusenapi/utils/auth" @@ -64,6 +65,7 @@ func (l *GetRecommendProductListLogic) GetRecommendProductList(req *types.GetRec recommendProductList = recommendProductList[:req.Num] } } + fmt.Println(recommendProductList) //资源id集合 resourceIds := make([]string, 0, 50) //需要填充时需要忽略的id From bd8615e9f2dc344dffe14a5163a87ef11cd8040f Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 25 Oct 2023 18:25:54 +0800 Subject: [PATCH 2/5] fix --- service/repositories/shopping_cart.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/repositories/shopping_cart.go b/service/repositories/shopping_cart.go index 6c22d7d4..52b38248 100644 --- a/service/repositories/shopping_cart.go +++ b/service/repositories/shopping_cart.go @@ -138,7 +138,7 @@ func (d *defaultShoppingCart) CaculateStepPrice(purchaseQuantity int64, stepPric //购买数量>起点 if purchaseQuantity > v.StartQuantity { //最后一个 || 小于等于终点 - if k == l-1 || purchaseQuantity <= v.EndQuantity { + if k == l-1 || purchaseQuantity < v.EndQuantity { itemPrice = v.Price + fittingPrice return itemPrice * purchaseQuantity, itemPrice, nil } From 87d3985a60ae92f688e5f202334fd25c46d493bd Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 25 Oct 2023 18:28:45 +0800 Subject: [PATCH 3/5] fix --- service/repositories/shopping_cart.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/repositories/shopping_cart.go b/service/repositories/shopping_cart.go index 52b38248..005cd527 100644 --- a/service/repositories/shopping_cart.go +++ b/service/repositories/shopping_cart.go @@ -138,7 +138,7 @@ func (d *defaultShoppingCart) CaculateStepPrice(purchaseQuantity int64, stepPric //购买数量>起点 if purchaseQuantity > v.StartQuantity { //最后一个 || 小于等于终点 - if k == l-1 || purchaseQuantity < v.EndQuantity { + if k == l-1 || (purchaseQuantity < v.EndQuantity && purchaseQuantity >= v.StartQuantity) { itemPrice = v.Price + fittingPrice return itemPrice * purchaseQuantity, itemPrice, nil } From eaf5f86a1908311abf526cdbc46b1231306b9455 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Wed, 25 Oct 2023 18:30:52 +0800 Subject: [PATCH 4/5] fix --- service/repositories/shopping_cart.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/repositories/shopping_cart.go b/service/repositories/shopping_cart.go index 005cd527..106ac9d3 100644 --- a/service/repositories/shopping_cart.go +++ b/service/repositories/shopping_cart.go @@ -136,9 +136,9 @@ func (d *defaultShoppingCart) CaculateStepPrice(purchaseQuantity int64, stepPric //遍历查询合适的价格 for k, v := range stepPrice.PriceRange { //购买数量>起点 - if purchaseQuantity > v.StartQuantity { - //最后一个 || 小于等于终点 - if k == l-1 || (purchaseQuantity < v.EndQuantity && purchaseQuantity >= v.StartQuantity) { + if purchaseQuantity >= v.StartQuantity { + //最后一个 || 小于终点 + if k == l-1 || purchaseQuantity < v.EndQuantity { itemPrice = v.Price + fittingPrice return itemPrice * purchaseQuantity, itemPrice, nil } From ffd3c95adee22cd17571ecacf9e59b991d4d47c2 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Wed, 25 Oct 2023 19:15:07 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=E5=90=8E=E5=8F=B0=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/upload/internal/logic/uploadfilebackendlogic.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/upload/internal/logic/uploadfilebackendlogic.go b/server/upload/internal/logic/uploadfilebackendlogic.go index 1323304c..7829103c 100644 --- a/server/upload/internal/logic/uploadfilebackendlogic.go +++ b/server/upload/internal/logic/uploadfilebackendlogic.go @@ -81,7 +81,13 @@ func (l *UploadFileBackendLogic) UploadFileBackend(req *types.UploadFileBackendR MysqlConn: l.svcCtx.MysqlConn, AwsSession: l.svcCtx.AwsSession, } - var resourceId string = hash.JsonHashKey(req.FileKey) + var resourceId string + if len(req.FileKey) == 64 { + resourceId = req.FileKey + } else { + resourceId = hash.JsonHashKey(req.FileKey) + } + uploadRes, err := upload.UploadFileByByte(&file.UploadBaseReq{ FileHash: resourceId, FileByte: ioData,