edb_config.go 663 B

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