ht_biz_config.go 1003 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package config
  2. import "eta/eta_mini_ht_api/common/contants"
  3. // ESOpts es连接属性
  4. type HTOpts struct {
  5. ReportIndex string
  6. MediaIndex string
  7. Encode string
  8. DesCode string
  9. }
  10. type HTBizConfig struct {
  11. BaseConfig
  12. opts HTOpts
  13. }
  14. func (e *HTBizConfig) GetReportIndex() string {
  15. return e.opts.ReportIndex
  16. }
  17. func (e *HTBizConfig) GetMediaIndex() string {
  18. return e.opts.MediaIndex
  19. }
  20. func (e *HTBizConfig) NeedEncode() bool {
  21. if e.opts.Encode == "true" {
  22. return true
  23. }
  24. return false
  25. }
  26. func (e *HTBizConfig) GetDesCode() string {
  27. return e.opts.DesCode
  28. }
  29. func (e *HTBizConfig) InitConfig() {
  30. opts := HTOpts{
  31. ReportIndex: e.GetString("es_report_index"),
  32. MediaIndex: e.GetString("es_media_index"),
  33. Encode: e.GetString("response.encode"),
  34. DesCode: e.GetString("response.des_code"),
  35. }
  36. e.opts = opts
  37. }
  38. func NewHT() Config {
  39. return &HTBizConfig{
  40. BaseConfig: BaseConfig{prefix: contants.HT},
  41. opts: HTOpts{},
  42. }
  43. }
  44. func init() {
  45. Register(contants.HT, NewHT)
  46. }