config.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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. TiDb 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:"tiDb"`
  50. TiDbData 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:"tiDbData"`
  60. TiDbPower 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:"tiDbPower"`
  70. WorderOrder 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:"workOrder"`
  80. BaseService 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:"baseService"`
  90. BiService 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:"biService"`
  100. ThirdParty struct {
  101. Host string `json:"host"`
  102. Port int `json:"port"`
  103. Database string `json:"database"`
  104. User string `json:"user"`
  105. Password string `json:"password"`
  106. PollSize int `json:"poolsize"`
  107. MaxIdle int `json:"maxidle"`
  108. MaxLeftTime int `json:"maxleft"`
  109. } `json:"thirdParty"`
  110. Jyactivities struct {
  111. Host string `json:"host"`
  112. Port int `json:"port"`
  113. Database string `json:"database"`
  114. User string `json:"user"`
  115. Password string `json:"password"`
  116. PollSize int `json:"poolsize"`
  117. MaxIdle int `json:"maxidle"`
  118. MaxLeftTime int `json:"maxleft"`
  119. } `json:"jyactivities"`
  120. Mysql struct {
  121. Host string `json:"host"`
  122. Port int `json:"port"`
  123. Database string `json:"database"`
  124. User string `json:"user"`
  125. Password string `json:"password"`
  126. PollSize int `json:"poolsize"`
  127. MaxIdle int `json:"maxidle"`
  128. MaxLeftTime int `json:"maxleft"`
  129. } `json:"mysql"`
  130. DataAnalysis struct {
  131. Host string `json:"host"`
  132. Port int `json:"port"`
  133. Database string `json:"database"`
  134. User string `json:"user"`
  135. Password string `json:"password"`
  136. PollSize int `json:"poolsize"`
  137. MaxIdle int `json:"maxidle"`
  138. MaxLeftTime int `json:"maxleft"`
  139. } `json:"dataAnalysis"`
  140. Mgo struct {
  141. Address string `json:"address"`
  142. DbName string `json:"dbName"`
  143. DbSize int `json:"dbSize"`
  144. } `json:"mgo"`
  145. MgoLog struct {
  146. Address string `json:"address"`
  147. DbName string `json:"dbName"`
  148. DbSize int `json:"dbSize"`
  149. User string `json:"user"`
  150. Password string `json:"password"`
  151. } `json:"mgoLog"`
  152. MgoQyxy struct {
  153. Address string `json:"address"`
  154. DbName string `json:"dbName"`
  155. DbSize int `json:"dbSize"`
  156. User string `json:"user"`
  157. Password string `json:"password"`
  158. } `json:"mgoQyxy"`
  159. Es struct {
  160. Address string `json:"address"`
  161. DbSize int `json:"dbSize"`
  162. Version string `json:"version"`
  163. UserName string `json:"user Name"`
  164. Password string `json:"password"`
  165. } `json:"es"`
  166. ProductArr []string `json:"productArr"`
  167. RedisServer string `json:"redisServer"`
  168. MarketSaleMail string `json:"marketSaleMail"`
  169. AdvisoryCommitteeMail []string `json:"advisoryCommitteeMail"`
  170. AllocationCap int64 `json:"allocationCap"`
  171. WarningValue int64 `json:"warningValue"`
  172. CornMail string `json:"corn_mail"`
  173. RegTimes int `json:"regTimes"`
  174. NameToMail map[string]string `json:"nameToMail"`
  175. ThawDay int64 `json:"thawDay"`
  176. LoopType int64 `json:"loopType"`
  177. }
  178. )
  179. var AreaCode = map[string]string{}
  180. var CodeArea = map[string]string{}
  181. var CodeTrail = map[string]string{}
  182. var DateMap = map[string]int{}
  183. var ProductMap = map[string]string{}
  184. func InitArea() {
  185. info := TiDb.Find("d_area_code", nil, "", "", -1, -1)
  186. if info != nil && len(*info) > 0 {
  187. for _, m := range *info {
  188. AreaCode[common.ObjToString(m["name"])] = common.ObjToString(m["code"])
  189. CodeArea[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  190. }
  191. }
  192. log.Println("AreaCodeLen ", len(AreaCode))
  193. log.Println("CodeAreaLen ", len(CodeArea))
  194. trailData := TiDb.Find("dwd_d_crm_trailstatus_code", nil, "", "", -1, -1)
  195. if trailData != nil && len(*trailData) > 0 {
  196. for _, m := range *trailData {
  197. CodeTrail[common.ObjToString(m["code"])] = common.ObjToString(m["name"])
  198. }
  199. }
  200. holidayRecords := TiDb.Find("holiday_records", nil, "", "", -1, -1)
  201. if holidayRecords != nil && len(*holidayRecords) > 0 {
  202. for _, m := range *holidayRecords {
  203. DateMap[common.ObjToString(m["date"])] = common.IntAll(m["change"])
  204. }
  205. }
  206. }
  207. func InitProduct(product []string) {
  208. for _, v := range product {
  209. ProductMap[v] = "dk"
  210. }
  211. }