修改标签

This commit is contained in:
2024-10-12 17:09:44 +08:00
parent 44818c206b
commit 34c9bb3215
8 changed files with 90 additions and 52 deletions
+18 -2
View File
@@ -807,10 +807,26 @@ func (r *QuestionService) GetQuestion(questionId int64) (g *dto.QuestionDto, err
g = dto.GetQuestionDto(question)
// 加载一级标签
g.LoadFirstLabel(question.FirstLabel)
if question.FirstLabelId != nil {
labelDao := dao.LabelDao{}
firstLabel, err := labelDao.GetLabelFirstById(*question.FirstLabelId)
if err != nil {
return nil, errors.New("题目标签存在错误")
}
g.LoadFirstLabel(firstLabel)
}
// 加载二级标签
g.LoadSecondLabel(question.SecondLabel)
if question.SecondLabelId != nil {
labelDao := dao.LabelDao{}
secondLabel, err := labelDao.GetLabelFirstById(*question.SecondLabelId)
if err != nil {
return nil, errors.New("题目标签存在错误")
}
g.LoadSecondLabel(secondLabel)
}
// 加载选项
g.LoadQuestionOption(question.QuestionOption)