package models // QuestionType 题目类型 type QuestionType string const ( SingleChoice QuestionType = "single" // 单选 MultipleChoice QuestionType = "multiple" // 多选 FillBlank QuestionType = "fill" // 填空 TrueFalse QuestionType = "judge" // 判断 ) // Question 题目模型 type Question struct { ID int `json:"id"` Type QuestionType `json:"type"` Content string `json:"content"` // 题目内容 Options []Option `json:"options"` // 选项(单选、多选、判断使用) Answer interface{} `json:"-"` // 正确答案(不返回给前端) Category string `json:"category"` // 分类 } // Option 选项 type Option struct { Key string `json:"key"` // 选项标识 A/B/C/D Value string `json:"value"` // 选项内容 } // SubmitAnswer 提交答案请求 type SubmitAnswer struct { QuestionID int `json:"question_id"` Answer interface{} `json:"answer"` // 可以是字符串、字符串数组等 } // AnswerResult 答案结果 type AnswerResult struct { Correct bool `json:"correct"` CorrectAnswer interface{} `json:"correct_answer"` Explanation string `json:"explanation,omitempty"` // 答案解析 } // Statistics 统计数据 type Statistics struct { TotalQuestions int `json:"total_questions"` AnsweredQuestions int `json:"answered_questions"` CorrectAnswers int `json:"correct_answers"` Accuracy float64 `json:"accuracy"` }