config.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. )
  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. if RunMode == "" {
  51. RunMode = "release"
  52. configPath := `/home/code/config/hongze_mobile_admin/conf/app.conf`
  53. err := web.LoadAppConfig("ini", configPath)
  54. if err != nil {
  55. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  56. }
  57. }
  58. fmt.Println(RunMode, "模式")
  59. config, err := web.AppConfig.GetSection(RunMode)
  60. if err != nil {
  61. panic("配置文件读取错误 " + err.Error())
  62. }
  63. logs.Info(RunMode + " 模式")
  64. MYSQL_URL = config["mysql_url"]
  65. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  66. //小程序appid配置
  67. WxAppId2 = `wx67b68e39913e511e`
  68. WxId2 = `wx67b68e39913e511e`
  69. WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c`
  70. WxPlatform2 = 5
  71. if RunMode == "release" {
  72. WxAppId = "wx4a844c734d8c8e56"
  73. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  74. WxId = "gh_b67e0049fb8c"
  75. TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84"
  76. TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id="
  77. WxPlatform = 1
  78. TemplateIdByCompanyApply = "ZKcOfNIWBpwHJxpptufHIK1mp2nIwkT3cxub-35cFqI"
  79. TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list"
  80. //oss
  81. STATIC_DIR = "/home/static/imgs/"
  82. Endpoint = "oss-cn-shanghai-internal.aliyuncs.com"
  83. } else {
  84. WxAppId = "wx9b5d7291e581233a"
  85. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  86. WxId = "gh_5dc508325c6f"
  87. TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
  88. TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id="
  89. WxPlatform = 1
  90. TemplateIdByCompanyApply = "eTalI1LbiT_B0mTaBeDTlfSMITenK8dQIgEB5yqjjvA"
  91. TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list"
  92. //oss配置
  93. STATIC_DIR = "static/imgs/"
  94. Endpoint = "oss-cn-shanghai.aliyuncs.com"
  95. }
  96. tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath")
  97. if err != nil {
  98. panic("配置文件读取libreOfficePath错误 " + err.Error())
  99. }
  100. LibreOfficePath = tmpLibreOfficePath
  101. //日志类
  102. if RunMode == "release" {
  103. logDir := `/data/rdlucklog/hongze_mobile_admin`
  104. ApiLog = log.Init("20060102.api", logDir)
  105. } else {
  106. ApiLog = log.Init("20060102.api")
  107. }
  108. }
  109. //http://webapi.brilliantstart.cn/api/
  110. //http://webapi.brilliantstart.cn/swagger/
  111. //http://139.196.122.219:8603/swagger/