diff --git a/api/service/QuestionQa.go b/api/service/QuestionQa.go index 14ade39..7af7e8a 100644 --- a/api/service/QuestionQa.go +++ b/api/service/QuestionQa.go @@ -1018,10 +1018,12 @@ func (r *QuestionQaService) GetShareQuestionQaForTypeTwo(questionQa *model.Quest // 飞花令数量 for i := 0; i < *questionQa.TokenNum; i++ { // 题目数据 - var questions []*model.Question + var tokenQuestions []*model.Question // 套题规则 [{"question_type":1,"quantity":10},{"question_type":2,"quantity":0},{"question_type":3,"quantity":0},{"question_type":4,"quantity":0}] for _, v2 := range tokenQuestionContents { + var questions []*model.Question + // 必选数据 for _, v3 := range mustQuestions { // 判断此题目是否已被选中 @@ -1067,13 +1069,19 @@ func (r *QuestionQaService) GetShareQuestionQaForTypeTwo(questionQa *model.Quest } } } + + if len(questions) > 0 { + for _, v3 := range questions { + tokenQuestions = append(tokenQuestions, v3) + } + } } // 处理返回值 - questionDtoList := make([]*dto.QuestionDto, len(questions)) + questionDtoList := make([]*dto.QuestionDto, len(tokenQuestions)) // 处理数据 - for i2, v2 := range questions { + for i2, v2 := range tokenQuestions { // 处理返回值 questionDto := dto.GetShareQuestionDto(v2)