config.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. )
  50. type LotteryReceiveReq struct {
  51. UserName string `json:"userName"`
  52. UserId string `json:"userId"`
  53. LotteryIdArr string `json:"lotteryIdArr"`
  54. }
  55. type pushConfig struct {
  56. Webdomain string `json:"webdomain"`
  57. Weixinrpc string `json:"weixinrpc"`
  58. PushPoolSize int `json:"pushPoolSize"`
  59. WxMsg struct {
  60. Id string
  61. First *qrpc.TmplItem
  62. Keyword1 *qrpc.TmplItem
  63. Keyword2 *qrpc.TmplItem
  64. Keyword3 *qrpc.TmplItem
  65. Keyword4 *qrpc.TmplItem
  66. Remark *qrpc.TmplItem
  67. } `json:"wxTplMsg"`
  68. TestId string `json:"testId"`
  69. DelayedTime int `json:"delayedTime"`
  70. Subvip string `json:"subvip"`
  71. Points string `json:"points"`
  72. FullReduce string `json:"fullReduce"`
  73. Messages struct {
  74. NewUser *msgConf
  75. }
  76. }
  77. type OrderMonitorConfig struct {
  78. DateSpecial string // 特别奖品活动日期
  79. OpenCron string // 每天开启订单查询的任务
  80. SelectCron string // 每5分钟查询一次
  81. WinNumberDaily int // 每天第xx个付款获得奖品
  82. WinNumbersSpecial int // 第xxx个付款获得特殊奖品
  83. Switch bool // 是否开启定时任务
  84. ActivityMode int // # 1. 每天第多少名 2. 活动期间内一共第多少名(双十二)
  85. Rules []struct { // 双十二活动规则
  86. WinNum []int // 获奖的下单顺序
  87. Mold int // 奖品 3 免单
  88. Products []string // # 参加活动的产品
  89. PriceLimit bool // 是否有实付金额限制
  90. PriceStart int // 实付金额最低 单位(分)
  91. PriceEnd int // 实付金额最高 单位(分)
  92. }
  93. }
  94. //var Config *config
  95. func init() {
  96. //推送配置文件
  97. common.ReadConfig("./etc/push.json", &PushConfig)
  98. //系统配置文件
  99. //common.ReadConfig(&Config)
  100. g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./etc/config.yaml")
  101. }