config.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package utils
  2. import (
  3. "fmt"
  4. beego "github.com/beego/beego/v2/adapter"
  5. "github.com/beego/beego/v2/server/web"
  6. )
  7. var (
  8. RunMode string //运行模式
  9. MYSQL_URL string //数据库连接
  10. MYSQL_URL_RDDP string //数据库连接
  11. MYSQL_URL_EDB string
  12. MYSQL_URL_DATA string
  13. MYSQL_URL_GL string
  14. )
  15. var (
  16. CompanyId int
  17. AdminId int
  18. RealName string
  19. )
  20. var (
  21. WxAppId string
  22. WxAppSecret string
  23. TemplateId string
  24. RemindTemplateId string
  25. AppointmentRemindTemplateId string //活动预约通知模板id
  26. WxYbAppId string //微信研报小程序
  27. )
  28. //oss配置
  29. var (
  30. Bucketname string = "hongze"
  31. Endpoint string
  32. Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/"
  33. Upload_dir string = "static/images/"
  34. Upload_Audio_Dir string = "static/audio/"
  35. AccessKeyId string = "LTAIFMZYQhS2BTvW"
  36. AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
  37. )
  38. var (
  39. THS_SendUrl string //同花顺地址url
  40. THS_SyncWxGroupUrl string //同花顺同步微信群url
  41. THS_PubKey string //同花顺公钥
  42. )
  43. func init() {
  44. tmpRunMode, err := web.AppConfig.String("run_mode")
  45. if err != nil {
  46. panic("配置文件读取run_mode错误 " + err.Error())
  47. }
  48. RunMode = tmpRunMode
  49. if RunMode == "" {
  50. RunMode = "release"
  51. configPath := `/home/code/config/hongze_task/conf/app.conf`
  52. err := web.LoadAppConfig("ini", configPath)
  53. if err != nil {
  54. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  55. }
  56. }
  57. config, err := web.AppConfig.GetSection(RunMode)
  58. if err != nil {
  59. panic("配置文件读取错误 " + err.Error())
  60. }
  61. beego.Info(RunMode + " 模式")
  62. MYSQL_URL = config["mysql_url"]
  63. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  64. MYSQL_URL_EDB = config["mysql_url_edb"]
  65. MYSQL_URL_DATA = config["mysql_url_data"]
  66. MYSQL_URL_GL = config["mysql_url_gl"]
  67. //同花顺公钥
  68. THS_PubKey = `-----BEGIN PUBLIC KEY-----
  69. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqugglfCboOEfWtHlGBOW
  70. 40a4Y3xOs0MPBwjTOzHgcaWzx5XCc20VftGVXkWlpjs8u4dza/Bp1SV7SJ5Y7U95
  71. jgUOP8Js9Qgp6UVqBJDJf3i1KpjHzlk3ma8zxAYUAdieEUE+SKSxSY+BD9A6lpf5
  72. n+igXLmzR5GeVGFeLzoMhB1+pXgGhW30ao9wPwuRF7DBl+FKa/ACi7iXLiwXVgqT
  73. FFi29TKeerEENu3EpMXvPml7tNUiVmVW6d83hlascfbAlkShwuHLSGpLqK7brtg6
  74. jRS9hreKFKb0BUQ4TB26e7IDCstbMRvUp4+OGezexzic5NYPQ8uLo5OTaS7f7PrW
  75. ZwIDAQAB
  76. -----END PUBLIC KEY-----`
  77. WxYbAppId = "wxb059c872d79b9967" //弘则研报小程序
  78. if RunMode == "release" {
  79. CompanyId = 16
  80. RealName = "超级管理员"
  81. WxAppId = "wx4a844c734d8c8e56"
  82. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  83. TemplateId = "P0klzaZjEI2UYth-z-WnmtOQgyxcF8klPoA_MlsA8Eo"
  84. RemindTemplateId = "PaHpQjVffrvmeW8wiOUcqlEhnD1LXyU9FnPVF-Jg9wM"
  85. //同花顺正式地址
  86. THS_SendUrl = `https://board.10jqka.com.cn/gateway/ps/syncNews`
  87. THS_SyncWxGroupUrl = `https://board.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  88. //同花顺,万得接口服务地址(阿里云windows服务器地址;内网地址)
  89. Hz_Server_Data_Url = "http://172.19.173.231:7000/"
  90. } else {
  91. CompanyId = 16
  92. RealName = "超级管理员"
  93. AdminId = 11
  94. WxAppId = "wx9b5d7291e581233a"
  95. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  96. TemplateId = "pDk4o924gSZWj80ZdNnHodnLMIXjPSlKZU0ciQMOhec"
  97. RemindTemplateId = "9JYV6sHMJlu2EHRBIj_8ift6wkrrTb9_UO-M_-YXKBw"
  98. AppointmentRemindTemplateId = `Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY` //活动预约通知模板id
  99. //同花顺测试地址
  100. THS_SendUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncNews`
  101. THS_SyncWxGroupUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  102. //同花顺,万得接口服务地址(阿里云windows服务器地址;外网地址)
  103. Hz_Server_Data_Url = "http://139.196.136.213:7000/"
  104. }
  105. }
  106. //http://entryapi.brilliantstart.cn
  107. //http://entryapi.brilliantstart.cn/swagger/