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

@@ -108,16 +108,7 @@ func (h *UserHandler) Register(c *gin.Context) {
Model: h.App.ChatConfig.Model,
ApiKey: "",
}),
}
// 初始化调用次数
var cfg model.Config
h.db.Where("marker = ?", "system").First(&cfg)
var config types.SystemConfig
err := utils.JsonDecode(cfg.Config, &config)
if err != nil || config.UserInitCalls <= 0 {
user.Calls = types.UserInitCalls
} else {
user.Calls = config.UserInitCalls
Calls: h.App.SysConfig.UserInitCalls,
}
res = h.db.Create(&user)
if res.Error != nil {