44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package dto
|
|
|
|
import "hepa-calc-api/api/model"
|
|
|
|
// IndexDto 首页
|
|
type IndexDto struct {
|
|
BaseClass []*BaseClassDto `json:"base_class"` // 分类
|
|
HotQuestion []*QuestionDto `json:"hot_question"` // 热榜
|
|
RecommendQuestion []*QuestionDto `json:"recommend_question"` // 为你推荐
|
|
GuessUserLikeQuestion []*QuestionDto `json:"guess_user_like_question"` // 猜你喜欢
|
|
}
|
|
|
|
// LoadBaseClass 加载数据-分类
|
|
func (r *IndexDto) LoadBaseClass(m []*model.BaseClass) *IndexDto {
|
|
if len(m) > 0 {
|
|
r.BaseClass = GetBaseClassListDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadHotQuestionList 加载数据-热榜
|
|
func (r *IndexDto) LoadHotQuestionList(m []*model.Question) *IndexDto {
|
|
if len(m) > 0 {
|
|
r.HotQuestion = GetHotQuestionListDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadRecommendQuestionList 加载数据-为你推荐
|
|
func (r *IndexDto) LoadRecommendQuestionList(m []*model.Question) *IndexDto {
|
|
if len(m) > 0 {
|
|
r.RecommendQuestion = GetRecommendQuestionListDto(m)
|
|
}
|
|
return r
|
|
}
|
|
|
|
// LoadGuessUserLikeList 加载数据-猜你喜欢
|
|
func (r *IndexDto) LoadGuessUserLikeList(m []*model.Question) *IndexDto {
|
|
if len(m) > 0 {
|
|
r.GuessUserLikeQuestion = GetGuessUserLikeListDto(m)
|
|
}
|
|
return r
|
|
}
|