config.go 8.1 KB

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