config.go 662B

12345678910111213141516171819202122232425262728293031323334353637
  1. package controllers
  2. import (
  3. "wechat-conf/utils"
  4. "github.com/astaxie/beego/config"
  5. )
  6. // 配置文件列表
  7. const (
  8. AppConf = "app"
  9. AliYunConf = "aliyun"
  10. WeChatConf = "wechat"
  11. SMSConf = "sms"
  12. )
  13. func (c *BaseController) initConfig() {
  14. // c.RunMode = beego.AppConfig.String("runmode")
  15. if c.Configer == nil {
  16. c.Configer = make(map[string]config.Configer)
  17. }
  18. // 系统
  19. appConf, _ := utils.GetConfiger("conf/app.conf")
  20. if appConf != nil {
  21. c.Configer[AppConf] = appConf
  22. }
  23. c.RunMode = appConf.String("runmode")
  24. // 阿里云
  25. aliConf, _ := utils.GetConfiger("conf/aliyun.conf")
  26. if aliConf != nil {
  27. c.Configer[AliYunConf] = aliConf
  28. }
  29. }