config.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. OnlineTime string
  35. )
  36. func init() {
  37. RunMode = beego.AppConfig.String("run_mode")
  38. config, err := beego.AppConfig.GetSection(RunMode)
  39. if err != nil {
  40. panic("配置文件读取错误 " + err.Error())
  41. }
  42. beego.Info(RunMode + " 模式")
  43. MYSQL_URL = config["mysql_url"]
  44. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  45. MYSQL_URL_TACTICS = config["mysql_url_tactics"]
  46. REDIS_CACHE = config["beego_cache"]
  47. if len(REDIS_CACHE) <= 0 {
  48. panic("redis链接参数没有配置")
  49. }
  50. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  51. if Re != nil {
  52. fmt.Println(Re)
  53. panic(Re)
  54. }
  55. OnlineTime = "2021-05-01"
  56. if RunMode == "release" {
  57. WxAppId = "wxcc32b61f96720d2f"
  58. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  59. WxId = "gh_a9d3744e1072"
  60. WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  61. WxMsgTemplateIdApplyCancel = "iEi4YRHwcPbc2PSEF1pptc39H4NsAJPrUIPEk2ynwiA"
  62. WxMsgTemplateIdPermissionApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  63. WxPublicAppId = "wx4a844c734d8c8e56"
  64. WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  65. WxPublicId = "gh_b67e0049fb8c"
  66. //IndexName="cygx_article_v1"
  67. IndexName = "cygx_article_v2"
  68. } else {
  69. WxAppId = "wxcc32b61f96720d2f"
  70. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  71. WxId = "gh_a9d3744e1072"
  72. //模板消息ID
  73. WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  74. WxMsgTemplateIdApplyCancel = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
  75. WxMsgTemplateIdPermissionApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  76. WxPublicAppId = "wx9b5d7291e581233a"
  77. WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861"
  78. WxPublicId = "gh_5dc508325c6f"
  79. IndexName = "test_article"
  80. }
  81. }
  82. //http://webapi.brilliantstart.cn/api/
  83. //http://webapi.brilliantstart.cn/swagger/
  84. //http://139.196.122.219:8603/swagger/