config.go 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. package utils
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/server/web"
  5. "github.com/rdlucklib/rdluck_tools/cache"
  6. )
  7. var (
  8. RunMode string //运行模式
  9. MYSQL_URL string //数据库连接
  10. MYSQL_URL_CYGX string //查研观向数据库连接
  11. MYSQL_URL_RDDP string //数据库连接
  12. MYSQL_URL_TACTICS string
  13. REDIS_CACHE string //缓存地址
  14. Rc *cache.Cache //redis缓存
  15. Re error //redis错误
  16. )
  17. // 微信配置信息
  18. var (
  19. WxId string //微信原始ID
  20. WxAppId string //查研观向小程序
  21. WxAppSecret string //查研观向小程序
  22. WxPublicAppId string //查研观向小助手公众号
  23. WxPublicAppSecret string //查研观向小助手公众号
  24. WxOpenAppId string //公众平台AppId
  25. WxOpenAppSecret string //公众平台AppSecret
  26. HeadimgurlDefault string //默认头像
  27. WxMsgTemplateIdApplyXzs string //申请待处理(小助手)
  28. WxMsgTemplateIdApplyCancelXzs string //预约取消提醒(小助手)
  29. WxMsgTemplateIdApply string //申请待处理
  30. WxMsgTemplateIdAskMsgMobile string //手机号用户【XXX】发送模板消息
  31. WxMsgTemplateIdAskMsgMobileAll string //手机号用户【XXX】发送模板消rm --
  32. WxMsgTemplateIdAskMsgXzs string //手机号用户【XXX】发送模板消息模板ID(小助手)
  33. IndexName string
  34. IndexNameComprehensive string //综合搜索Es索引
  35. WxMsgTemplateIdAskMsgMobilePublic string //手机号用户【XXX】发送模板消rm --
  36. WxMsgTemplateIdArticleUserRemind string //用户阅读报告通知-模板ID
  37. ActSendMsgMobile string //活动带问发送模板消息接收者的手机号
  38. YiDongZhengTongYunUrl string //易董 证通云请求域名
  39. YiDongZhengTongYunAppid string //易董 证通云请求appid
  40. YiDongZhengTongYunSecret string //易董 证通云请求secret
  41. YiDongHuaWeiYunUrl string //易董 华为云请求域名
  42. YiDonggetOriginalLink string //易董 短连接转为长链接
  43. )
  44. // 模板消息推送
  45. var (
  46. SendWxTemplateMsgUrl string
  47. WxPlatform = 11 //注册平台,1:日度点评公众号,2:管理后台,3:pc端网站,4:查研观向小程序 ,11:买方研选网页版
  48. WxPayJsapiNotifyUrl string //微信小程序支付下单回调接口
  49. )
  50. func init() {
  51. tmpRunMode, err := web.AppConfig.String("run_mode")
  52. if err != nil {
  53. panic("配置文件读取run_mode错误 " + err.Error())
  54. }
  55. RunMode = tmpRunMode
  56. if RunMode == "" {
  57. localIp, err := GetLocalIP()
  58. fmt.Println("localIp:", localIp)
  59. if localIp == "10.0.0.123" {
  60. RunMode = "debug"
  61. } else {
  62. RunMode = "release"
  63. }
  64. configPath := `/home/code/config/hongze_web_mfyx/conf/app.conf`
  65. err = web.LoadAppConfig("ini", configPath)
  66. if err != nil {
  67. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  68. }
  69. }
  70. config, err := web.AppConfig.GetSection(RunMode)
  71. if err != nil {
  72. panic("配置文件读取错误 " + err.Error())
  73. }
  74. fmt.Println(RunMode + " 模式")
  75. MYSQL_URL = config["mysql_url"]
  76. MYSQL_URL_CYGX = config["mysql_url_cygx"]
  77. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  78. REDIS_CACHE = config["beego_cache"]
  79. if len(REDIS_CACHE) <= 0 {
  80. panic("redis链接参数没有配置")
  81. }
  82. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  83. if Re != nil {
  84. fmt.Println(Re)
  85. panic(Re)
  86. }
  87. WxAppId = "wxcc32b61f96720d2f"
  88. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  89. WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829,18955528215"
  90. WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829"
  91. if RunMode == "release" {
  92. WxPublicAppId = "wx2f85cdbe74585222" //买方研选公众号AppId
  93. WxPublicAppSecret = "98e4a09c9ba6a0b34e0df3192ba1aba3" //买方研选公众号AppSecret
  94. WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //申请待处理(小助手)
  95. WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM" ////预约取消提醒(小助手)
  96. WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  97. WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
  98. WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //手机号用户【XXX】发送模板消息模板ID(小助手)
  99. WxMsgTemplateIdArticleUserRemind = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s"
  100. WxOpenAppId = "wx005a32084fc70bf0" //公众平台AppId
  101. WxOpenAppSecret = "caf5bd02ef4b768872027ce01c4b114b" //公众平台AppSecret
  102. IndexName = "cygx_article_v03_23"
  103. IndexNameComprehensive = "cygx_comprehensive"
  104. ActSendMsgMobile = "15618524605"
  105. WxPayJsapiNotifyUrl = "https://mfyx.hzinsights.com/api/wechat/wxpay/notify"
  106. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  107. } else {
  108. WxPublicAppId = "wx9b5d7291e581233a" //弘则投研公众号 开发者ID(AppID)
  109. WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861" //弘则投研公众号秘钥
  110. WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //申请待处理(小助手)
  111. WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" ////预约取消提醒(小助手)
  112. WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  113. WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
  114. WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //手机号用户【XXX】发送模板消息模板ID(小助手)
  115. WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
  116. WxOpenAppId = "wx3c1f6106f5ecadf6" //公众平台AppId
  117. WxOpenAppSecret = "0b98982bdcb12d6f0828bb9f2fed9cab" //公众平台AppSecret
  118. IndexName = "cygx_article_v1"
  119. IndexNameComprehensive = "cygx_comprehensive_test"
  120. ActSendMsgMobile = "17634786714"
  121. WxPayJsapiNotifyUrl = "https://testmfyx.hzinsights.com/api/wechat/wxpay/notify"
  122. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  123. }
  124. HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png"
  125. //易董开放api配置
  126. YiDongApiConfig()
  127. }
  128. // YiDongApiConfig 易董开放api配置
  129. func YiDongApiConfig() {
  130. if RunMode == "release" {
  131. YiDongZhengTongYunUrl = "https://services.valueonline.cn/"
  132. YiDongZhengTongYunAppid = "ca86a257ebb46fce"
  133. YiDongZhengTongYunSecret = "338db2b2ca86a257ebb46fced9003f53"
  134. YiDongHuaWeiYunUrl = "https://achievement.valueonline.cn/"
  135. YiDonggetOriginalLink = "https://services.easy-board.com.cn/short-link/getOriginalLink?shortKey="
  136. } else {
  137. YiDongZhengTongYunUrl = "https://services-dev.valueonline.cn/"
  138. YiDongZhengTongYunAppid = "d9bfb79627ac30d0"
  139. YiDongZhengTongYunSecret = "96a61dd2d9bfb79627ac30d02188bbe2"
  140. YiDongHuaWeiYunUrl = "https://achievement-test.valueonline.cn/"
  141. YiDonggetOriginalLink = "https://services-dev.valueonline.cn/short-link/getOriginalLink?shortKey="
  142. }
  143. }
  144. //http://webapi.brilliantstart.cn/api/
  145. //http://webapi.brilliantstart.cn/swagger/
  146. //http://139.196.122.219:8603/swagger/