更新全局config配置
()
| 305 | |
| 306 | //更新全局config配置 |
| 307 | func (this *Config) UpdateGlobalConfig() { |
| 308 | cfgs := this.All() |
| 309 | if len(cfgs) == 0 { |
| 310 | helper.Logger.Error("查询全局配置失败,config表中全局配置信息为空") |
| 311 | } |
| 312 | beego.Info(time.Now(), "更新全局配置") |
| 313 | for _, cfg := range cfgs { |
| 314 | helper.ConfigMap.Store(fmt.Sprintf("%v.%v", cfg.Category, cfg.Key), cfg.Value) |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | func (this *Config) GetByCate(cate helper.ConfigCate) (configs []Config) { |
| 319 | orm.NewOrm().QueryTable(GetTableConfig()).Filter("Category", cate).All(&configs) |