config.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package config
  2. import (
  3. "app.yhyue.com/moapp/jybase/common"
  4. qrpc "app.yhyue.com/moapp/message/model"
  5. "github.com/gogf/gf/v2/frame/g"
  6. "github.com/gogf/gf/v2/os/gcfg"
  7. )
  8. type config struct {
  9. Nsq struct {
  10. Address string
  11. }
  12. Redis struct {
  13. Address string
  14. }
  15. Mongodb struct {
  16. Address string
  17. Size int
  18. DbName string
  19. ReplSet string
  20. UserName string
  21. Password string
  22. }
  23. Etcd struct {
  24. Hosts []string
  25. Key string
  26. }
  27. DocPoints struct {
  28. AppId string
  29. Open struct {
  30. Max int64
  31. Jyweb_article_open int64
  32. Jydocs_doc_open int64
  33. }
  34. Jywx_subscribe_new int64
  35. Jywx_subscribe_invite int64
  36. Jywx_subscribe_invited int64
  37. }
  38. }
  39. type msgConf struct {
  40. Title string
  41. Content string
  42. MsgType int64
  43. Appid string
  44. PcUrl string
  45. MobileUrl string
  46. }
  47. var (
  48. PushConfig *pushConfig
  49. TaskConf *taskConf
  50. )
  51. type LotteryReceiveReq struct {
  52. UserName string `json:"userName"`
  53. UserId string `json:"userId"`
  54. LotteryIdArr string `json:"lotteryIdArr"`
  55. }
  56. type pushConfig struct {
  57. Webdomain string `json:"webdomain"`
  58. Weixinrpc string `json:"weixinrpc"`
  59. PushPoolSize int `json:"pushPoolSize"`
  60. WxMsg struct {
  61. Id string
  62. First *qrpc.TmplItem
  63. Keyword1 *qrpc.TmplItem
  64. Keyword2 *qrpc.TmplItem
  65. Keyword3 *qrpc.TmplItem
  66. Keyword4 *qrpc.TmplItem
  67. Remark *qrpc.TmplItem
  68. } `json:"wxTplMsg"`
  69. TestId string `json:"testId"`
  70. DelayedTime int `json:"delayedTime"`
  71. Subvip string `json:"subvip"`
  72. Points string `json:"points"`
  73. FullReduce string `json:"fullReduce"`
  74. Messages struct {
  75. NewUser *msgConf
  76. ConfirmChallenge *msgConf
  77. }
  78. }
  79. type OrderMonitorConfig struct {
  80. DateSpecial string // 特别奖品活动日期
  81. OpenCron string // 每天开启订单查询的任务
  82. SelectCron string // 每5分钟查询一次
  83. WinNumberDaily int // 每天第xx个付款获得奖品
  84. WinNumbersSpecial int // 第xxx个付款获得特殊奖品
  85. Switch bool // 是否开启定时任务
  86. ActivityMode int // # 1. 每天第多少名 2. 活动期间内一共第多少名(双十二)
  87. Rules []struct { // 双十二活动规则
  88. WinNum []int // 获奖的下单顺序
  89. Mold int // 奖品 3 免单
  90. Products []string // # 参加活动的产品
  91. PriceLimit bool // 是否有实付金额限制
  92. PriceStart int // 实付金额最低 单位(分)
  93. PriceEnd int // 实付金额最高 单位(分)
  94. }
  95. }
  96. type taskConf struct {
  97. TaskStartTime int64 `json:"taskStartTime"` //限时活动开始时间
  98. NewTask []*TaskStruct `json:"newTask"` //新手任务
  99. OldTask []*TaskStruct `json:"oldTask"` //老用户限时任务
  100. TaskDayTime int64 `json:"taskDayTime"` //活动时间
  101. }
  102. type TaskStruct struct {
  103. Name string `json:"name"`
  104. Desc string `json:"desc"`
  105. PcHref string `json:"pcHref"`
  106. AppHref string `json:"appHref"`
  107. WxHref string `json:"wxHref"`
  108. Point int `json:"point"`
  109. Icon string `json:"icon"`
  110. Type string `json:"type"`
  111. Distinguish int `json:"distinguish"` // 0不用区分身份 1区分身份
  112. }
  113. //var Config *config
  114. func init() {
  115. //推送配置文件
  116. common.ReadConfig("./etc/push.json", &PushConfig)
  117. //系统配置文件
  118. //common.ReadConfig(&Config)
  119. g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./etc/config.yaml")
  120. //任务配置文件
  121. common.ReadConfig("./etc/task.json", &TaskConf)
  122. }