config.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package main
  2. import (
  3. "log"
  4. "app.yhyue.com/moapp/jybase/common"
  5. )
  6. type (
  7. Config struct {
  8. CornExp1 string `json:"cornexp1"`
  9. CornExp2 string `json:"cornexp2"`
  10. CornExp3 string `json:"cornexp3"`
  11. CornExp4 string `json:"cornexp4"`
  12. CornExp5 string `json:"cornexp5"`
  13. CornExp6 string `json:"cornexp6"`
  14. CornExp7 string `json:"cornexp7"`
  15. LastOrderId int `json:"lastOrderId"`
  16. LastOrderClueId string `json:"lastOrderClueId"`
  17. LastUserId string `json:"lastUserId"`
  18. LastId string `json:"lastId"`
  19. LastOrderTime string `json:"lastOrderTime"`
  20. LastUserTime string `json:"lastUserTime"`
  21. LastSubscribeId string `json:"lastSubscribeId"`
  22. LastMessageTime string `json:"lastMessageTime"`
  23. LastkcTime string `json:"lastkcTime"`
  24. LastEverythingTime string `json:"lastEverythingTime"`
  25. LastEventRegTime string `json:"lastEventRegTime"`
  26. LastReadClueTime string `json:"lastReadClueTime"`
  27. XlsxNum string `json:"xlsxNum"`
  28. CountLimit int64 `json:"countLimit"`
  29. RegTimes int `json:"regTimes"`
  30. RedisServer string `json:"redisServer"`
  31. TiDb struct {
  32. Host string `json:"host"`
  33. Port int `json:"port"`
  34. Database string `json:"database"`
  35. User string `json:"user"`
  36. Password string `json:"password"`
  37. PollSize int `json:"poolsize"`
  38. MaxIdle int `json:"maxidle"`
  39. MaxLeftTime int `json:"maxleft"`
  40. } `json:"tiDb"`
  41. TiDbData struct {
  42. Host string `json:"host"`
  43. Port int `json:"port"`
  44. Database string `json:"database"`
  45. User string `json:"user"`
  46. Password string `json:"password"`
  47. PollSize int `json:"poolsize"`
  48. MaxIdle int `json:"maxidle"`
  49. MaxLeftTime int `json:"maxleft"`
  50. } `json:"tiDbData"`
  51. TiDbPower struct {
  52. Host string `json:"host"`
  53. Port int `json:"port"`
  54. Database string `json:"database"`
  55. User string `json:"user"`
  56. Password string `json:"password"`
  57. PollSize int `json:"poolsize"`
  58. MaxIdle int `json:"maxidle"`
  59. MaxLeftTime int `json:"maxleft"`
  60. } `json:"tiDbPower"`
  61. BaseService struct {
  62. Host string `json:"host"`
  63. Port int `json:"port"`
  64. Database string `json:"database"`
  65. User string `json:"user"`
  66. Password string `json:"password"`
  67. PollSize int `json:"poolsize"`
  68. MaxIdle int `json:"maxidle"`
  69. MaxLeftTime int `json:"maxleft"`
  70. } `json:"baseService"`
  71. ThirdParty struct {
  72. Host string `json:"host"`
  73. Port int `json:"port"`
  74. Database string `json:"database"`
  75. User string `json:"user"`
  76. Password string `json:"password"`
  77. PollSize int `json:"poolsize"`
  78. MaxIdle int `json:"maxidle"`
  79. MaxLeftTime int `json:"maxleft"`
  80. } `json:"thirdParty"`
  81. Jyactivities struct {
  82. Host string `json:"host"`
  83. Port int `json:"port"`
  84. Database string `json:"database"`
  85. User string `json:"user"`
  86. Password string `json:"password"`
  87. PollSize int `json:"poolsize"`
  88. MaxIdle int `json:"maxidle"`
  89. MaxLeftTime int `json:"maxleft"`
  90. } `json:"jyactivities"`
  91. Mysql struct {
  92. Host string `json:"host"`
  93. Port int `json:"port"`
  94. Database string `json:"database"`
  95. User string `json:"user"`
  96. Password string `json:"password"`
  97. PollSize int `json:"poolsize"`
  98. MaxIdle int `json:"maxidle"`
  99. MaxLeftTime int `json:"maxleft"`
  100. } `json:"mysql"`
  101. Mgo struct {
  102. Address string `json:"address"`
  103. DbName string `json:"dbName"`
  104. DbSize int `json:"dbSize"`
  105. } `json:"mgo"`
  106. MgoLog struct {
  107. Address string `json:"address"`
  108. DbName string `json:"dbName"`
  109. DbSize int `json:"dbSize"`
  110. User string `json:"user"`
  111. Password string `json:"password"`
  112. } `json:"mgoLog"`
  113. MgoQyxy struct {
  114. Address string `json:"address"`
  115. DbName string `json:"dbName"`
  116. DbSize int `json:"dbSize"`
  117. User string `json:"user"`
  118. Password string `json:"password"`
  119. } `json:"mgoQyxy"`
  120. Es struct {
  121. Address string `json:"address"`
  122. DbSize int `json:"dbSize"`
  123. Version string `json:"version"`
  124. UserName string `json:"user Name"`
  125. Password string `json:"password"`
  126. } `json:"es"`
  127. }
  128. )
  129. var AreaCode = map[string]string{}
  130. var CodeArea = map[string]string{}
  131. var CodeTrail = map[string]string{}
  132. var DateMap = map[string]int{}
  133. func InitArea() {
  134. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  135. if info != nil && len(*info) > 0 {
  136. for _, m := range *info {
  137. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  138. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  139. }
  140. }
  141. log.Println("AreaCodeLen ", len(AreaCode))
  142. log.Println("CodeAreaLen ", len(CodeArea))
  143. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  144. if trailData != nil && len(*trailData) > 0 {
  145. for _, m := range *trailData {
  146. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  147. }
  148. }
  149. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  150. if holidayRecords != nil && len(*holidayRecords) > 0 {
  151. for _, m := range *holidayRecords {
  152. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  153. }
  154. }
  155. }