新增题目时,增加来源验重1
This commit is contained in:
parent
9ae630f70d
commit
b094d026af
@ -105,14 +105,15 @@ func (r *QuestionService) AddQuestion(req requests.AddQuestion) (bool, error) {
|
||||
}
|
||||
|
||||
// 验证重复
|
||||
questionDao := dao.QuestionDao{}
|
||||
if req.QuestionSource == 1 {
|
||||
questionDao := dao.QuestionDao{}
|
||||
|
||||
maps := make(map[string]interface{})
|
||||
maps["question_name"] = req.QuestionName
|
||||
maps["question_source"] = req.QuestionSource
|
||||
question, _ := questionDao.GetQuestion(maps)
|
||||
if question != nil {
|
||||
return false, errors.New("题目名称重复")
|
||||
maps := make(map[string]interface{})
|
||||
maps["question_name"] = req.QuestionName
|
||||
question, _ := questionDao.GetQuestion(maps)
|
||||
if question != nil {
|
||||
return false, errors.New("题目名称重复")
|
||||
}
|
||||
}
|
||||
|
||||
// 开始事务
|
||||
@ -123,8 +124,10 @@ func (r *QuestionService) AddQuestion(req requests.AddQuestion) (bool, error) {
|
||||
}
|
||||
}()
|
||||
|
||||
questionDao := dao.QuestionDao{}
|
||||
|
||||
// 新增题目
|
||||
question = &model.Question{
|
||||
question := &model.Question{
|
||||
QuestionName: req.QuestionName,
|
||||
QuestionType: req.QuestionType,
|
||||
QuestionStatus: req.QuestionStatus,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user