feat: update system config cache for AppServer when updating system config in admin console

This commit is contained in:
RockYang
2023-07-31 08:13:20 +08:00
parent 29094ba3b3
commit bed184dc1f
3 changed files with 17 additions and 15 deletions

View File

@@ -48,6 +48,16 @@ func (h *ConfigHandler) Update(c *gin.Context) {
resp.ERROR(c, res.Error.Error())
return
}
// update config cache for AppServer
var cfg model.Config
h.db.Where("marker", data.Key).First(&cfg)
err := utils.JsonDecode(cfg.Config, &h.App.ChatConfig)
if err != nil {
resp.ERROR(c, "Failed to update config cache: "+err.Error())
return
}
logger.Infof("Update AppServer's config successfully: %v", config.Config)
}
resp.SUCCESS(c, config)