config.go 5.4 KB

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