company_config.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. const (
  6. ConfAreaCodeListKey = "area_code_list" // 手机号区号列表
  7. ConfEnAuthRoleKey = "en_auth_role" // 英文权限角色配置Key
  8. )
  9. type CrmConfig struct {
  10. ConfigValue string `description:"详情"`
  11. }
  12. func GetConfigValueByCode(configCode string) (total int, err error) {
  13. o := orm.NewOrm()
  14. sql := ` SELECT config_value FROM crm_config WHERE config_code=? `
  15. err = o.Raw(sql, configCode).QueryRow(&total)
  16. return
  17. }
  18. // 修改
  19. func CrmConfigUpdate(newValue, configCode string) (err error) {
  20. o := orm.NewOrm()
  21. sql := `UPDATE crm_config SET config_value=? WHERE config_code= ?`
  22. _, err = o.Raw(sql, newValue, configCode).Exec()
  23. return
  24. }
  25. func GetConfigDetailByCode(configCode string) (item CrmConfig, err error) {
  26. o := orm.NewOrm()
  27. sql := ` SELECT config_value FROM crm_config WHERE config_code=? `
  28. err = o.Raw(sql, configCode).QueryRow(&item)
  29. return
  30. }
  31. // ConfEnAuthRole 配置-英文权限角色
  32. type ConfEnAuthRole struct {
  33. RoleCode string `description:"角色编码"`
  34. RoleName string `description:"角色名称"`
  35. SyncCrm bool `description:"是否同步CRM"`
  36. }