diff --git a/model/gmodel/fs_product_model3d_gen.go b/model/gmodel/fs_product_model3d_gen.go index 20924185..6842c3dc 100644 --- a/model/gmodel/fs_product_model3d_gen.go +++ b/model/gmodel/fs_product_model3d_gen.go @@ -8,6 +8,7 @@ import ( type FsProductModel3d struct { Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID + IsPopular *int64 `gorm:"default:0;" json:"is_popular"` // 是否热门 0否 1是 Tag *int64 `gorm:"default:1;" json:"tag"` // 类别(1:模型,2:配件,3:场景) Title *string `gorm:"default:'';" json:"title"` // 标题 Name *string `gorm:"default:'';" json:"name"` // 详情页展示名称 diff --git a/server/product/internal/logic/getfittingbypidlogic.go b/server/product/internal/logic/getfittingbypidlogic.go index 4a62b3e2..fb7a6bce 100644 --- a/server/product/internal/logic/getfittingbypidlogic.go +++ b/server/product/internal/logic/getfittingbypidlogic.go @@ -73,7 +73,7 @@ func (l *GetFittingByPidLogic) GetFittingByPid(req *types.GetFittingByPidReq, us partIds = append(partIds, *v.PartId) } //获取配件数据 - fittingList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIds(l.ctx, partIds, "price ASC") + fittingList, err := l.svcCtx.AllModels.FsProductModel3d.GetAllByIds(l.ctx, partIds, "is_popular DESC,price ASC") if err != nil { logx.Error(err) return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get part list") @@ -110,6 +110,7 @@ func (l *GetFittingByPidLogic) GetFittingByPid(req *types.GetFittingByPidReq, us Title: *fitting.Title, Price: *fitting.Price, ModelInfo: modelInfo, + IsPopular: *fitting.IsPopular > 0, }) } return resp.SetStatusWithMessage(basic.CodeOK, "success", listRsp) diff --git a/server/product/internal/logic/getsizebypidlogic.go b/server/product/internal/logic/getsizebypidlogic.go index 8939f02b..3db7c7f3 100644 --- a/server/product/internal/logic/getsizebypidlogic.go +++ b/server/product/internal/logic/getsizebypidlogic.go @@ -82,6 +82,7 @@ func (l *GetSizeByPidLogic) GetSizeByPid(req *types.GetSizeByPidReq, userinfo *a Cover: *sizeInfo.Cover, PartsCanDeleted: *sizeInfo.PartsCanDeleted > 0, ModelId: modelList[modelIndex].Id, + IsPopular: *sizeInfo.IsPopular > 0, }) } return resp.SetStatusWithMessage(basic.CodeOK, "success", listRsp) diff --git a/server/product/internal/types/types.go b/server/product/internal/types/types.go index 23eebfd5..0274855a 100644 --- a/server/product/internal/types/types.go +++ b/server/product/internal/types/types.go @@ -334,6 +334,7 @@ type GetSizeByPidRsp struct { Cover string `json:"cover"` //缩略图 PartsCanDeleted bool `json:"parts_can_deleted"` //用户可否删除配件 ModelId int64 `json:"model_id"` //产品主模型id + IsPopular bool `json:"is_popular"` //是否受欢迎 } type GetTemplateByPidReq struct { @@ -350,6 +351,7 @@ type GetFittingByPidRsp struct { MaterialImg string `json:"material_img"` Title string `json:"title"` Price int64 `json:"price"` + IsPopular bool `json:"is_popular"` ModelInfo interface{} `json:"model_info"` } diff --git a/server_api/product.api b/server_api/product.api index a3c7b45e..e1689820 100644 --- a/server_api/product.api +++ b/server_api/product.api @@ -379,6 +379,7 @@ type GetSizeByPidRsp { Cover string `json:"cover"` //缩略图 PartsCanDeleted bool `json:"parts_can_deleted"` //用户可否删除配件 ModelId int64 `json:"model_id"` //产品主模型id + IsPopular bool `json:"is_popular"` //是否受欢迎 } //获取产品模板列表 type GetTemplateByPidReq { @@ -394,6 +395,7 @@ type GetFittingByPidRsp { MaterialImg string `json:"material_img"` Title string `json:"title"` Price int64 `json:"price"` + IsPopular bool `json:"is_popular"` ModelInfo interface{} `json:"model_info"` } //获取产品灯光数据