config.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. package utils
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/core/logs"
  5. "github.com/beego/beego/v2/server/web"
  6. )
  7. var (
  8. RunMode string //运行模式
  9. MYSQL_URL string //数据库连接
  10. MYSQL_URL_RDDP string //数据库连接
  11. )
  12. //微信配置信息
  13. var (
  14. WxId string //微信原始ID
  15. WxAppId string
  16. WxAppSecret string
  17. TemplateIdByProduct string //产品运行报告通知-模板ID
  18. TemplateRedirectUrl string //模板消息跳转地址
  19. WxPlatform int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  20. TemplateIdByCompanyApply string //客户申请单审批通知-模板ID
  21. TemplateCompanyApplyRedirectUrl string //审批单模板消息跳转地址
  22. //微信小程序appid
  23. WxId2 string //微信原始ID
  24. WxAppId2 string
  25. WxAppSecret2 string
  26. WxPlatform2 int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  27. )
  28. var (
  29. STATIC_DIR string
  30. )
  31. // LibreOfficePath LibreOfficePath的地址
  32. var LibreOfficePath string
  33. var (
  34. Bucketname string = "hongze"
  35. Endpoint string
  36. Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/"
  37. Upload_dir string = "static/images/"
  38. Upload_Audio_Dir string = "static/audio/"
  39. AccessKeyId string = "LTAIFMZYQhS2BTvW"
  40. AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
  41. )
  42. func init() {
  43. tmpRunMode, err := web.AppConfig.String("run_mode")
  44. if err != nil {
  45. panic("配置文件读取run_mode错误 " + err.Error())
  46. }
  47. RunMode = tmpRunMode
  48. fmt.Println(RunMode, "模式")
  49. config, err := web.AppConfig.GetSection(RunMode)
  50. if err != nil {
  51. panic("配置文件读取错误 " + err.Error())
  52. }
  53. logs.Info(RunMode + " 模式")
  54. MYSQL_URL = config["mysql_url"]
  55. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  56. //小程序appid配置
  57. WxAppId2 = `wx67b68e39913e511e`
  58. WxId2 = `wx67b68e39913e511e`
  59. WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c`
  60. WxPlatform2 = 5
  61. if RunMode == "release" {
  62. WxAppId = "wx4a844c734d8c8e56"
  63. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  64. WxId = "gh_b67e0049fb8c"
  65. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  66. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  67. WxPlatform = 1
  68. TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
  69. TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
  70. //oss
  71. STATIC_DIR = "/home/static/imgs/"
  72. Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
  73. } else {
  74. WxAppId = "wx9b5d7291e581233a"
  75. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  76. WxId = "gh_5dc508325c6f"
  77. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  78. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  79. WxPlatform = 1
  80. TemplateIdByCompanyApply = "eTalI1LbiT_B0mTaBeDTlfSMITenK8dQIgEB5yqjjvA"
  81. TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list"
  82. //oss配置
  83. STATIC_DIR = "static/imgs/"
  84. Endpoint = "oss-cn-shanghai.aliyuncs.com"
  85. }
  86. tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath")
  87. if err != nil {
  88. panic("配置文件读取libreOfficePath错误 " + err.Error())
  89. }
  90. LibreOfficePath = tmpLibreOfficePath
  91. }
  92. //http://webapi.brilliantstart.cn/api/
  93. //http://webapi.brilliantstart.cn/swagger/
  94. //http://139.196.122.219:8603/swagger/