config.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package utils
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/core/logs"
  5. "github.com/beego/beego/v2/server/web"
  6. "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. )
  29. var (
  30. STATIC_DIR string
  31. )
  32. var ApiLog *log.Log
  33. // LibreOfficePath LibreOfficePath的地址
  34. var LibreOfficePath string
  35. var (
  36. Bucketname string = "hongze"
  37. Endpoint string
  38. Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/"
  39. Upload_dir string = "static/images/"
  40. Upload_Audio_Dir string = "static/audio/"
  41. AccessKeyId string = "LTAIFMZYQhS2BTvW"
  42. AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
  43. )
  44. func init() {
  45. tmpRunMode, err := web.AppConfig.String("run_mode")
  46. if err != nil {
  47. panic("配置文件读取run_mode错误 " + err.Error())
  48. }
  49. RunMode = tmpRunMode
  50. fmt.Println(RunMode, "模式")
  51. config, err := web.AppConfig.GetSection(RunMode)
  52. if err != nil {
  53. panic("配置文件读取错误 " + err.Error())
  54. }
  55. logs.Info(RunMode + " 模式")
  56. MYSQL_URL = config["mysql_url"]
  57. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  58. //小程序appid配置
  59. WxAppId2 = `wx67b68e39913e511e`
  60. WxId2 = `wx67b68e39913e511e`
  61. WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c`
  62. WxPlatform2 = 5
  63. if RunMode == "release" {
  64. WxAppId = "wx4a844c734d8c8e56"
  65. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  66. WxId = "gh_b67e0049fb8c"
  67. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  68. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  69. WxPlatform = 1
  70. TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
  71. TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
  72. //oss
  73. STATIC_DIR = "/home/static/imgs/"
  74. Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
  75. } else {
  76. WxAppId = "wx9b5d7291e581233a"
  77. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  78. WxId = "gh_5dc508325c6f"
  79. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  80. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  81. WxPlatform = 1
  82. TemplateIdByCompanyApply = "eTalI1LbiT_B0mTaBeDTlfSMITenK8dQIgEB5yqjjvA"
  83. TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list"
  84. //oss配置
  85. STATIC_DIR = "static/imgs/"
  86. Endpoint = "oss-cn-shanghai.aliyuncs.com"
  87. }
  88. tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath")
  89. if err != nil {
  90. panic("配置文件读取libreOfficePath错误 " + err.Error())
  91. }
  92. LibreOfficePath = tmpLibreOfficePath
  93. //日志类
  94. if RunMode == "release" {
  95. logDir := `/data/rdlucklog/hongze_mobile_admin`
  96. ApiLog = log.Init("20060102.api", logDir)
  97. } else {
  98. ApiLog = log.Init("20060102.api")
  99. }
  100. }
  101. //http://webapi.brilliantstart.cn/api/
  102. //http://webapi.brilliantstart.cn/swagger/
  103. //http://139.196.122.219:8603/swagger/