config.go 790 B

1234567891011121314151617181920212223242526272829303132
  1. package models
  2. import (
  3. "github.com/rdlucklib/rdluck_tools/orm"
  4. "time"
  5. )
  6. type CygxConfig struct {
  7. ConfigId int `json:"-" orm:"column(config_id);pk"`
  8. ConfigCode string `json:"-"`
  9. ConfigValue string
  10. Remark string `json:"-"`
  11. CreateTime time.Time `json:"-"`
  12. }
  13. func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
  14. sql := `SELECT * FROM cygx_config WHERE config_code=? `
  15. err = orm.NewOrm().Raw(sql, configCode).QueryRow(&item)
  16. return
  17. }
  18. type ConfigResp struct {
  19. Item *CygxConfig
  20. }
  21. //获取是否展示限免标签
  22. func GetShowSustainable() (count int, err error) {
  23. o := orm.NewOrm()
  24. sqlCount := ` SELECT COUNT(1) FROM cygx_config WHERE config_code= 'is_show_sustainable' AND config_value = 1 `
  25. err = o.Raw(sqlCount).QueryRow(&count)
  26. return
  27. }