4
This commit is contained in:
parent
c4278c9f19
commit
06a0593d92
@ -81,7 +81,7 @@ type PutQuestion struct {
|
|||||||
// PutQuestionTest 修改题目
|
// PutQuestionTest 修改题目
|
||||||
type PutQuestionTest struct {
|
type PutQuestionTest struct {
|
||||||
QuestionName string `json:"question_name" form:"question_name" validate:"required" label:"题目名称"`
|
QuestionName string `json:"question_name" form:"question_name" validate:"required" label:"题目名称"`
|
||||||
QuestionType int `json:"question_type" form:"question_type" validate:"required,oneof=1 2 3 4" label:"题目类型"` // 题目类型(1:单选 2:多选 3:问答 4:判断)
|
QuestionType string `json:"question_type" form:"question_type" validate:"required,oneof=1 2 3 4" label:"题目类型"` // 题目类型(1:单选 2:多选 3:问答 4:判断)
|
||||||
QuestionStatus string `json:"question_status" form:"question_status" validate:"required,oneof=1 2" label:"状态"` // 状态(1:正常 2:禁用)
|
QuestionStatus string `json:"question_status" form:"question_status" validate:"required,oneof=1 2" label:"状态"` // 状态(1:正常 2:禁用)
|
||||||
QuestionAnswer string `json:"question_answer" form:"question_answer" validate:"required" label:"答案"`
|
QuestionAnswer string `json:"question_answer" form:"question_answer" validate:"required" label:"答案"`
|
||||||
QuestionAnalysis string `json:"question_analysis" form:"question_analysis" label:"解析"`
|
QuestionAnalysis string `json:"question_analysis" form:"question_analysis" label:"解析"`
|
||||||
|
|||||||
@ -482,9 +482,17 @@ func (r *QuestionService) PutQuestionTest(questionId int64, req requests.PutQues
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 题目类型
|
// 题目类型
|
||||||
if req.QuestionType != question.QuestionType {
|
if req.QuestionType != "" {
|
||||||
|
questionType, err := strconv.Atoi(req.QuestionType)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
return false, errors.New("题目类型错误")
|
||||||
|
}
|
||||||
|
|
||||||
|
if questionType != question.QuestionType {
|
||||||
questionData["question_type"] = req.QuestionType
|
questionData["question_type"] = req.QuestionType
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 状态
|
// 状态
|
||||||
if req.QuestionStatus != "" {
|
if req.QuestionStatus != "" {
|
||||||
@ -614,7 +622,7 @@ func (r *QuestionService) PutQuestionTest(questionId int64, req requests.PutQues
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.QuestionType == 1 || req.QuestionType == 2 {
|
if req.QuestionType == "1" || req.QuestionType == "2" {
|
||||||
// 新增选项
|
// 新增选项
|
||||||
questionOptionDao := dao.QuestionOptionDao{}
|
questionOptionDao := dao.QuestionOptionDao{}
|
||||||
if req.Input1 != nil {
|
if req.Input1 != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user