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