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

@@ -165,6 +165,14 @@ func (s *SysJobController) Edit(c *gin.Context) {
}
}
// 检查是否存在
job := s.sysJobService.SelectJobById(body.JobID)
if job.JobID != body.JobID {
// 没有可访问调度任务数据!
c.JSON(200, result.ErrMsg(i18n.TKey(language, "job.noData")))
return
}
// 检查属性值唯一
uniqueJob := s.sysJobService.CheckUniqueJobName(body.JobName, body.JobGroup, body.JobID)
if !uniqueJob {
@@ -174,6 +182,19 @@ func (s *SysJobController) Edit(c *gin.Context) {
return
}
// 多语言非原始值
i18nValue := i18n.TKey(language, job.JobName)
if i18nValue != job.JobName {
i18n.UpdateKeyValue(language, job.JobName, body.JobName)
body.JobName = job.JobName
}
// 多语言非原始值
i18nValue2 := i18n.TKey(language, job.Remark)
if i18nValue2 != job.Remark {
i18n.UpdateKeyValue(language, job.Remark, body.Remark)
body.Remark = job.Remark
}
body.UpdateBy = ctx.LoginUserToUserName(c)
rows := s.sysJobService.UpdateJob(body)
if rows > 0 {