新增了错别字字典1
This commit is contained in:
parent
6b5cd7deab
commit
495fc39c94
@ -1,6 +1,7 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"knowledge/api/dao"
|
"knowledge/api/dao"
|
||||||
"knowledge/api/dto"
|
"knowledge/api/dto"
|
||||||
@ -10,6 +11,8 @@ import (
|
|||||||
"knowledge/global"
|
"knowledge/global"
|
||||||
"knowledge/utils"
|
"knowledge/utils"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BaseErrorWord struct{}
|
type BaseErrorWord struct{}
|
||||||
@ -176,6 +179,7 @@ func (r *BaseErrorWord) OperationErrorWord(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
var questionIds []string
|
||||||
for _, question := range questions {
|
for _, question := range questions {
|
||||||
questionName := utils.ReplaceString(question.QuestionName, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
questionName := utils.ReplaceString(question.QuestionName, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
||||||
questionAnswer := utils.ReplaceString(question.QuestionAnswer, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
questionAnswer := utils.ReplaceString(question.QuestionAnswer, baseErrorWord.WordOld, baseErrorWord.WordNew)
|
||||||
@ -201,6 +205,21 @@ func (r *BaseErrorWord) OperationErrorWord(c *gin.Context) {
|
|||||||
responses.FailWithMessage(err.Error(), c)
|
responses.FailWithMessage(err.Error(), c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 记录操作id
|
||||||
|
questionIds = append(questionIds, fmt.Sprintf("%d", question.QuestionId))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(questionIds) > 0 {
|
||||||
|
datas := make(map[string]interface{})
|
||||||
|
datas["question_ids"] = strings.Join(questionIds, ",")
|
||||||
|
datas["operation_time"] = time.Now().Format("2006-01-02 15:04:05")
|
||||||
|
err = baseErrorWordDao.EditBaseErrorWordById(tx, baseErrorWord.WordId, datas)
|
||||||
|
if err != nil {
|
||||||
|
tx.Rollback()
|
||||||
|
responses.FailWithMessage(err.Error(), c)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user