config.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. WorderOrder 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:"workOrder"`
  72. BaseService 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:"baseService"`
  82. ThirdParty 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:"thirdParty"`
  92. Jyactivities 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:"jyactivities"`
  102. Mysql struct {
  103. Host string `json:"host"`
  104. Port int `json:"port"`
  105. Database string `json:"database"`
  106. User string `json:"user"`
  107. Password string `json:"password"`
  108. PollSize int `json:"poolsize"`
  109. MaxIdle int `json:"maxidle"`
  110. MaxLeftTime int `json:"maxleft"`
  111. } `json:"mysql"`
  112. Mgo struct {
  113. Address string `json:"address"`
  114. DbName string `json:"dbName"`
  115. DbSize int `json:"dbSize"`
  116. } `json:"mgo"`
  117. MgoLog struct {
  118. Address string `json:"address"`
  119. DbName string `json:"dbName"`
  120. DbSize int `json:"dbSize"`
  121. User string `json:"user"`
  122. Password string `json:"password"`
  123. } `json:"mgoLog"`
  124. MgoQyxy struct {
  125. Address string `json:"address"`
  126. DbName string `json:"dbName"`
  127. DbSize int `json:"dbSize"`
  128. User string `json:"user"`
  129. Password string `json:"password"`
  130. } `json:"mgoQyxy"`
  131. Es struct {
  132. Address string `json:"address"`
  133. DbSize int `json:"dbSize"`
  134. Version string `json:"version"`
  135. UserName string `json:"user Name"`
  136. Password string `json:"password"`
  137. } `json:"es"`
  138. AllocationCap int64 `json:"allocationCap"`
  139. WarningValue int64 `json:"warningValue"`
  140. NameToMail map[string]string `json:"nameToMail"`
  141. ThawDay int64 `json:"thawDay"`
  142. ProductArr []string `json:"productArr"`
  143. LoopType int64 `json:"loopType"`
  144. BigSaleTime int64 `json:"bigSaleTime"`
  145. BigOrderTime string `json:"bigOrderTime"`
  146. MarketSaleTime int64 `json:"marketSaleTime"`
  147. MarketSaleMail string `json:"marketSaleMail"`
  148. AllocationTime string `json:"allocationTime"`
  149. AllocationRatio float64 `json:"allocationRatio"`
  150. }
  151. )
  152. var AreaCode = map[string]string{}
  153. var CodeArea = map[string]string{}
  154. var CodeTrail = map[string]string{}
  155. var DateMap = map[string]int{}
  156. var ProductMap = map[string]string{}
  157. func InitArea() {
  158. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  159. if info != nil && len(*info) > 0 {
  160. for _, m := range *info {
  161. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  162. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  163. }
  164. }
  165. log.Println("AreaCodeLen ", len(AreaCode))
  166. log.Println("CodeAreaLen ", len(CodeArea))
  167. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  168. if trailData != nil && len(*trailData) > 0 {
  169. for _, m := range *trailData {
  170. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  171. }
  172. }
  173. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  174. if holidayRecords != nil && len(*holidayRecords) > 0 {
  175. for _, m := range *holidayRecords {
  176. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  177. }
  178. }
  179. }
  180. func InitProduct(product []string) {
  181. for _, v := range product {
  182. ProductMap[v] = "dk"
  183. }
  184. }