修改标签12
This commit is contained in:
parent
ca3f8fa28a
commit
c59b1b2c65
@ -387,19 +387,24 @@ func (r *QuestionService) PutQuestion(questionId int64, req requests.PutQuestion
|
||||
}
|
||||
|
||||
// 验证一级标签
|
||||
|
||||
firstLabelId, err := strconv.ParseInt(req.FirstLabelId, 10, 64)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if &firstLabelId != question.FirstLabelId {
|
||||
labelDao := dao.LabelDao{}
|
||||
_, err = labelDao.GetLabelFirstById(firstLabelId)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if question.FirstLabelId == nil {
|
||||
questionData["first_label_id"] = firstLabelId
|
||||
} else {
|
||||
if firstLabelId != *question.FirstLabelId {
|
||||
labelDao := dao.LabelDao{}
|
||||
_, err = labelDao.GetLabelFirstById(firstLabelId)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
questionData["first_label_id"] = firstLabelId
|
||||
}
|
||||
}
|
||||
|
||||
// 验证二级标签
|
||||
@ -415,14 +420,14 @@ func (r *QuestionService) PutQuestion(questionId int64, req requests.PutQuestion
|
||||
return false, err
|
||||
}
|
||||
|
||||
if &firstLabelId != question.FirstLabelId {
|
||||
if &secondLabelId != question.SecondLabelId {
|
||||
labelDao := dao.LabelDao{}
|
||||
_, err = labelDao.GetLabelFirstById(secondLabelId)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
questionData["first_label_id"] = firstLabelId
|
||||
questionData["second_label_id"] = secondLabelId
|
||||
}
|
||||
|
||||
}
|
||||
@ -492,7 +497,7 @@ func (r *QuestionService) PutQuestion(questionId int64, req requests.PutQuestion
|
||||
return false, errors.New(err.Error())
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
//tx.Commit()
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user