config.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. var (
  40. PushConfig *pushConfig
  41. )
  42. type LotteryReceiveReq struct {
  43. UserName string `json:"userName"`
  44. UserId string `json:"userId"`
  45. AppId string `json:"appId"`
  46. LotteryIdArr string `json:"lotteryIdArr"`
  47. }
  48. type pushConfig struct {
  49. Webdomain string `json:"webdomain"`
  50. Weixinrpc string `json:"weixinrpc"`
  51. PushPoolSize int `json:"pushPoolSize"`
  52. WxMsg struct {
  53. Id string
  54. First *qrpc.TmplItem
  55. Keyword1 *qrpc.TmplItem
  56. Keyword2 *qrpc.TmplItem
  57. Keyword3 *qrpc.TmplItem
  58. Keyword4 *qrpc.TmplItem
  59. Remark *qrpc.TmplItem
  60. } `json:"wxTplMsg"`
  61. TestId string `json:"testId"`
  62. DelayedTime int `json:"delayedTime"`
  63. Subvip string `json:"subvip"`
  64. Points string `json:"points"`
  65. ActivityUrl string `json:"activityUrl"`
  66. }
  67. //var Config *config
  68. func init() {
  69. //推送配置文件
  70. common.ReadConfig("./etc/push.json", &PushConfig)
  71. //系统配置文件
  72. //common.ReadConfig(&Config)
  73. g.Cfg().GetAdapter().(*gcfg.AdapterFile).SetFileName("./etc/config.yaml")
  74. }