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

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