This commit is contained in:
laodaming 2023-10-24 12:28:44 +08:00
parent ffd371d54c
commit e35ba06a97
4 changed files with 2 additions and 51 deletions

View File

@ -7,7 +7,6 @@ import (
"fusenapi/model/gmodel" "fusenapi/model/gmodel"
"fusenapi/utils/auth" "fusenapi/utils/auth"
"fusenapi/utils/basic" "fusenapi/utils/basic"
"fusenapi/utils/image"
"fusenapi/utils/s3url_to_s3id" "fusenapi/utils/s3url_to_s3id"
"gorm.io/gorm" "gorm.io/gorm"
"sort" "sort"
@ -42,10 +41,6 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
logx.Error(err) logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "get user info err") return resp.SetStatusWithMessage(basic.CodeServiceErr, "get user info err")
} }
//获取合适尺寸
if req.Size > 0 {
req.Size = image.GetCurrentSize(req.Size)
}
//查询分类列表 //查询分类列表
tStatus := int64(1) tStatus := int64(1)
tReq := gmodel.GetAllTagByParamsReq{ tReq := gmodel.GetAllTagByParamsReq{
@ -127,7 +122,6 @@ func (l *GetTagProductListLogic) GetTagProductList(req *types.GetTagProductListR
MapTagLevel: mapTagLevel, MapTagLevel: mapTagLevel,
MapProductHaveOptionFitting: mapProductHaveOptionFitting, MapProductHaveOptionFitting: mapProductHaveOptionFitting,
MapResourceMetadata: mapResourceMetadata, MapResourceMetadata: mapResourceMetadata,
Size: req.Size,
User: user, User: user,
MinLevel: &minLevel, MinLevel: &minLevel,
}); err != nil { }); err != nil {
@ -279,7 +273,6 @@ type dealWithTagMenuDataReq struct {
MapTagLevel map[string]*types.TagItem MapTagLevel map[string]*types.TagItem
MapProductHaveOptionFitting map[int64]struct{} MapProductHaveOptionFitting map[int64]struct{}
MapResourceMetadata map[string]map[string]interface{} MapResourceMetadata map[string]map[string]interface{}
Size uint32
User gmodel.FsUser User gmodel.FsUser
MinLevel *int //层级最小的 MinLevel *int //层级最小的
} }
@ -312,7 +305,6 @@ func (l *GetTagProductListLogic) dealWithTagMenuData(req dealWithTagMenuDataReq)
MapProductSizeCount: req.MapProductSizeCount, MapProductSizeCount: req.MapProductSizeCount,
MapProductHaveOptionFitting: req.MapProductHaveOptionFitting, MapProductHaveOptionFitting: req.MapProductHaveOptionFitting,
MapResourceMetadata: req.MapResourceMetadata, MapResourceMetadata: req.MapResourceMetadata,
Size: req.Size,
User: req.User, User: req.User,
}) })
//tag中产品 //tag中产品

View File

@ -30,7 +30,6 @@ type GetRecommandProductListRsp struct {
type GetTagProductListReq struct { type GetTagProductListReq struct {
Cid int64 `form:"cid,optional"` //分类id Cid int64 `form:"cid,optional"` //分类id
Size uint32 `form:"size,optional"` //尺寸
TemplateTag string `form:"template_tag,optional"` //模板标签 TemplateTag string `form:"template_tag,optional"` //模板标签
WithProduct bool `form:"with_product,optional"` //是否携带分类下的产品 WithProduct bool `form:"with_product,optional"` //是否携带分类下的产品
} }
@ -152,8 +151,7 @@ type GetRenderSettingByPidRsp struct {
} }
type HomePageRecommendProductListReq struct { type HomePageRecommendProductListReq struct {
Size uint32 `form:"size"` MerchantType int64 `form:"merchant_type"`
MerchantType int64 `form:"merchant_type"`
} }
type HomePageRecommendProductListRsp struct { type HomePageRecommendProductListRsp struct {

View File

@ -73,7 +73,6 @@ type GetRecommandProductListRsp {
//获取分类产品列表 //获取分类产品列表
type GetTagProductListReq { type GetTagProductListReq {
Cid int64 `form:"cid,optional"` //分类id Cid int64 `form:"cid,optional"` //分类id
Size uint32 `form:"size,optional"` //尺寸
TemplateTag string `form:"template_tag,optional"` //模板标签 TemplateTag string `form:"template_tag,optional"` //模板标签
WithProduct bool `form:"with_product,optional"` //是否携带分类下的产品 WithProduct bool `form:"with_product,optional"` //是否携带分类下的产品
} }
@ -188,8 +187,7 @@ type GetRenderSettingByPidRsp {
} }
//获取列表页推荐产品(返回是这个维度数组) //获取列表页推荐产品(返回是这个维度数组)
type HomePageRecommendProductListReq { type HomePageRecommendProductListReq {
Size uint32 `form:"size"` MerchantType int64 `form:"merchant_type"`
MerchantType int64 `form:"merchant_type"`
} }
type HomePageRecommendProductListRsp { type HomePageRecommendProductListRsp {
Id int64 `json:"id"` Id int64 `json:"id"`

View File

@ -1,37 +0,0 @@
package image
// 定义尺寸规则
var sizeArray = []uint32{1200, 1000, 750, 500, 128}
// 裁剪尺寸阶梯
var newSizeArray = []uint32{200, 400, 600, 800}
// 获取合适尺寸
func GetCurrentSize(clientSize uint32) uint32 {
lenNewSize := len(newSizeArray)
//大于最大尺寸则返回规则最大尺寸
if clientSize >= newSizeArray[lenNewSize-1] {
return newSizeArray[lenNewSize-1]
}
//小于最小尺寸则返回规则最小尺寸
if clientSize <= newSizeArray[0] {
return newSizeArray[0]
}
for _, v := range newSizeArray {
if v >= clientSize {
return v
}
}
return clientSize
}
// 千人前面图像拼接
type ThousandFaceImageFormatReq struct {
Size int
IsThousandFace int
Cover string
CoverImg string
CoverDefault string
ProductId int64
UserId int64
}