config.go 5.3 KB

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