const.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package global
  2. import (
  3. "database/sql"
  4. MYSQL "database/sql"
  5. "sync"
  6. "time"
  7. "github.com/patrickmn/go-cache"
  8. )
  9. var GoCahce *cache.Cache //定义全局变量
  10. var SqliteConn *sql.DB
  11. var MysqlConn *MYSQL.DB
  12. type SqliteConfig struct {
  13. Path string `json:"path"`
  14. User string `json:"user"`
  15. Pwd string `json:"pwd"`
  16. }
  17. var Rtelec_Topics = map[string]string{}
  18. //数字空值
  19. var NullNumber = "99999"
  20. //需要进行无效数值替换的数据
  21. var ReplaceNumber = "-99999"
  22. //不需认证的 路由地址
  23. var NoAuthRouter = []string{}
  24. //Session超时时长,单位秒
  25. var SessionTimeout = 600
  26. //人员过期时长,单位分钟,为0或未设置时表示不过期
  27. var UserExpireTime = 0
  28. var UserLoginLasttime = time.Now()
  29. //当前设备SN
  30. var DeviceSN = ""
  31. //当前设备唯一标识号
  32. var DeviceNO = ""
  33. //允许访问系统的IP段或IP地址。包括不限制(*)和指定IP(ip1,ip2,...)模式
  34. var AllowAccessIps = "*"
  35. //已经访问系统的IP列表
  36. var AccessedIpsList = sync.Map{}
  37. var AccessedIps = sync.Map{}
  38. //系统内置操作帐号
  39. var SystemLogDefaultAccount = map[string]interface{}{"name": "", "ip": "127.0.0.1"}
  40. //用户登录客户端限制模式。有不限制(none)和1对1(o2o)模式
  41. var UserLoginClientLimt = "none"
  42. //登录失败最大次数.超过该次数限制则锁定一定时间.可通过系统参数设置
  43. var LoginFailMaxCount = 5
  44. //登录失败超过该次数限制时锁定时长.可通过系统参数设置
  45. var LoginFailLockTime = 180
  46. //客户端注册列表
  47. var ClientRegList = map[string]interface{}{}
  48. //实时性能监测结果
  49. var PerformanceRuntimeMonitorResult = map[string]interface{}{}
  50. //实时性能监测状态通道
  51. var PerformanceRuntimeMonitorChan = make(chan int, 1)
  52. //实时数据发布主题
  53. var Topic_RuntimeDataPublish = "/rtelec/runtime/device/data"
  54. //今日最高采集数据统计结果发布主题
  55. var Topic_TodayMaxDataPublish = "/rtelec/runtime/today/maxdata"
  56. //设备数量统计结果发布主题
  57. var Topic_DeviceTotalStatPublish = "/rtelec/runtime/device/total"
  58. //设备告警/复归发布主题
  59. var Topic_DeviceAlarmPublish = "/rtelec/runtime/device/alarm"