3
This commit is contained in:
@@ -180,6 +180,7 @@ func (r *BaseErrorWord) OperationErrorWord(c *gin.Context) {
|
||||
}
|
||||
}()
|
||||
|
||||
questionOptionDao := dao.QuestionOptionDao{}
|
||||
var questionIds []string
|
||||
for _, question := range questions {
|
||||
questionName := utils.ReplaceString(question.QuestionName, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
||||
@@ -203,12 +204,34 @@ func (r *BaseErrorWord) OperationErrorWord(c *gin.Context) {
|
||||
err = questionDao.EditQuestionById(tx, question.QuestionId, datas)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
|
||||
// 记录操作id
|
||||
questionIds = append(questionIds, fmt.Sprintf("%d", question.QuestionId))
|
||||
}
|
||||
|
||||
// 获取题目选项详情
|
||||
questionOptions, err := questionOptionDao.GetQuestionOptionFirstByQuestionId(question.QuestionId)
|
||||
if err == nil && len(questionOptions) > 0 {
|
||||
for _, option := range questionOptions {
|
||||
datas = make(map[string]interface{})
|
||||
optionValue := utils.ReplaceString(option.OptionValue, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
||||
if option.OptionValue != optionValue {
|
||||
datas["option_value"] = optionValue
|
||||
}
|
||||
|
||||
if len(datas) > 0 {
|
||||
err = questionOptionDao.EditQuestionOptionById(tx, option.OptionId, datas)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
responses.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(questionIds) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user