config.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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_TACTICS string
  12. REDIS_CACHE string //缓存地址
  13. Rc *cache.Cache //redis缓存
  14. Re error //redis错误
  15. )
  16. //微信配置信息
  17. var (
  18. WxId string //微信原始ID
  19. WxAppId string
  20. WxAppSecret string
  21. WxMsgTemplateIdApply string //申请待处理
  22. WxMsgTemplateIdApplyCancel string //预约取消提醒
  23. WxMsgTemplateIdPermissionApply string //预约取消提醒
  24. )
  25. //微信公众号配置信息
  26. var (
  27. WxPublicId string //微信原始ID
  28. WxPublicAppId string
  29. WxPublicAppSecret string
  30. WxPlatform = 4 //注册平台,1:日度点评公众号,2:管理后台,3:pc端网站,4:查研观向小程序
  31. )
  32. var (
  33. IndexName string
  34. )
  35. func init() {
  36. RunMode = beego.AppConfig.String("run_mode")
  37. config, err := beego.AppConfig.GetSection(RunMode)
  38. if err != nil {
  39. panic("配置文件读取错误 " + err.Error())
  40. }
  41. beego.Info(RunMode + " 模式")
  42. MYSQL_URL = config["mysql_url"]
  43. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  44. MYSQL_URL_TACTICS = config["mysql_url_tactics"]
  45. REDIS_CACHE = config["beego_cache"]
  46. if len(REDIS_CACHE) <= 0 {
  47. panic("redis链接参数没有配置")
  48. }
  49. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  50. if Re != nil {
  51. fmt.Println(Re)
  52. panic(Re)
  53. }
  54. if RunMode == "release" {
  55. WxAppId = "wxcc32b61f96720d2f"
  56. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  57. WxId = "gh_a9d3744e1072"
  58. WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  59. WxMsgTemplateIdApplyCancel = "iEi4YRHwcPbc2PSEF1pptc39H4NsAJPrUIPEk2ynwiA"
  60. WxMsgTemplateIdPermissionApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  61. WxPublicAppId = "wx4a844c734d8c8e56"
  62. WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  63. WxPublicId = "gh_b67e0049fb8c"
  64. //IndexName="cygx_article_v1"
  65. IndexName="cygx_article_v2"
  66. } else {
  67. WxAppId = "wxcc32b61f96720d2f"
  68. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  69. WxId = "gh_a9d3744e1072"
  70. //模板消息ID
  71. WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  72. WxMsgTemplateIdApplyCancel = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
  73. WxMsgTemplateIdPermissionApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  74. WxPublicAppId = "wx9b5d7291e581233a"
  75. WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861"
  76. WxPublicId = "gh_5dc508325c6f"
  77. IndexName="test_article"
  78. }
  79. }
  80. //http://webapi.brilliantstart.cn/api/
  81. //http://webapi.brilliantstart.cn/swagger/
  82. //http://139.196.122.219:8603/swagger/