config.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. package utils
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/core/logs"
  5. "github.com/beego/beego/v2/server/web"
  6. "github.com/rdlucklib/rdluck_tools/log"
  7. )
  8. var (
  9. RunMode string //运行模式
  10. MYSQL_URL string //数据库连接
  11. MYSQL_URL_RDDP string //数据库连接
  12. )
  13. //微信配置信息
  14. var (
  15. WxId string //微信原始ID
  16. WxAppId string
  17. WxAppSecret string
  18. TemplateIdByProduct string //产品运行报告通知-模板ID
  19. TemplateRedirectUrl string //模板消息跳转地址
  20. WxPlatform int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  21. TemplateIdByCompanyApply string //客户申请单审批通知-模板ID
  22. TemplateCompanyApplyRedirectUrl string //审批单模板消息跳转地址
  23. //微信小程序appid
  24. WxId2 string //微信原始ID
  25. WxAppId2 string
  26. WxAppSecret2 string
  27. WxPlatform2 int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  28. WxMsgTemplateIdWithRoadshowPending string //路演->研究员收到待处理的申请
  29. WxMsgTemplateIdWithRoadshowDetailResult string //路演->销售收到处理结果
  30. WxMsgTemplateIdWithRoadshowDeleteNotice string //路演->研究员收到活动删除通知
  31. )
  32. var (
  33. STATIC_DIR string
  34. )
  35. var ApiLog *log.Log
  36. // LibreOfficePath LibreOfficePath的地址
  37. var LibreOfficePath string
  38. var (
  39. Bucketname string = "hongze"
  40. Endpoint string
  41. Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/"
  42. Upload_dir string = "static/images/"
  43. Upload_Audio_Dir string = "static/audio/"
  44. AccessKeyId string = "LTAIFMZYQhS2BTvW"
  45. AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
  46. )
  47. func init() {
  48. tmpRunMode, err := web.AppConfig.String("run_mode")
  49. if err != nil {
  50. panic("配置文件读取run_mode错误 " + err.Error())
  51. }
  52. RunMode = tmpRunMode
  53. if RunMode == "" {
  54. RunMode = "release"
  55. configPath := `/home/code/config/hongze_mobile_admin/conf/app.conf`
  56. err := web.LoadAppConfig("ini", configPath)
  57. if err != nil {
  58. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  59. }
  60. }
  61. fmt.Println(RunMode, "模式")
  62. config, err := web.AppConfig.GetSection(RunMode)
  63. if err != nil {
  64. panic("配置文件读取错误 " + err.Error())
  65. }
  66. logs.Info(RunMode + " 模式")
  67. MYSQL_URL = config["mysql_url"]
  68. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  69. //小程序appid配置
  70. WxAppId2 = `wx67b68e39913e511e`
  71. WxId2 = `wx67b68e39913e511e`
  72. WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c`
  73. WxPlatform2 = 5
  74. if RunMode == "release" {
  75. WxAppId = "wx4a844c734d8c8e56"
  76. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  77. WxId = "gh_b67e0049fb8c"
  78. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  79. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  80. WxPlatform = 1
  81. TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
  82. TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
  83. //oss
  84. STATIC_DIR = "/home/static/imgs/"
  85. Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
  86. //路演
  87. WxMsgTemplateIdWithRoadshowPending = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //路演->研究员收到待处理的申请
  88. WxMsgTemplateIdWithRoadshowDetailResult = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->销售收到处理结果
  89. WxMsgTemplateIdWithRoadshowDeleteNotice = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->研究员收到活动删除通知
  90. } else {
  91. WxAppId = "wx9b5d7291e581233a"
  92. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  93. WxId = "gh_5dc508325c6f"
  94. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  95. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  96. WxPlatform = 1
  97. TemplateIdByCompanyApply = "eTalI1LbiT_B0mTaBeDTlfSMITenK8dQIgEB5yqjjvA"
  98. TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list"
  99. //oss配置
  100. STATIC_DIR = "static/imgs/"
  101. Endpoint = "oss-cn-shanghai.aliyuncs.com"
  102. //路演
  103. WxMsgTemplateIdWithRoadshowPending = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //路演->研究员收到待处理的申请
  104. WxMsgTemplateIdWithRoadshowDetailResult = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->销售收到处理结果
  105. WxMsgTemplateIdWithRoadshowDeleteNotice = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演->研究员收到活动删除通知
  106. }
  107. tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath")
  108. if err != nil {
  109. panic("配置文件读取libreOfficePath错误 " + err.Error())
  110. }
  111. LibreOfficePath = tmpLibreOfficePath
  112. //日志类
  113. if RunMode == "release" {
  114. logDir := `/data/rdlucklog/hongze_mobile_admin`
  115. ApiLog = log.Init("20060102.api", logDir)
  116. } else {
  117. ApiLog = log.Init("20060102.api")
  118. }
  119. }
  120. //http://webapi.brilliantstart.cn/api/
  121. //http://webapi.brilliantstart.cn/swagger/
  122. //http://139.196.122.219:8603/swagger/