config.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. YbCommonTemplateId string //研报小程序消息模板ID
  27. WxYbAppId string //微信研报小程序
  28. )
  29. //oss配置
  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. var (
  40. THS_SendUrl string //同花顺地址url
  41. THS_SyncWxGroupUrl string //同花顺同步微信群url
  42. THS_List_Url string // 同花顺报告列表地址url
  43. THS_PubKey string //同花顺公钥
  44. )
  45. // 经济数据库
  46. var (
  47. EDB_LIB_URL string
  48. )
  49. //进门财经账号信息
  50. var (
  51. COMEIN_URL string
  52. COMEIN_APPID string
  53. COMEIN_SECREKEY string
  54. )
  55. //模板消息推送
  56. var (
  57. SendWxTemplateMsgUrl string
  58. )
  59. func init() {
  60. tmpRunMode, err := web.AppConfig.String("run_mode")
  61. if err != nil {
  62. panic("配置文件读取run_mode错误 " + err.Error())
  63. }
  64. RunMode = tmpRunMode
  65. if RunMode == "" {
  66. localIp, err := GetLocalIP()
  67. fmt.Println("localIp:", localIp)
  68. if localIp == "10.0.0.123" {
  69. RunMode = "debug"
  70. } else {
  71. RunMode = "release"
  72. }
  73. //RunMode = "release"
  74. configPath := `/home/code/config/hongze_task/conf/app.conf`
  75. err = web.LoadAppConfig("ini", configPath)
  76. if err != nil {
  77. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  78. }
  79. }
  80. config, err := web.AppConfig.GetSection(RunMode)
  81. if err != nil {
  82. panic("配置文件读取错误 " + err.Error())
  83. }
  84. beego.Info(RunMode + " 模式")
  85. MYSQL_URL = config["mysql_url"]
  86. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  87. MYSQL_URL_EDB = config["mysql_url_edb"]
  88. MYSQL_URL_DATA = config["mysql_url_data"]
  89. MYSQL_URL_GL = config["mysql_url_gl"]
  90. //同花顺公钥
  91. THS_PubKey = `-----BEGIN PUBLIC KEY-----
  92. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqugglfCboOEfWtHlGBOW
  93. 40a4Y3xOs0MPBwjTOzHgcaWzx5XCc20VftGVXkWlpjs8u4dza/Bp1SV7SJ5Y7U95
  94. jgUOP8Js9Qgp6UVqBJDJf3i1KpjHzlk3ma8zxAYUAdieEUE+SKSxSY+BD9A6lpf5
  95. n+igXLmzR5GeVGFeLzoMhB1+pXgGhW30ao9wPwuRF7DBl+FKa/ACi7iXLiwXVgqT
  96. FFi29TKeerEENu3EpMXvPml7tNUiVmVW6d83hlascfbAlkShwuHLSGpLqK7brtg6
  97. jRS9hreKFKb0BUQ4TB26e7IDCstbMRvUp4+OGezexzic5NYPQ8uLo5OTaS7f7PrW
  98. ZwIDAQAB
  99. -----END PUBLIC KEY-----`
  100. WxYbAppId = "wxb059c872d79b9967" //弘则研报小程序
  101. if RunMode == "release" {
  102. CompanyId = 16
  103. RealName = "超级管理员"
  104. WxAppId = "wx4a844c734d8c8e56"
  105. WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  106. TemplateId = "P0klzaZjEI2UYth-z-WnmtOQgyxcF8klPoA_MlsA8Eo"
  107. RemindTemplateId = "PaHpQjVffrvmeW8wiOUcqlEhnD1LXyU9FnPVF-Jg9wM"
  108. //同花顺正式地址
  109. THS_SendUrl = `https://board.10jqka.com.cn/gateway/ps/syncNews`
  110. THS_SyncWxGroupUrl = `https://board.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  111. THS_List_Url = `https://board.10jqka.com.cn/gateway/ps/syncNews/listPage`
  112. //同花顺,万得接口服务地址(阿里云windows服务器地址;内网地址)
  113. Hz_Server_Data_Url = "http://172.19.173.231:7000/"
  114. EDB_LIB_URL = "http://172.19.173.232:8300/edbapi/"
  115. //EDB_LIB_URL = "http://47.102.213.75:8300/edbapi/"
  116. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  117. YbCommonTemplateId = "dYg6iHooRq74PyCXmw_Ns7qdJZmbtLoKS2p2FKeaXl0"
  118. } else {
  119. CompanyId = 16
  120. RealName = "超级管理员"
  121. AdminId = 11
  122. WxAppId = "wx9b5d7291e581233a"
  123. WxAppSecret = "f4d52e34021eee262dce9682b31f8861"
  124. TemplateId = "pDk4o924gSZWj80ZdNnHodnLMIXjPSlKZU0ciQMOhec"
  125. RemindTemplateId = "9JYV6sHMJlu2EHRBIj_8ift6wkrrTb9_UO-M_-YXKBw"
  126. AppointmentRemindTemplateId = `Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY` //活动预约通知模板id
  127. //同花顺测试地址
  128. THS_SendUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncNews`
  129. THS_SyncWxGroupUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncWechatGroupInfo`
  130. THS_List_Url = `https://mtest.10jqka.com.cn/gateway/ps/syncNews/listPage`
  131. //同花顺,万得接口服务地址(阿里云windows服务器地址;外网地址)
  132. Hz_Server_Data_Url = "http://139.196.136.213:7000/"
  133. EDB_LIB_URL = "http://8.136.199.33:8300/edbapi/"
  134. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  135. YbCommonTemplateId = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
  136. }
  137. // 进门财经开放api配置
  138. ComeinOpenApiConfig()
  139. }
  140. // ComeinOpenApiConfig 进门开放api配置
  141. func ComeinOpenApiConfig() {
  142. if RunMode == "release" {
  143. COMEIN_URL = "https://server.comein.cn/comein/index.php"
  144. COMEIN_APPID = "39b48779-debd-446a-a303-900322d8e356"
  145. COMEIN_SECREKEY = "9102a767f20f11ecb5d6b8599f142ed4"
  146. } else {
  147. COMEIN_URL = "https://testserver.comein.cn/comein/index.php"
  148. COMEIN_APPID = "7b966708-4a8b-4d24-9066-fe29920e7eee"
  149. COMEIN_SECREKEY = "76e004876fae4b3c8721a3f4c2d115da"
  150. }
  151. }
  152. //http://entryapi.brilliantstart.cn
  153. //http://entryapi.brilliantstart.cn/swagger/