config.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. package main
  2. import (
  3. "log"
  4. "app.yhyue.com/moapp/jybase/common"
  5. )
  6. type (
  7. Config struct {
  8. LastOrderId int `json:"lastOrderId"`
  9. LastOrderClueId string `json:"lastOrderClueId"`
  10. LastUserId string `json:"lastUserId"`
  11. LastXcxUserId string `json:"lastXcxUserId"`
  12. LastId string `json:"lastId"`
  13. LastOrderTime string `json:"lastOrderTime"`
  14. LastUserTime string `json:"lastUserTime"`
  15. LastSubscribeId string `json:"lastSubscribeId"`
  16. LastMessageTime string `json:"lastMessageTime"`
  17. LastkcTime string `json:"lastkcTime"`
  18. LastEverythingTime string `json:"lastEverythingTime"`
  19. LastEventRegTime string `json:"lastEventRegTime"`
  20. LastReadClueTime string `json:"lastReadClueTime"`
  21. BigSaleTime int64 `json:"bigSaleTime"`
  22. BigOrderTime string `json:"bigOrderTime"`
  23. MarketSaleTime int64 `json:"marketSaleTime"`
  24. AllocationTime string `json:"allocationTime"`
  25. AllocationRatio float64 `json:"allocationRatio"`
  26. }
  27. DB struct {
  28. CornExp1 int64 `json:"cornexp1"`
  29. CornExp2 int64 `json:"cornexp2"`
  30. CornExp2Start string `json:"cornexp2Strat"`
  31. CornExp2End string `json:"cornexp2End"`
  32. CornExp3 string `json:"cornexp3"`
  33. CornExp4 string `json:"cornexp4"`
  34. CornExp5 int64 `json:"cornexp5"`
  35. CornExp6 int64 `json:"cornexp6"`
  36. CornExp7 string `json:"cornexp7"`
  37. TiDb struct {
  38. Host string `json:"host"`
  39. Port int `json:"port"`
  40. Database string `json:"database"`
  41. User string `json:"user"`
  42. Password string `json:"password"`
  43. PollSize int `json:"poolsize"`
  44. MaxIdle int `json:"maxidle"`
  45. MaxLeftTime int `json:"maxleft"`
  46. } `json:"tiDb"`
  47. TiDbData struct {
  48. Host string `json:"host"`
  49. Port int `json:"port"`
  50. Database string `json:"database"`
  51. User string `json:"user"`
  52. Password string `json:"password"`
  53. PollSize int `json:"poolsize"`
  54. MaxIdle int `json:"maxidle"`
  55. MaxLeftTime int `json:"maxleft"`
  56. } `json:"tiDbData"`
  57. TiDbPower struct {
  58. Host string `json:"host"`
  59. Port int `json:"port"`
  60. Database string `json:"database"`
  61. User string `json:"user"`
  62. Password string `json:"password"`
  63. PollSize int `json:"poolsize"`
  64. MaxIdle int `json:"maxidle"`
  65. MaxLeftTime int `json:"maxleft"`
  66. } `json:"tiDbPower"`
  67. WorderOrder struct {
  68. Host string `json:"host"`
  69. Port int `json:"port"`
  70. Database string `json:"database"`
  71. User string `json:"user"`
  72. Password string `json:"password"`
  73. PollSize int `json:"poolsize"`
  74. MaxIdle int `json:"maxidle"`
  75. MaxLeftTime int `json:"maxleft"`
  76. } `json:"workOrder"`
  77. BaseService struct {
  78. Host string `json:"host"`
  79. Port int `json:"port"`
  80. Database string `json:"database"`
  81. User string `json:"user"`
  82. Password string `json:"password"`
  83. PollSize int `json:"poolsize"`
  84. MaxIdle int `json:"maxidle"`
  85. MaxLeftTime int `json:"maxleft"`
  86. } `json:"baseService"`
  87. ThirdParty struct {
  88. Host string `json:"host"`
  89. Port int `json:"port"`
  90. Database string `json:"database"`
  91. User string `json:"user"`
  92. Password string `json:"password"`
  93. PollSize int `json:"poolsize"`
  94. MaxIdle int `json:"maxidle"`
  95. MaxLeftTime int `json:"maxleft"`
  96. } `json:"thirdParty"`
  97. Jyactivities struct {
  98. Host string `json:"host"`
  99. Port int `json:"port"`
  100. Database string `json:"database"`
  101. User string `json:"user"`
  102. Password string `json:"password"`
  103. PollSize int `json:"poolsize"`
  104. MaxIdle int `json:"maxidle"`
  105. MaxLeftTime int `json:"maxleft"`
  106. } `json:"jyactivities"`
  107. Mysql struct {
  108. Host string `json:"host"`
  109. Port int `json:"port"`
  110. Database string `json:"database"`
  111. User string `json:"user"`
  112. Password string `json:"password"`
  113. PollSize int `json:"poolsize"`
  114. MaxIdle int `json:"maxidle"`
  115. MaxLeftTime int `json:"maxleft"`
  116. } `json:"mysql"`
  117. Mgo struct {
  118. Address string `json:"address"`
  119. DbName string `json:"dbName"`
  120. DbSize int `json:"dbSize"`
  121. } `json:"mgo"`
  122. MgoLog struct {
  123. Address string `json:"address"`
  124. DbName string `json:"dbName"`
  125. DbSize int `json:"dbSize"`
  126. User string `json:"user"`
  127. Password string `json:"password"`
  128. } `json:"mgoLog"`
  129. MgoQyxy struct {
  130. Address string `json:"address"`
  131. DbName string `json:"dbName"`
  132. DbSize int `json:"dbSize"`
  133. User string `json:"user"`
  134. Password string `json:"password"`
  135. } `json:"mgoQyxy"`
  136. Es struct {
  137. Address string `json:"address"`
  138. DbSize int `json:"dbSize"`
  139. Version string `json:"version"`
  140. UserName string `json:"user Name"`
  141. Password string `json:"password"`
  142. } `json:"es"`
  143. ProductArr []string `json:"productArr"`
  144. RedisServer string `json:"redisServer"`
  145. MarketSaleMail string `json:"marketSaleMail"`
  146. AllocationCap int64 `json:"allocationCap"`
  147. WarningValue int64 `json:"warningValue"`
  148. CornMail string `json:"corn_mail"`
  149. RegTimes int `json:"regTimes"`
  150. NameToMail map[string]string `json:"nameToMail"`
  151. ThawDay int64 `json:"thawDay"`
  152. LoopType int64 `json:"loopType"`
  153. }
  154. )
  155. var AreaCode = map[string]string{}
  156. var CodeArea = map[string]string{}
  157. var CodeTrail = map[string]string{}
  158. var DateMap = map[string]int{}
  159. var ProductMap = map[string]string{}
  160. func InitArea() {
  161. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  162. if info != nil && len(*info) > 0 {
  163. for _, m := range *info {
  164. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  165. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  166. }
  167. }
  168. log.Println("AreaCodeLen ", len(AreaCode))
  169. log.Println("CodeAreaLen ", len(CodeArea))
  170. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  171. if trailData != nil && len(*trailData) > 0 {
  172. for _, m := range *trailData {
  173. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  174. }
  175. }
  176. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  177. if holidayRecords != nil && len(*holidayRecords) > 0 {
  178. for _, m := range *holidayRecords {
  179. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  180. }
  181. }
  182. }
  183. func InitProduct(product []string) {
  184. for _, v := range product {
  185. ProductMap[v] = "dk"
  186. }
  187. }