fix: 多语言字典数据源同步更新

This commit is contained in:
TsMask
2024-01-10 12:05:14 +08:00
parent 44ddbd7892
commit c2aa5b4a27
9 changed files with 134 additions and 19 deletions

View File

@@ -125,8 +125,8 @@ func (s *SysPostController) Edit(c *gin.Context) {
}
// 检查是否存在
post := s.sysPostService.SelectPostById(body.PostID)
if post.PostID != body.PostID {
postInfo := s.sysPostService.SelectPostById(body.PostID)
if postInfo.PostID != body.PostID {
// 没有可访问岗位数据!
c.JSON(200, result.ErrMsg(i18n.TKey(language, "post.noData")))
return
@@ -150,6 +150,19 @@ func (s *SysPostController) Edit(c *gin.Context) {
return
}
// 多语言非原始值
i18nValue := i18n.TKey(language, postInfo.PostName)
if i18nValue != postInfo.PostName {
i18n.UpdateKeyValue(language, postInfo.PostName, body.PostName)
body.PostName = postInfo.PostName
}
// 多语言非原始值
i18nValue2 := i18n.TKey(language, postInfo.Remark)
if i18nValue2 != postInfo.Remark {
i18n.UpdateKeyValue(language, postInfo.Remark, body.Remark)
body.Remark = postInfo.Remark
}
body.UpdateBy = ctx.LoginUserToUserName(c)
rows := s.sysPostService.UpdatePost(body)
if rows > 0 {