edb_config.go 652 B

12345678910111213141516171819202122232425
  1. package models
  2. import (
  3. "eta/eta_index_lib/global"
  4. )
  5. type EdbConfig struct {
  6. ConfigValue string `description:"详情"`
  7. }
  8. // EdbConfigUpdate 修改配置
  9. func EdbConfigUpdate(newValue, configCode string) (err error) {
  10. sql := `UPDATE edb_config SET config_value=? WHERE config_code= ?`
  11. err = global.DEFAULT_DB.Exec(sql, newValue, configCode).Error
  12. return
  13. }
  14. // GetConfigDetailByCode 根据配置编码获取配置的值
  15. func GetConfigDetailByCode(configCode string) (item *EdbConfig, err error) {
  16. sql := ` SELECT config_value FROM edb_config WHERE config_code=? `
  17. err = global.DEFAULT_DB.Raw(sql, configCode).First(&item).Error
  18. return
  19. }