修改标签
This commit is contained in:
+6
-10
@@ -19,6 +19,8 @@ type QuestionDto struct {
|
||||
QuestionAnswer []string `json:"question_answer"` // 答案
|
||||
QuestionAnalysis string `json:"question_analysis"` // 解析
|
||||
Difficulty int `json:"difficulty"` // 难度(0:未知 1:低 2:中 3:高)
|
||||
FirstLabelId *int64 `json:"first_label_id"` // 一级标签id
|
||||
SecondLabelId *int64 `json:"second_label_id"` // 二级标签id
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
FirstLabel *LabelDto `json:"first_label"` // 一级标签
|
||||
@@ -39,6 +41,8 @@ func GetQuestionDto(m *model.Question) *QuestionDto {
|
||||
QuestionAnswer: []string{},
|
||||
QuestionAnalysis: m.QuestionAnalysis,
|
||||
Difficulty: m.Difficulty,
|
||||
FirstLabelId: m.FirstLabelId,
|
||||
SecondLabelId: m.SecondLabelId,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
@@ -62,20 +66,12 @@ func GetQuestionListDto(m []*model.Question) []*QuestionDto {
|
||||
QuestionAnswer: []string{},
|
||||
QuestionAnalysis: v.QuestionAnalysis,
|
||||
Difficulty: v.Difficulty,
|
||||
FirstLabelId: v.FirstLabelId,
|
||||
SecondLabelId: v.SecondLabelId,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 加载一级标签
|
||||
if v.FirstLabel != nil {
|
||||
response = response.LoadFirstLabel(v.FirstLabel)
|
||||
}
|
||||
|
||||
// 加载二级标签
|
||||
if v.SecondLabel != nil {
|
||||
response = response.LoadSecondLabel(v.SecondLabel)
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
if v.QuestionImage != "" {
|
||||
response = response.LoadQuestionImage(v.QuestionImage)
|
||||
|
||||
@@ -51,15 +51,15 @@ func GetQuestionQaItemListDto(m []*model.QuestionQaItem) []*QuestionQaItemDto {
|
||||
response = response.LoadQuestion(v.Question)
|
||||
}
|
||||
|
||||
// 加载一级标签
|
||||
if v.Question.FirstLabel != nil {
|
||||
response = response.LoadFirstLabel(v.Question.FirstLabel)
|
||||
}
|
||||
|
||||
// 加载二级标签
|
||||
if v.Question.SecondLabel != nil {
|
||||
response = response.LoadSecondLabel(v.Question.SecondLabel)
|
||||
}
|
||||
//// 加载一级标签
|
||||
//if v.Question.FirstLabel != nil {
|
||||
// response = response.LoadFirstLabel(v.Question.FirstLabel)
|
||||
//}
|
||||
//
|
||||
//// 加载二级标签
|
||||
//if v.Question.SecondLabel != nil {
|
||||
// response = response.LoadSecondLabel(v.Question.SecondLabel)
|
||||
//}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
|
||||
Reference in New Issue
Block a user