config.go 5.6 KB

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