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

@@ -262,7 +262,7 @@ func (s *SysConfigController) Export(c *gin.Context) {
// 参数配置修改配置参数
//
// PUT /changeConfigValue
// PUT /changeValue
func (s *SysConfigController) ConfigValue(c *gin.Context) {
language := ctx.AcceptLanguage(c)
var body struct {
@@ -282,13 +282,21 @@ func (s *SysConfigController) ConfigValue(c *gin.Context) {
return
}
// 与旧值相等不变更
if info.ConfigValue == body.Value {
// 与旧值相等 不变更
i18nValue := i18n.TKey(language, info.ConfigValue)
if i18nValue == body.Value {
// 变更状态与旧值相等!
c.JSON(200, result.ErrMsg(i18n.TKey(language, "config.errValueEq")))
return
}
info.ConfigValue = body.Value
// 多语言非原始值
if i18nValue != info.ConfigValue {
i18n.UpdateKeyValue(language, info.ConfigValue, body.Value)
} else {
info.ConfigValue = body.Value
}
info.UpdateBy = ctx.LoginUserToUserName(c)
rows := s.sysConfigService.UpdateConfig(info)
if rows > 0 {