This commit is contained in:
wucongxing8150 2024-11-20 15:51:13 +08:00
parent 03f5b63ad3
commit be90756c06

View File

@ -1018,10 +1018,12 @@ func (r *QuestionQaService) GetShareQuestionQaForTypeTwo(questionQa *model.Quest
// 飞花令数量 // 飞花令数量
for i := 0; i < *questionQa.TokenNum; i++ { 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}] // 套题规则 [{"question_type":1,"quantity":10},{"question_type":2,"quantity":0},{"question_type":3,"quantity":0},{"question_type":4,"quantity":0}]
for _, v2 := range tokenQuestionContents { for _, v2 := range tokenQuestionContents {
var questions []*model.Question
// 必选数据 // 必选数据
for _, v3 := range mustQuestions { 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) questionDto := dto.GetShareQuestionDto(v2)