Study/server/model/learning/wrong_question.go

29 lines
1.3 KiB
Go

package learning
import (
"time"
"github.com/flipped-aurora/gin-vue-admin/server/global"
)
// WrongQuestion 错题本模型
type WrongQuestion struct {
global.GVA_MODEL
UserId uint `json:"userId" form:"userId" gorm:"column:user_id;comment:关联用户ID;not null;" binding:"required"`
QuestionId uint `json:"questionId" form:"questionId" gorm:"column:question_id;comment:关联题目ID;not null;" binding:"required"`
WrongAnswer string `json:"wrongAnswer" form:"wrongAnswer" gorm:"column:wrong_answer;comment:错误答案;type:text;"`
WrongCount int `json:"wrongCount" form:"wrongCount" gorm:"column:wrong_count;comment:错误次数;default:1;"`
LastWrongAt time.Time `json:"lastWrongAt" form:"lastWrongAt" gorm:"column:last_wrong_at;comment:最后错误时间;"`
IsMastered bool `json:"isMastered" form:"isMastered" gorm:"column:is_mastered;comment:是否已掌握;default:false;"`
MasteredAt time.Time `json:"masteredAt" form:"masteredAt" gorm:"column:mastered_at;comment:掌握时间;"`
Notes string `json:"notes" form:"notes" gorm:"column:notes;comment:用户笔记;type:longtext;"`
// 关联关系 - 去掉外键约束,只保留逻辑关联
Question Question `json:"question" gorm:"-"`
}
// TableName 设置表名
func (WrongQuestion) TableName() string {
return "learning_wrong_questions"
}