config.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. // 经济数据库
  44. var (
  45. EDB_LIB_URL string
  46. )
  47. func init() {
  48. tmpRunMode, err := web.AppConfig.String("run_mode")
  49. if err != nil {
  50. panic("配置文件读取run_mode错误 " + err.Error())
  51. }
  52. RunMode = tmpRunMode
  53. if RunMode == "" {
  54. RunMode = "release"
  55. configPath := `/home/code/config/hongze_task/conf/app.conf`
  56. err := web.LoadAppConfig("ini", configPath)
  57. if err != nil {
  58. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  59. }
  60. }
  61. config, err := web.AppConfig.GetSection(RunMode)
  62. if err != nil {
  63. panic("配置文件读取错误 " + err.Error())
  64. }
  65. beego.Info(RunMode + " 模式")
  66. MYSQL_URL = config["mysql_url"]
  67. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  68. MYSQL_URL_EDB = config["mysql_url_edb"]
  69. MYSQL_URL_DATA = config["mysql_url_data"]
  70. MYSQL_URL_GL = config["mysql_url_gl"]
  71. //同花顺公钥
  72. THS_PubKey = `-----BEGIN PUBLIC KEY-----
  73. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqugglfCboOEfWtHlGBOW
  74. 40a4Y3xOs0MPBwjTOzHgcaWzx5XCc20VftGVXkWlpjs8u4dza/Bp1SV7SJ5Y7U95
  75. jgUOP8Js9Qgp6UVqBJDJf3i1KpjHzlk3ma8zxAYUAdieEUE+SKSxSY+BD9A6lpf5
  76. n+igXLmzR5GeVGFeLzoMhB1+pXgGhW30ao9wPwuRF7DBl+FKa/ACi7iXLiwXVgqT
  77. FFi29TKeerEENu3EpMXvPml7tNUiVmVW6d83hlascfbAlkShwuHLSGpLqK7brtg6
  78. jRS9hreKFKb0BUQ4TB26e7IDCstbMRvUp4+OGezexzic5NYPQ8uLo5OTaS7f7PrW
  79. ZwIDAQAB
  80. -----END PUBLIC KEY-----`
  81. WxYbAppId = "wxb059c872d79b9967" //弘则研报小程序
  82. if RunMode == "release" {
  83. CompanyId = 16
  84. RealName = "超级管理员"
  85. WxAppId = "wx4a844c734d8c8e56"
  86. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  87. TemplateId = "P0klzaZjEI2UYth-z-WnmtOQgyxcF8klPoA_MlsA8Eo"
  88. RemindTemplateId = "PaHpQjVffrvmeW8wiOUcqlEhnD1LXyU9FnPVF-Jg9wM"
  89. //同花顺正式地址
  90. THS_SendUrl = `https://board.10jqka.com.cn/gateway/ps/syncNews`
  91. THS_SyncWxGroupUrl = `https://board.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  92. //同花顺,万得接口服务地址(阿里云windows服务器地址;内网地址)
  93. Hz_Server_Data_Url = "http://172.19.173.231:7000/"
  94. EDB_LIB_URL = "http://172.19.173.232:8300/edbapi/"
  95. //EDB_LIB_URL = "http://47.102.213.75:8300/edbapi/"
  96. } else {
  97. CompanyId = 16
  98. RealName = "超级管理员"
  99. AdminId = 11
  100. WxAppId = "wx9b5d7291e581233a"
  101. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  102. TemplateId = "pDk4o924gSZWj80ZdNnHodnLMIXjPSlKZU0ciQMOhec"
  103. RemindTemplateId = "9JYV6sHMJlu2EHRBIj_8ift6wkrrTb9_UO-M_-YXKBw"
  104. AppointmentRemindTemplateId = `Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY` //活动预约通知模板id
  105. //同花顺测试地址
  106. THS_SendUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncNews`
  107. THS_SyncWxGroupUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  108. //同花顺,万得接口服务地址(阿里云windows服务器地址;外网地址)
  109. Hz_Server_Data_Url = "http://139.196.136.213:7000/"
  110. EDB_LIB_URL = "http://8.136.199.33:8300/edbapi/"
  111. }
  112. }
  113. //http://entryapi.brilliantstart.cn
  114. //http://entryapi.brilliantstart.cn/swagger/