86 lines
2.9 KiB
Go
86 lines
2.9 KiB
Go
package request
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/learning"
|
|
)
|
|
|
|
type UserExamSearch struct {
|
|
learning.UserExam
|
|
request.PageInfo
|
|
StartCreatedAt *string `json:"startCreatedAt" form:"startCreatedAt"`
|
|
EndCreatedAt *string `json:"endCreatedAt" form:"endCreatedAt"`
|
|
}
|
|
|
|
type UserExamCreate struct {
|
|
UserId uint `json:"userId" binding:"required"`
|
|
ExamId uint `json:"examId" binding:"required"`
|
|
AttemptNumber int `json:"attemptNumber"`
|
|
StartTime time.Time `json:"startTime"`
|
|
EndTime time.Time `json:"endTime"`
|
|
Duration int `json:"duration"`
|
|
TotalScore int `json:"totalScore"`
|
|
CorrectCount int `json:"correctCount"`
|
|
WrongCount int `json:"wrongCount"`
|
|
Status string `json:"status"`
|
|
IsPassed bool `json:"isPassed"`
|
|
SubmittedAt time.Time `json:"submittedAt"`
|
|
}
|
|
|
|
type UserExamUpdate struct {
|
|
ID uint `json:"id" binding:"required"`
|
|
UserId uint `json:"userId" binding:"required"`
|
|
ExamId uint `json:"examId" binding:"required"`
|
|
AttemptNumber int `json:"attemptNumber"`
|
|
StartTime time.Time `json:"startTime"`
|
|
EndTime time.Time `json:"endTime"`
|
|
Duration int `json:"duration"`
|
|
TotalScore int `json:"totalScore"`
|
|
CorrectCount int `json:"correctCount"`
|
|
WrongCount int `json:"wrongCount"`
|
|
Status string `json:"status"`
|
|
IsPassed bool `json:"isPassed"`
|
|
SubmittedAt time.Time `json:"submittedAt"`
|
|
}
|
|
|
|
type StartExamRequest struct {
|
|
ExamId uint `json:"examId" binding:"required"`
|
|
UserId uint `json:"userId" binding:"required"`
|
|
}
|
|
|
|
type SubmitExamRequest struct {
|
|
UserExamId uint `json:"userExamId" binding:"required"`
|
|
TotalScore int `json:"totalScore"`
|
|
CorrectCount int `json:"correctCount"`
|
|
WrongCount int `json:"wrongCount"`
|
|
}
|
|
|
|
type UserExamStatistics struct {
|
|
TotalExams int `json:"totalExams"` // 总考试次数
|
|
PassedExams int `json:"passedExams"` // 通过考试次数
|
|
FailedExams int `json:"failedExams"` // 未通过考试次数
|
|
AverageScore float64 `json:"averageScore"` // 平均分数
|
|
HighestScore int `json:"highestScore"` // 最高分数
|
|
TotalStudyTime int `json:"totalStudyTime"` // 总学习时间(分钟)
|
|
PassRate float64 `json:"passRate"` // 通过率
|
|
}
|
|
|
|
type ExamRankingItem struct {
|
|
UserId uint `json:"userId"`
|
|
UserName string `json:"userName"`
|
|
Score int `json:"score"`
|
|
Duration int `json:"duration"`
|
|
Rank int `json:"rank"`
|
|
IsPassed bool `json:"isPassed"`
|
|
SubmittedAt time.Time `json:"submittedAt"`
|
|
}
|
|
|
|
type ExamRankingResponse struct {
|
|
ExamId uint `json:"examId"`
|
|
ExamTitle string `json:"examTitle"`
|
|
Rankings []ExamRankingItem `json:"rankings"`
|
|
Total int64 `json:"total"`
|
|
}
|