wechat_config.go 548 B

1234567891011121314151617181920212223242526272829303132
  1. package config
  2. // RedisOpts redis 连接属性
  3. type WechatOpts struct {
  4. Appid string
  5. Secret string
  6. }
  7. type WechatConfig struct {
  8. BaseConfig
  9. opts WechatOpts
  10. }
  11. func (w *WechatConfig) GetConfig() interface{} {
  12. return w.opts
  13. }
  14. func (w *WechatConfig) InitConfig() {
  15. opts := WechatOpts{
  16. Appid: w.GetString("appid"),
  17. Secret: w.GetString("secret"),
  18. }
  19. w.opts = opts
  20. }
  21. func NewWechat() Config {
  22. return &WechatConfig{
  23. BaseConfig: BaseConfig{prefix: "wechat"},
  24. opts: WechatOpts{},
  25. }
  26. }
  27. func init() {
  28. Register("wechat", NewWechat)
  29. }