2
This commit is contained in:
parent
8405cdb5d7
commit
c4278c9f19
@ -176,7 +176,7 @@ func (r *QuestionService) AddQuestionTest(req requests.AddQuestionTest) (bool, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 判断选项
|
// 判断选项
|
||||||
if req.QuestionType == "1" || req.QuestionType == "2" {
|
if req.QuestionType == 1 || req.QuestionType == 2 {
|
||||||
if req.Input1 == nil {
|
if req.Input1 == nil {
|
||||||
return false, errors.New("请填入选项")
|
return false, errors.New("请填入选项")
|
||||||
}
|
}
|
||||||
@ -192,11 +192,6 @@ func (r *QuestionService) AddQuestionTest(req requests.AddQuestionTest) (bool, e
|
|||||||
return false, errors.New("题目名称重复")
|
return false, errors.New("题目名称重复")
|
||||||
}
|
}
|
||||||
|
|
||||||
questionType, err := strconv.Atoi(req.QuestionType)
|
|
||||||
if err != nil {
|
|
||||||
return false, errors.New("题目类型错误")
|
|
||||||
}
|
|
||||||
|
|
||||||
questionStatus, err := strconv.Atoi(req.QuestionStatus)
|
questionStatus, err := strconv.Atoi(req.QuestionStatus)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, errors.New("题目状态错误")
|
return false, errors.New("题目状态错误")
|
||||||
@ -218,7 +213,7 @@ func (r *QuestionService) AddQuestionTest(req requests.AddQuestionTest) (bool, e
|
|||||||
// 新增题目
|
// 新增题目
|
||||||
question = &model.Question{
|
question = &model.Question{
|
||||||
QuestionName: req.QuestionName,
|
QuestionName: req.QuestionName,
|
||||||
QuestionType: questionType,
|
QuestionType: req.QuestionType,
|
||||||
QuestionStatus: questionStatus,
|
QuestionStatus: questionStatus,
|
||||||
QuestionSource: 1,
|
QuestionSource: 1,
|
||||||
QuestionImage: questionImage,
|
QuestionImage: questionImage,
|
||||||
@ -241,7 +236,7 @@ func (r *QuestionService) AddQuestionTest(req requests.AddQuestionTest) (bool, e
|
|||||||
|
|
||||||
// 新增选项
|
// 新增选项
|
||||||
questionOptionDao := dao.QuestionOptionDao{}
|
questionOptionDao := dao.QuestionOptionDao{}
|
||||||
if req.QuestionType == "1" || req.QuestionType == "2" {
|
if req.QuestionType == 1 || req.QuestionType == 2 {
|
||||||
if req.Input1 != nil {
|
if req.Input1 != nil {
|
||||||
questionOption := &model.QuestionOption{
|
questionOption := &model.QuestionOption{
|
||||||
QuestionId: question.QuestionId,
|
QuestionId: question.QuestionId,
|
||||||
@ -487,17 +482,9 @@ func (r *QuestionService) PutQuestionTest(questionId int64, req requests.PutQues
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 题目类型
|
// 题目类型
|
||||||
if req.QuestionType != "" {
|
if req.QuestionType != question.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 != "" {
|
||||||
@ -627,7 +614,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