This commit is contained in:
laodaming 2023-10-19 11:21:25 +08:00
parent cfd5dcd423
commit bbf5cb03ad
3 changed files with 5 additions and 11 deletions

View File

@ -8,7 +8,6 @@ import (
"fusenapi/utils/auth" "fusenapi/utils/auth"
"fusenapi/utils/basic" "fusenapi/utils/basic"
"fusenapi/utils/format" "fusenapi/utils/format"
"fusenapi/utils/image"
"fusenapi/utils/s3url_to_s3id" "fusenapi/utils/s3url_to_s3id"
"gorm.io/gorm" "gorm.io/gorm"
"strings" "strings"
@ -39,10 +38,7 @@ func (l *GetRecommandProductListLogic) GetRecommandProductList(req *types.GetRec
if req.Num > 100 || req.Num < 0 { if req.Num > 100 || req.Num < 0 {
req.Num = 4 req.Num = 4
} }
if req.Size > 0 { productInfo, err := l.svcCtx.AllModels.FsProduct.FindOne(l.ctx, req.ProductId)
req.Size = int32(image.GetCurrentSize(uint32(req.Size)))
}
productInfo, err := l.svcCtx.AllModels.FsProduct.FindOneBySn(l.ctx, req.Sn)
if err != nil { if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) { if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "detail`s product is not found") return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "detail`s product is not found")

View File

@ -6,9 +6,8 @@ import (
) )
type GetRecommandProductListReq struct { type GetRecommandProductListReq struct {
Size int32 `form:"size,optional"` Num int64 `form:"num,optional"`
Num int64 `form:"num,optional"` ProductId int64 `form:"product_id"`
Sn string `form:"sn"`
} }
type GetRecommandProductListRsp struct { type GetRecommandProductListRsp struct {

View File

@ -53,9 +53,8 @@ service product {
//获取详情页推荐产品列表 //获取详情页推荐产品列表
type GetRecommandProductListReq { type GetRecommandProductListReq {
Size int32 `form:"size,optional"` Num int64 `form:"num,optional"`
Num int64 `form:"num,optional"` ProductId int64 `form:"product_id"`
Sn string `form:"sn"`
} }
type GetRecommandProductListRsp { type GetRecommandProductListRsp {
Id int64 `json:"id"` Id int64 `json:"id"`