config.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package utils
  2. import (
  3. "fmt"
  4. "github.com/astaxie/beego"
  5. "rdluck_tools/cache"
  6. )
  7. var (
  8. RunMode string //运行模式
  9. MYSQL_URL string //数据库连接
  10. MYSQL_URL_RDDP string //数据库连接
  11. MYSQL_URL_EDB string
  12. REDIS_CACHE string //缓存地址
  13. Rc *cache.Cache //redis缓存
  14. Re error //redis错误
  15. )
  16. var (
  17. STATIC_DIR string
  18. )
  19. //微信配置信息
  20. var (
  21. WxId string //微信原始ID
  22. WxAppId string
  23. WxAppSecret string
  24. TemplateIdByProduct string //产品运行报告通知-模板ID
  25. TemplateRedirectUrl string //模板消息跳转地址
  26. WxPlatform int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  27. )
  28. //pc端微信配置信息
  29. var (
  30. PcWxId string //微信原始ID
  31. PcWxAppId string
  32. PcWxAppSecret string
  33. PcTemplateIdByProduct string //产品运行报告通知-模板ID
  34. PcTemplateRedirectUrl string //模板消息跳转地址
  35. WxPcPlatform int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:3
  36. )
  37. func init() {
  38. RunMode = beego.AppConfig.String("run_mode")
  39. config, err := beego.AppConfig.GetSection(RunMode)
  40. if err != nil {
  41. panic("配置文件读取错误 " + err.Error())
  42. }
  43. beego.Info(RunMode + " 模式")
  44. MYSQL_URL = config["mysql_url"]
  45. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  46. MYSQL_URL_EDB = config["mysql_url_edb"]
  47. REDIS_CACHE = config["beego_cache"]
  48. if len(REDIS_CACHE) <= 0 {
  49. panic("redis链接参数没有配置")
  50. }
  51. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  52. if Re != nil {
  53. fmt.Println(Re)
  54. panic(Re)
  55. }
  56. if RunMode == "release" {
  57. WxAppId = "wx4a844c734d8c8e56"
  58. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  59. WxId = "gh_b67e0049fb8c"
  60. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  61. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  62. WxPlatform = 1
  63. WxPcPlatform = 3
  64. PcWxAppId = "wx615472d6874eeb7f"
  65. PcWxAppSecret = "97fe374fb0cc90ef58c4b49d431366f1"
  66. STATIC_DIR = "/home/static/imgs/"
  67. } else {
  68. WxAppId = "wx9b5d7291e581233a"
  69. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  70. WxId = "gh_5dc508325c6f"
  71. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  72. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  73. WxPlatform = 1
  74. WxPcPlatform = 3
  75. PcWxAppId = "wx7c8084f6e5b1d85a"
  76. PcWxAppSecret = "9e4210cd5a363aa1f316b7c4b8898418"
  77. STATIC_DIR = "/home/static/imgs/"
  78. }
  79. }
  80. //http://webapi.brilliantstart.cn/api/
  81. //http://webapi.brilliantstart.cn/swagger/
  82. //http://139.196.122.219:8603/swagger/