config.go 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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. WxMsgTemplateIdYXSpecialReview string //王芳、葛琳和沈涛--
  38. ActSendMsgMobile string //活动带问发送模板消息接收者的手机号
  39. YiDongZhengTongYunUrl string //易董 证通云请求域名
  40. YiDongZhengTongYunAppid string //易董 证通云请求appid
  41. YiDongZhengTongYunSecret string //易董 证通云请求secret
  42. YiDongHuaWeiYunUrl string //易董 华为云请求域名
  43. YiDonggetOriginalLink string //易董 短连接转为长链接
  44. )
  45. // 模板消息推送
  46. var (
  47. SendWxTemplateMsgUrl string
  48. SendWxCategoryTemplateMsgUrl string
  49. // 类目模板
  50. WxCategoryMsgTemplateIdApplyXzs string //申请待处理(买方研选)
  51. WxCategoryMsgTemplateIdActivitySign string //买方研选活动签到通知-类目模板ID(买方研选)
  52. WxMsgCategoryTemplateIdCompanyApprovalMessageRai string //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID
  53. WxMsgCategoryTemplateIdActivityPublishApply string //买方研选关注的产业下,单个活动/研选报告发布通知-类目模板ID
  54. )
  55. func init() {
  56. tmpRunMode, err := web.AppConfig.String("run_mode")
  57. if err != nil {
  58. panic("配置文件读取run_mode错误 " + err.Error())
  59. }
  60. RunMode = tmpRunMode
  61. if RunMode == "" {
  62. localIp, err := GetLocalIP()
  63. fmt.Println("localIp:", localIp)
  64. if localIp == "10.0.0.123" {
  65. RunMode = "debug"
  66. } else {
  67. RunMode = "release"
  68. }
  69. configPath := `/home/code/config/hongze_clpt/conf/app.conf`
  70. err = web.LoadAppConfig("ini", configPath)
  71. if err != nil {
  72. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  73. }
  74. }
  75. config, err := web.AppConfig.GetSection(RunMode)
  76. if err != nil {
  77. panic("配置文件读取错误 " + err.Error())
  78. }
  79. fmt.Println(RunMode + " 模式")
  80. MYSQL_URL = config["mysql_url"]
  81. MYSQL_URL_CYGX = config["mysql_url_cygx"]
  82. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  83. REDIS_CACHE = config["beego_cache"]
  84. if len(REDIS_CACHE) <= 0 {
  85. panic("redis链接参数没有配置")
  86. }
  87. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  88. if Re != nil {
  89. fmt.Println(Re)
  90. panic(Re)
  91. }
  92. WxAppId = "wxcc32b61f96720d2f"
  93. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  94. WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
  95. WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829"
  96. WxMsgTemplateIdYXSpecialReview = "18621268829,18258485832,18767183922" // 王芳、葛琳和沈涛
  97. if RunMode == "release" {
  98. WxPublicAppId = "wxb7cb8a15abad5b8e" //查研观向小助手
  99. WxPublicAppSecret = "f425ba2863084249722af1e2a5cfffd3" //查研观向小助手
  100. WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //申请待处理(小助手)
  101. WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM" ////预约取消提醒(小助手)
  102. WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  103. WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
  104. WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //手机号用户【XXX】发送模板消息模板ID(小助手)
  105. WxMsgTemplateIdArticleUserRemind = "fxnlsjx-gm3dAZVJf6f3w27wA7anETl42kexXLP8FDs"
  106. WxOpenAppId = "wx26ccbe242908ed73" //公众平台AppId
  107. WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8" //公众平台AppSecret
  108. IndexName = "cygx_article_v03_23"
  109. IndexNameComprehensive = "cygx_comprehensive"
  110. ActSendMsgMobile = "15618524605"
  111. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  112. SendWxCategoryTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_category_template_msg"
  113. // 类目模版
  114. WxCategoryMsgTemplateIdApplyXzs = "HKD03oZfSv8LJgeoHz0pynai3G2Ls4h8zZ6BfOpZmIA"
  115. WxCategoryMsgTemplateIdActivitySign = "11rITVC5Gl8qwetxl92NqY887Uk14kg3nPtEA_i_zLo"
  116. WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "t1CcxcOkoZkWZrDRs6zYUlceBGYMV3mhkBYUa8a6Mx0" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID
  117. WxMsgCategoryTemplateIdActivityPublishApply = "IBMqiE61lVgUfFM4rsH0XCH57R_G3PbWvRbnzg9JHPI"
  118. } else {
  119. WxPublicAppId = "wx9b5d7291e581233a" //弘则投研公众号 开发者ID(AppID)
  120. WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861" //弘则投研公众号秘钥
  121. WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //申请待处理(小助手)
  122. WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" ////预约取消提醒(小助手)
  123. WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  124. WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
  125. WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //手机号用户【XXX】发送模板消息模板ID(小助手)
  126. WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
  127. WxOpenAppId = "wx294d2825f451f851" //公众平台AppId
  128. WxOpenAppSecret = "7bf62d2d037280f8b635c6eca2f31db9" //公众平台AppSecret
  129. IndexName = "cygx_article_v1"
  130. IndexNameComprehensive = "cygx_comprehensive_test"
  131. ActSendMsgMobile = "17634786714"
  132. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  133. SendWxCategoryTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_category_template_msg"
  134. //SendWxCategoryTemplateMsgUrl = "http://8.136.199.33:8086/v1/wechat/send_category_template_msg"
  135. // 类目模版
  136. WxCategoryMsgTemplateIdApplyXzs = "IemWOTzbnLBqJ2ozSiFqm13WjaotoC3V4uXaxTij08I"
  137. WxCategoryMsgTemplateIdActivitySign = "aczgUYZASO97UJiCD_nDmD1eNWZAWudzw3JYcvjJ2x4"
  138. WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "wU4x_c5XruwuA44VZelyklRNOfq4XrU9ILckTtDs6hg" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID
  139. WxMsgCategoryTemplateIdActivityPublishApply = "wLeV7tVK4ZJBoAvsmfXkHveVW8yefGAkwnVKQWRi8uQ"
  140. }
  141. HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png"
  142. //易董开放api配置
  143. YiDongApiConfig()
  144. }
  145. // YiDongApiConfig 易董开放api配置
  146. func YiDongApiConfig() {
  147. if RunMode == "release" {
  148. YiDongZhengTongYunUrl = "https://services.valueonline.cn/"
  149. YiDongZhengTongYunAppid = "ca86a257ebb46fce"
  150. YiDongZhengTongYunSecret = "338db2b2ca86a257ebb46fced9003f53"
  151. YiDongHuaWeiYunUrl = "https://achievement.valueonline.cn/"
  152. YiDonggetOriginalLink = "https://services.easy-board.com.cn/short-link/getOriginalLink?shortKey="
  153. } else {
  154. YiDongZhengTongYunUrl = "https://services-dev.valueonline.cn/"
  155. YiDongZhengTongYunAppid = "d9bfb79627ac30d0"
  156. YiDongZhengTongYunSecret = "96a61dd2d9bfb79627ac30d02188bbe2"
  157. YiDongHuaWeiYunUrl = "https://achievement-test.valueonline.cn/"
  158. YiDonggetOriginalLink = "https://services-dev.valueonline.cn/short-link/getOriginalLink?shortKey="
  159. }
  160. }
  161. //http://webapi.brilliantstart.cn/api/
  162. //http://webapi.brilliantstart.cn/swagger/
  163. //http://139.196.122.219:8603/swagger/