config.go 15 KB

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