This commit is contained in:
laodaming 2023-07-21 14:07:42 +08:00
parent 50817d7ae2
commit 7e4708e8d8
5 changed files with 8 additions and 1 deletions

View File

@ -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"` // 详情页展示名称

View File

@ -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)

View File

@ -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)

View File

@ -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"`
}

View File

@ -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"`
}
//获取产品灯光数据