config.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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_RDDP string //数据库连接
  11. MYSQL_URL_TACTICS string
  12. MYSQL_URL_COMEIN_DATA 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. WxPublicIdXzs string //查研观向小助手公众号
  23. WxPublicSecretXzs string //查研观向小助手公众号
  24. WxMsgTemplateIdApply string //申请待处理
  25. WxMsgTemplateIdApplyXzs string //申请待处理(小助手)
  26. WxMsgTemplateIdApplyCancel string //预约取消提醒
  27. WxMsgTemplateIdApplyCancelXzs string //预约取消提醒(小助手)
  28. WxMsgTemplateIdPermissionApply string //预约取消提醒
  29. WxMsgTemplateIdActivityApply string //活动预约消息提醒
  30. WxMsgTemplateIdActivityApplyXzs string //活动预约消息提醒(小助手)
  31. WxMsgTemplateIdActivityChange string //活动预约变更提醒
  32. WxMsgTemplateIdAskMsg string //手机号用户【XXX】发送模板消息模板ID
  33. WxMsgTemplateIdAskMsgXzs string //手机号用户【XXX】发送模板消息模板ID(小助手)
  34. WxMsgTemplateIdAskMsgMobile string //手机号用户【XXX】发送模板消息
  35. WxMsgTemplateIdAskMsgMobileAll string //手机号用户【XXX】发送模板消rm --
  36. WxMsgTemplateIdAskMsgMobilePublic string //手机号用户【XXX】发送模板消rm --
  37. TemplateIdByProductXzs string //产品运行报告通知-模板ID(小助手)
  38. WxMsgTemplateIdArticleUserRemind string //用户阅读报告通知-模板ID
  39. WxMsgTemplateIdArticleUserRemindXzs string //用户阅读报告通知-模板ID(小助手)
  40. WxMsgTemplateIdActivityChangeApplyXzs string //查研观向活动变更通知-模板ID(小助手)
  41. WxMsgTemplateIdActivitySign string //查研观向活动签到通知-模板ID(小助手)
  42. )
  43. // 微信公众号配置信息
  44. var (
  45. WxPublicId string //微信原始ID
  46. WxPublicAppId string
  47. WxPublicAppSecret string
  48. WxPlatform = 4 //注册平台,1:日度点评公众号,2:管理后台,3:pc端网站,4:查研观向小程序
  49. )
  50. var (
  51. IndexName string
  52. IndexNameArticleHistory string //文章阅读记录Es索引
  53. OnlineTime string
  54. SummaryArticleId int
  55. YanxSummaryPermissionId int //研选纪要分类ID
  56. YanxViewpointPermissionId int //研选观点分类ID
  57. EmailTechnology string //科技行业专家邮箱
  58. EmailMedicine string //医药行业专家邮箱
  59. EmailConsumption string //消费行业专家邮箱
  60. EmailZhizao string //智造行业专家邮箱
  61. EmailStrategy string //策略行业专家邮箱
  62. EmailExpert string //研选行业专家邮箱
  63. EmaiWhiteUserList string //白名单邮箱
  64. IsTask bool //是否执行定时任务
  65. HtgjDefaultSaleName string //海通默认销售名称
  66. HtgjSalt string //海通加密使用的盐
  67. HtgjName string //海通国际名称
  68. HtgjPublicMobile string //海通国际公共请求的手机号
  69. ActSendMsgMobile string //研选活动带问发送模板消息接收者的手机号 (汪洋手机号)
  70. StrategyPlatform string //策略品台跳转链接地址
  71. ArticleTaskClassMobile string //策略平台报告自动归类消息通知对象
  72. YiDongZhengTongYunUrl string //易董 证通云请求域名
  73. YiDongZhengTongYunAppid string //易董 证通云请求appid
  74. YiDongZhengTongYunSecret string //易董 证通云请求secret
  75. YiDongHuaWeiYunUrl string //易董 华为云请求域名
  76. YiDonggetOriginalLink string //易董 短连接转为长链接
  77. ShangHaiCrmApiLink string //上海CRM用户同步api调用地址
  78. )
  79. // 模板消息推送
  80. var (
  81. SendWxTemplateMsgUrl string
  82. )
  83. func init() {
  84. tmpRunMode, err := web.AppConfig.String("run_mode")
  85. if err != nil {
  86. panic("配置文件读取run_mode错误 " + err.Error())
  87. }
  88. fmt.Println("line 80:", tmpRunMode, err)
  89. RunMode = tmpRunMode
  90. fmt.Println("RunMode:", RunMode)
  91. if RunMode == "" {
  92. localIp, err := GetLocalIP()
  93. fmt.Println("localIp:", localIp)
  94. if localIp == "10.0.0.123" {
  95. RunMode = "debug"
  96. } else {
  97. RunMode = "release"
  98. }
  99. fmt.Println("RunMode:", RunMode)
  100. configPath := `/home/code/config/hongze_cygx/conf/app.conf`
  101. fmt.Println("configPath:", configPath)
  102. err = web.LoadAppConfig("ini", configPath)
  103. if err != nil {
  104. fmt.Println("web.LoadAppConfig Err:" + err.Error())
  105. }
  106. }
  107. config, err := web.AppConfig.GetSection(RunMode)
  108. if err != nil {
  109. panic("配置文件读取错误 " + err.Error())
  110. }
  111. //beego.Info(RunMode + " 模式")
  112. MYSQL_URL = config["mysql_url"]
  113. MYSQL_URL_RDDP = config["mysql_url_rddp"]
  114. MYSQL_URL_TACTICS = config["mysql_url_tactics"]
  115. MYSQL_URL_COMEIN_DATA = config["mysql_url_comein_data"]
  116. REDIS_CACHE = config["beego_cache"]
  117. if len(REDIS_CACHE) <= 0 {
  118. panic("redis链接参数没有配置")
  119. }
  120. Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存
  121. if Re != nil {
  122. fmt.Println(Re)
  123. panic(Re)
  124. }
  125. IsTask, err = web.AppConfig.Bool("IsTask")
  126. if err != nil {
  127. panic("定时任务配置文件读取错误 " + err.Error())
  128. }
  129. OnlineTime = "2021-06-01 00:00:01" //上线时间
  130. SummaryArticleId = 1000000 //手动添加的纪要库开始ID
  131. YanxSummaryPermissionId = 1001 //研选纪要分类ID
  132. YanxViewpointPermissionId = 1002 //研选观点分类ID
  133. WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829,18955528215"
  134. WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829"
  135. HtgjDefaultSaleName = "王芳"
  136. HtgjSalt = "HTGJ&HZ"
  137. HtgjName = "海通国际"
  138. HtgjPublicMobile = "18767183955"
  139. StrategyPlatform = "https://vmp.hzinsights.com/v2/articles/"
  140. if RunMode == "release" {
  141. WxAppId = "wxcc32b61f96720d2f"
  142. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  143. WxId = "gh_a9d3744e1072"
  144. //模板消息ID
  145. WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  146. WxMsgTemplateIdApplyCancel = "iEi4YRHwcPbc2PSEF1pptc39H4NsAJPrUIPEk2ynwiA"
  147. WxMsgTemplateIdPermissionApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  148. WxMsgTemplateIdActivityApply = "MwZ5wxfd0O1Yt0Pkf6OkfWP4USQzZbiEo5SkZ26735s"
  149. WxPublicAppId = "wx4a844c734d8c8e56"
  150. WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb"
  151. WxPublicId = "gh_b67e0049fb8c"
  152. IndexName = "cygx_article_v03_23"
  153. IndexNameArticleHistory = "cygx_article_history_v07_08"
  154. //接收附件邮箱
  155. EmailTechnology = "mlluo@hzinsights.com;jxu@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com;hwang@hzinsights.com;rli@hzinsights.com" //科技行业专家邮箱
  156. EmailMedicine = "xlzheng@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com;yxyan@hzinsights.com;ppwang@hzinsights.com" //医药行业专家邮箱
  157. EmailConsumption = "yrhuang@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com;jxu@hzinsights.com;hychen@hzinsights.com;lwang@hzinsights.com" //消费行业专家邮箱
  158. EmailZhizao = "xfma@hzinsights.com;agne@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com;kfyu@hzinsights.com" //智造行业专家邮箱
  159. EmailStrategy = "experts@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com" //策略行业专家邮箱
  160. EmailExpert = "experts@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jhwang@hzinsights.com" //研选行业专家邮箱
  161. EmaiWhiteUserList = "tshen@hzinsights.com;cxzhang@hzinsights.com;yyli@hzinsights.com" //白名单邮箱
  162. WxMsgTemplateIdAskMsg = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk"
  163. WxMsgTemplateIdArticleUserRemind = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s"
  164. WxMsgTemplateIdAskMsgMobile = ""
  165. //ActSendMsgMobile = "15618524605"
  166. ActSendMsgMobile = "18955528215" // 汪洋手机号
  167. ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672"
  168. ShangHaiCrmApiLink = "https://crm.hzinsights.com/"
  169. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  170. } else {
  171. WxAppId = "wxcc32b61f96720d2f"
  172. WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
  173. WxId = "gh_a9d3744e1072"
  174. //模板消息ID
  175. WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  176. WxMsgTemplateIdApplyCancel = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
  177. WxMsgTemplateIdPermissionApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  178. WxMsgTemplateIdActivityApply = "Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY"
  179. WxMsgTemplateIdActivityChange = "qfNuops-CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
  180. WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
  181. WxPublicAppId = "wx9b5d7291e581233a"
  182. WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861"
  183. WxPublicId = "gh_5dc508325c6f"
  184. IndexName = "cygx_article_v1"
  185. IndexNameArticleHistory = "cygx_article_history_v1"
  186. //接收附件邮箱
  187. EmailTechnology = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //科技行业专家邮箱
  188. EmailMedicine = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //医药行业专家邮箱
  189. EmailConsumption = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //消费行业专家邮箱
  190. EmailZhizao = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //智造行业专家邮箱
  191. EmailStrategy = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //策略行业专家邮箱
  192. EmailExpert = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //研选行业专家邮箱
  193. EmaiWhiteUserList = "cxzhang@hzinsights.com"
  194. WxMsgTemplateIdAskMsg = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
  195. WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
  196. ActSendMsgMobile = "15557270714"
  197. ArticleTaskClassMobile = "15557270714,18767183922,17706316791"
  198. ShangHaiCrmApiLink = "http://106.15.192.100:8100/"
  199. SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg"
  200. }
  201. //查研观向小助手
  202. if RunMode != "release" {
  203. //原有的模板ID
  204. WxPublicIdXzs = "wx9b5d7291e581233a" //查研观向小助手
  205. WxPublicSecretXzs = "f4d52e34021eee262dce9682b31f8861" //查研观向小助手
  206. WxMsgTemplateIdActivityApplyXzs = "U3su--7d6xsCDcP6Tya0N0wWpKn_uI0zO1cutRK52cc" //活动预约消息提醒(小助手)
  207. WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //手机号用户【XXX】发送模板消息模板ID(小助手)
  208. WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //申请待处理(小助手)
  209. WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" ////预约取消提醒(小助手)
  210. TemplateIdByProductXzs = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" //产品运行报告通知-模板ID(小助手)
  211. WxMsgTemplateIdActivityChangeApplyXzs = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //查研观向活动变更通知-模板ID(小助手)
  212. WxMsgTemplateIdActivitySign = "3l5cxpqH6c9kkLe9ow7qzqd0uYEOdY3A_PB8wRWkiHk" //查研观向活动签到通知-模板ID(小助手)
  213. } else {
  214. //新的模板ID
  215. WxPublicIdXzs = "wxb7cb8a15abad5b8e" //查研观向小助手
  216. WxPublicSecretXzs = "f425ba2863084249722af1e2a5cfffd3" //查研观向小助手
  217. WxMsgTemplateIdActivityApplyXzs = "mItHdTF6swcunM4P36lOjnLknGbHaLqYdbOsRKscBq4" //活动预约消息提醒(小助手)
  218. WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //手机号用户【XXX】发送模板消息模板ID(小助手)
  219. WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //申请待处理(小助手)
  220. WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM" ////预约取消提醒(小助手)
  221. TemplateIdByProductXzs = "tNcCUiK_uUkuxaFF7M9NP2RwLkw8uHFjG-TDIxGUKxo" //产品运行报告通知-模板ID(小助手)
  222. WxMsgTemplateIdActivityChangeApplyXzs = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" //查研观向活动变更通知-模板ID(小助手)
  223. WxMsgTemplateIdActivitySign = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" //查研观向活动签到通知-模板ID(小助手)
  224. }
  225. //易董开放api配置
  226. YiDongApiConfig()
  227. }
  228. // YiDongApiConfig 易董开放api配置
  229. func YiDongApiConfig() {
  230. if RunMode == "release" {
  231. YiDongZhengTongYunUrl = "https://services.valueonline.cn/"
  232. YiDongZhengTongYunAppid = "ca86a257ebb46fce"
  233. YiDongZhengTongYunSecret = "338db2b2ca86a257ebb46fced9003f53"
  234. YiDongHuaWeiYunUrl = "https://achievement.valueonline.cn/"
  235. YiDonggetOriginalLink = "https://services.easy-board.com.cn/short-link/getOriginalLink?shortKey="
  236. } else {
  237. YiDongZhengTongYunUrl = "https://services-dev.valueonline.cn/"
  238. YiDongZhengTongYunAppid = "d9bfb79627ac30d0"
  239. YiDongZhengTongYunSecret = "96a61dd2d9bfb79627ac30d02188bbe2"
  240. YiDongHuaWeiYunUrl = "https://achievement-test.valueonline.cn/"
  241. YiDonggetOriginalLink = "https://services-dev.valueonline.cn/short-link/getOriginalLink?shortKey="
  242. }
  243. }
  244. //
  245. //YiDongZhengTongYunUrl string //易董 证通云请求域名
  246. //YiDongZhengTongYunAppid string //易董 证通云请求appid
  247. //YiDongZhengTongYunSecret string //易董 证通云请求secret
  248. //YiDongHuaWeiYunUrl string //易董 华为云请求域名
  249. //http://webapi.brilliantstart.cn/api/
  250. //http://webapi.brilliantstart.cn/swagger/
  251. //http://139.196.122.219:8603/swagger/