feat: system notice function is ready

This commit is contained in:
RockYang
2024-01-19 18:18:10 +08:00
parent 0140713e86
commit 479f94c372
4 changed files with 51 additions and 38 deletions

View File

@@ -33,8 +33,9 @@ func (h *ConfigHandler) Update(c *gin.Context) {
resp.ERROR(c, types.InvalidArgs)
return
}
str := utils.JsonEncode(&data.Config)
config := model.Config{Key: data.Key, Config: str}
value := utils.JsonEncode(&data.Config)
config := model.Config{Key: data.Key, Config: value}
res := h.db.FirstOrCreate(&config, model.Config{Key: data.Key})
if res.Error != nil {
resp.ERROR(c, res.Error.Error())
@@ -42,7 +43,7 @@ func (h *ConfigHandler) Update(c *gin.Context) {
}
if config.Id > 0 {
config.Config = str
config.Config = value
res := h.db.Updates(&config)
if res.Error != nil {
resp.ERROR(c, res.Error.Error())