config.go 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. AdvisoryCommitteeTime int64 `json:"advisoryCommitteeTime"`
  25. AllocationTime string `json:"allocationTime"`
  26. AllocationRatio float64 `json:"allocationRatio"`
  27. ActiveTime string `json:"activeTime"`
  28. RebindTime string `json:"rebindTime"`
  29. }
  30. DB struct {
  31. CornExp1 int64 `json:"cornexp1"`
  32. CornExp2 int64 `json:"cornexp2"`
  33. CornExp2Start string `json:"cornexp2Strat"`
  34. CornExp2End string `json:"cornexp2End"`
  35. CornExp3 string `json:"cornexp3"`
  36. CornExp4 string `json:"cornexp4"`
  37. CornExp5 int64 `json:"cornexp5"`
  38. CornExp6 int64 `json:"cornexp6"`
  39. CornExp7 string `json:"cornexp7"`
  40. CornExp8 int64 `json:"cornexp8"`
  41. TiDb struct {
  42. Host string `json:"host"`
  43. Port int `json:"port"`
  44. Database string `json:"database"`
  45. User string `json:"user"`
  46. Password string `json:"password"`
  47. PollSize int `json:"poolsize"`
  48. MaxIdle int `json:"maxidle"`
  49. MaxLeftTime int `json:"maxleft"`
  50. } `json:"tiDb"`
  51. TiDbData struct {
  52. Host string `json:"host"`
  53. Port int `json:"port"`
  54. Database string `json:"database"`
  55. User string `json:"user"`
  56. Password string `json:"password"`
  57. PollSize int `json:"poolsize"`
  58. MaxIdle int `json:"maxidle"`
  59. MaxLeftTime int `json:"maxleft"`
  60. } `json:"tiDbData"`
  61. TiDbPower struct {
  62. Host string `json:"host"`
  63. Port int `json:"port"`
  64. Database string `json:"database"`
  65. User string `json:"user"`
  66. Password string `json:"password"`
  67. PollSize int `json:"poolsize"`
  68. MaxIdle int `json:"maxidle"`
  69. MaxLeftTime int `json:"maxleft"`
  70. } `json:"tiDbPower"`
  71. WorderOrder struct {
  72. Host string `json:"host"`
  73. Port int `json:"port"`
  74. Database string `json:"database"`
  75. User string `json:"user"`
  76. Password string `json:"password"`
  77. PollSize int `json:"poolsize"`
  78. MaxIdle int `json:"maxidle"`
  79. MaxLeftTime int `json:"maxleft"`
  80. } `json:"workOrder"`
  81. BaseService struct {
  82. Host string `json:"host"`
  83. Port int `json:"port"`
  84. Database string `json:"database"`
  85. User string `json:"user"`
  86. Password string `json:"password"`
  87. PollSize int `json:"poolsize"`
  88. MaxIdle int `json:"maxidle"`
  89. MaxLeftTime int `json:"maxleft"`
  90. } `json:"baseService"`
  91. BiService struct {
  92. Host string `json:"host"`
  93. Port int `json:"port"`
  94. Database string `json:"database"`
  95. User string `json:"user"`
  96. Password string `json:"password"`
  97. PollSize int `json:"poolsize"`
  98. MaxIdle int `json:"maxidle"`
  99. MaxLeftTime int `json:"maxleft"`
  100. } `json:"biService"`
  101. ThirdParty struct {
  102. Host string `json:"host"`
  103. Port int `json:"port"`
  104. Database string `json:"database"`
  105. User string `json:"user"`
  106. Password string `json:"password"`
  107. PollSize int `json:"poolsize"`
  108. MaxIdle int `json:"maxidle"`
  109. MaxLeftTime int `json:"maxleft"`
  110. } `json:"thirdParty"`
  111. Jyactivities struct {
  112. Host string `json:"host"`
  113. Port int `json:"port"`
  114. Database string `json:"database"`
  115. User string `json:"user"`
  116. Password string `json:"password"`
  117. PollSize int `json:"poolsize"`
  118. MaxIdle int `json:"maxidle"`
  119. MaxLeftTime int `json:"maxleft"`
  120. } `json:"jyactivities"`
  121. DebrisProduct struct {
  122. Host string `json:"host"`
  123. Port int `json:"port"`
  124. Database string `json:"database"`
  125. User string `json:"user"`
  126. Password string `json:"password"`
  127. } `json:"debrisProduct"`
  128. Mysql struct {
  129. Host string `json:"host"`
  130. Port int `json:"port"`
  131. Database string `json:"database"`
  132. User string `json:"user"`
  133. Password string `json:"password"`
  134. PollSize int `json:"poolsize"`
  135. MaxIdle int `json:"maxidle"`
  136. MaxLeftTime int `json:"maxleft"`
  137. } `json:"mysql"`
  138. DataAnalysis struct {
  139. Host string `json:"host"`
  140. Port int `json:"port"`
  141. Database string `json:"database"`
  142. User string `json:"user"`
  143. Password string `json:"password"`
  144. PollSize int `json:"poolsize"`
  145. MaxIdle int `json:"maxidle"`
  146. MaxLeftTime int `json:"maxleft"`
  147. } `json:"dataAnalysis"`
  148. Mgo struct {
  149. Address string `json:"address"`
  150. DbName string `json:"dbName"`
  151. DbSize int `json:"dbSize"`
  152. } `json:"mgo"`
  153. MgoLog struct {
  154. Address string `json:"address"`
  155. DbName string `json:"dbName"`
  156. DbSize int `json:"dbSize"`
  157. User string `json:"user"`
  158. Password string `json:"password"`
  159. } `json:"mgoLog"`
  160. MgoQyxy struct {
  161. Address string `json:"address"`
  162. DbName string `json:"dbName"`
  163. DbSize int `json:"dbSize"`
  164. User string `json:"user"`
  165. Password string `json:"password"`
  166. } `json:"mgoQyxy"`
  167. Es struct {
  168. Address string `json:"address"`
  169. DbSize int `json:"dbSize"`
  170. Version string `json:"version"`
  171. UserName string `json:"user Name"`
  172. Password string `json:"password"`
  173. } `json:"es"`
  174. ProductArr []string `json:"productArr"`
  175. RedisServer string `json:"redisServer"`
  176. MarketSaleMail string `json:"marketSaleMail"`
  177. AdvisoryCommitteeMail []string `json:"advisoryCommitteeMail"`
  178. AllocationCap int64 `json:"allocationCap"`
  179. WarningValue int64 `json:"warningValue"`
  180. CornMail string `json:"corn_mail"`
  181. RegTimes int `json:"regTimes"`
  182. NameToMail map[string]string `json:"nameToMail"`
  183. ThawDay int64 `json:"thawDay"`
  184. LoopType int64 `json:"loopType"`
  185. Sourceid string `json:"sourceid"`
  186. AbhEmail string `json:"abhEmail"`
  187. AfEmail string `json:"afEmail"`
  188. NewRegistration int64 `json:"newRegistration"`
  189. }
  190. )
  191. var AreaCode = map[string]string{}
  192. var CodeArea = map[string]string{}
  193. var CodeTrail = map[string]string{}
  194. var DateMap = map[string]int{}
  195. var ProductMap = map[string]string{}
  196. func InitArea() {
  197. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  198. if info != nil && len(*info) > 0 {
  199. for _, m := range *info {
  200. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  201. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  202. }
  203. }
  204. log.Println("AreaCodeLen ", len(AreaCode))
  205. log.Println("CodeAreaLen ", len(CodeArea))
  206. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  207. if trailData != nil && len(*trailData) > 0 {
  208. for _, m := range *trailData {
  209. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  210. }
  211. }
  212. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  213. if holidayRecords != nil && len(*holidayRecords) > 0 {
  214. for _, m := range *holidayRecords {
  215. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  216. }
  217. }
  218. }
  219. func InitProduct(product []string) {
  220. for _, v := range product {
  221. ProductMap[v] = "dk"
  222. }
  223. }