config.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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 string `json:"cornexp1"`
  29. CornExp2 string `json:"cornexp2"`
  30. CornExp3 string `json:"cornexp3"`
  31. CornExp4 string `json:"cornexp4"`
  32. CornExp5 string `json:"cornexp5"`
  33. CornExp6 string `json:"cornexp6"`
  34. CornExp7 string `json:"cornexp7"`
  35. TiDb struct {
  36. Host string `json:"host"`
  37. Port int `json:"port"`
  38. Database string `json:"database"`
  39. User string `json:"user"`
  40. Password string `json:"password"`
  41. PollSize int `json:"poolsize"`
  42. MaxIdle int `json:"maxidle"`
  43. MaxLeftTime int `json:"maxleft"`
  44. } `json:"tiDb"`
  45. TiDbData struct {
  46. Host string `json:"host"`
  47. Port int `json:"port"`
  48. Database string `json:"database"`
  49. User string `json:"user"`
  50. Password string `json:"password"`
  51. PollSize int `json:"poolsize"`
  52. MaxIdle int `json:"maxidle"`
  53. MaxLeftTime int `json:"maxleft"`
  54. } `json:"tiDbData"`
  55. TiDbPower struct {
  56. Host string `json:"host"`
  57. Port int `json:"port"`
  58. Database string `json:"database"`
  59. User string `json:"user"`
  60. Password string `json:"password"`
  61. PollSize int `json:"poolsize"`
  62. MaxIdle int `json:"maxidle"`
  63. MaxLeftTime int `json:"maxleft"`
  64. } `json:"tiDbPower"`
  65. WorderOrder struct {
  66. Host string `json:"host"`
  67. Port int `json:"port"`
  68. Database string `json:"database"`
  69. User string `json:"user"`
  70. Password string `json:"password"`
  71. PollSize int `json:"poolsize"`
  72. MaxIdle int `json:"maxidle"`
  73. MaxLeftTime int `json:"maxleft"`
  74. } `json:"workOrder"`
  75. BaseService struct {
  76. Host string `json:"host"`
  77. Port int `json:"port"`
  78. Database string `json:"database"`
  79. User string `json:"user"`
  80. Password string `json:"password"`
  81. PollSize int `json:"poolsize"`
  82. MaxIdle int `json:"maxidle"`
  83. MaxLeftTime int `json:"maxleft"`
  84. } `json:"baseService"`
  85. ThirdParty struct {
  86. Host string `json:"host"`
  87. Port int `json:"port"`
  88. Database string `json:"database"`
  89. User string `json:"user"`
  90. Password string `json:"password"`
  91. PollSize int `json:"poolsize"`
  92. MaxIdle int `json:"maxidle"`
  93. MaxLeftTime int `json:"maxleft"`
  94. } `json:"thirdParty"`
  95. Jyactivities struct {
  96. Host string `json:"host"`
  97. Port int `json:"port"`
  98. Database string `json:"database"`
  99. User string `json:"user"`
  100. Password string `json:"password"`
  101. PollSize int `json:"poolsize"`
  102. MaxIdle int `json:"maxidle"`
  103. MaxLeftTime int `json:"maxleft"`
  104. } `json:"jyactivities"`
  105. Mysql struct {
  106. Host string `json:"host"`
  107. Port int `json:"port"`
  108. Database string `json:"database"`
  109. User string `json:"user"`
  110. Password string `json:"password"`
  111. PollSize int `json:"poolsize"`
  112. MaxIdle int `json:"maxidle"`
  113. MaxLeftTime int `json:"maxleft"`
  114. } `json:"mysql"`
  115. Mgo struct {
  116. Address string `json:"address"`
  117. DbName string `json:"dbName"`
  118. DbSize int `json:"dbSize"`
  119. } `json:"mgo"`
  120. MgoLog struct {
  121. Address string `json:"address"`
  122. DbName string `json:"dbName"`
  123. DbSize int `json:"dbSize"`
  124. User string `json:"user"`
  125. Password string `json:"password"`
  126. } `json:"mgoLog"`
  127. MgoQyxy struct {
  128. Address string `json:"address"`
  129. DbName string `json:"dbName"`
  130. DbSize int `json:"dbSize"`
  131. User string `json:"user"`
  132. Password string `json:"password"`
  133. } `json:"mgoQyxy"`
  134. Es struct {
  135. Address string `json:"address"`
  136. DbSize int `json:"dbSize"`
  137. Version string `json:"version"`
  138. UserName string `json:"user Name"`
  139. Password string `json:"password"`
  140. } `json:"es"`
  141. ProductArr []string `json:"productArr"`
  142. RedisServer string `json:"redisServer"`
  143. MarketSaleMail string `json:"marketSaleMail"`
  144. AllocationCap int64 `json:"allocationCap"`
  145. WarningValue int64 `json:"warningValue"`
  146. CornMail string `json:"corn_mail"`
  147. RegTimes int `json:"regTimes"`
  148. NameToMail map[string]string `json:"nameToMail"`
  149. ThawDay int64 `json:"thawDay"`
  150. LoopType int64 `json:"loopType"`
  151. }
  152. )
  153. var AreaCode = map[string]string{}
  154. var CodeArea = map[string]string{}
  155. var CodeTrail = map[string]string{}
  156. var DateMap = map[string]int{}
  157. var ProductMap = map[string]string{}
  158. func InitArea() {
  159. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  160. if info != nil && len(*info) > 0 {
  161. for _, m := range *info {
  162. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  163. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  164. }
  165. }
  166. log.Println("AreaCodeLen ", len(AreaCode))
  167. log.Println("CodeAreaLen ", len(CodeArea))
  168. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  169. if trailData != nil && len(*trailData) > 0 {
  170. for _, m := range *trailData {
  171. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  172. }
  173. }
  174. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  175. if holidayRecords != nil && len(*holidayRecords) > 0 {
  176. for _, m := range *holidayRecords {
  177. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  178. }
  179. }
  180. }
  181. func InitProduct(product []string) {
  182. for _, v := range product {
  183. ProductMap[v] = "dk"
  184. }
  185. }