config.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. //微信小程序appid
  22. WxId2 string //微信原始ID
  23. WxAppId2 string
  24. WxAppSecret2 string
  25. WxPlatform2 int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1
  26. )
  27. var (
  28. STATIC_DIR string
  29. )
  30. var (
  31. Bucketname string = "hongze"
  32. Endpoint string
  33. Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/"
  34. Upload_dir string = "static/images/"
  35. Upload_Audio_Dir string = "static/audio/"
  36. AccessKeyId string = "LTAIFMZYQhS2BTvW"
  37. AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
  38. )
  39. func init() {
  40. tmpRunMode, err := web.AppConfig.String("run_mode")
  41. if err != nil {
  42. panic("配置文件读取run_mode错误 " + err.Error())
  43. }
  44. RunMode = tmpRunMode
  45. fmt.Println(RunMode, "模式")
  46. config, err := web.AppConfig.GetSection(RunMode)
  47. if err != nil {
  48. panic("配置文件读取错误 " + err.Error())
  49. }
  50. logs.Info(RunMode + " 模式")
  51. MYSQL_URL = config["mysql_url"]
  52. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  53. //小程序appid配置
  54. WxAppId2 = `wx67b68e39913e511e`
  55. WxId2 = `wx67b68e39913e511e`
  56. WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c`
  57. WxPlatform2 = 5
  58. if RunMode == "release" {
  59. WxAppId = "wx4a844c734d8c8e56"
  60. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  61. WxId = "gh_b67e0049fb8c"
  62. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  63. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  64. WxPlatform = 1
  65. TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
  66. //oss
  67. STATIC_DIR = "/home/static/imgs/"
  68. Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
  69. } else {
  70. WxAppId = "wx9b5d7291e581233a"
  71. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  72. WxId = "gh_5dc508325c6f"
  73. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  74. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  75. WxPlatform = 1
  76. TemplateIdByCompanyApply = "eTalI1LbiT_B0mTaBeDTlfSMITenK8dQIgEB5yqjjvA"
  77. //oss配置
  78. STATIC_DIR = "static/imgs/"
  79. Endpoint = "oss-cn-shanghai.aliyuncs.com"
  80. }
  81. }
  82. //http://webapi.brilliantstart.cn/api/
  83. //http://webapi.brilliantstart.cn/swagger/
  84. //http://139.196.122.219:8603/swagger/