company_config.go 875 B

1234567891011121314151617181920212223242526272829303132333435
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. const (
  6. ConfAreaCodeListKey = "area_code_list" // 手机号区号列表
  7. )
  8. type CrmConfig struct {
  9. ConfigValue string `description:"详情"`
  10. }
  11. func GetConfigValueByCode(configCode string) (total int, err error) {
  12. o := orm.NewOrm()
  13. sql := ` SELECT config_value FROM crm_config WHERE config_code=? `
  14. err = o.Raw(sql, configCode).QueryRow(&total)
  15. return
  16. }
  17. // 修改
  18. func CrmConfigUpdate(newValue, configCode string) (err error) {
  19. o := orm.NewOrm()
  20. sql := `UPDATE crm_config SET config_value=? WHERE config_code= ?`
  21. _, err = o.Raw(sql, newValue, configCode).Exec()
  22. return
  23. }
  24. func GetConfigDetailByCode(configCode string) (item CrmConfig, err error) {
  25. o := orm.NewOrm()
  26. sql := ` SELECT config_value FROM crm_config WHERE config_code=? `
  27. err = o.Raw(sql, configCode).QueryRow(&item)
  28. return
  29. }