package utils import ( "fmt" "github.com/beego/beego/v2/server/web" "github.com/rdlucklib/rdluck_tools/cache" "strconv" ) var ( RunMode string //运行模式 MYSQL_URL string //数据库连接 MYSQL_URL_CYGX string //查研观向数据库连接 MYSQL_URL_RDDP string //数据库连接 MYSQL_URL_TACTICS string MYSQL_URL_COMEIN_DATA string // 路演记录数据库 REDIS_CACHE string //缓存地址 Rc *cache.Cache //redis缓存 Re error //redis错误 ) // 微信配置信息 var ( WxId string //微信原始ID WxAppId string //买方研选小程序 WxAppSecret string //买方研选小程序 WxPublicIdXzs string //查研观向小助手公众号 WxPublicSecretXzs string //查研观向小助手公众号 WxMsgTemplateIdApply string //申请待处理 WxMsgTemplateIdApplyXzs string //申请待处理(小助手) WxMsgTemplateIdApplyCancel string //预约取消提醒 WxMsgTemplateIdApplyCancelXzs string //预约取消提醒(小助手) WxMsgTemplateIdPermissionApply string //预约取消提醒 WxMsgTemplateIdActivityApply string //活动预约消息提醒 WxMsgTemplateIdActivityApplyXzs string //活动预约消息提醒(小助手) WxMsgTemplateIdActivityChange string //活动预约变更提醒 WxMsgTemplateIdAskMsg string //手机号用户【XXX】发送模板消息模板ID WxMsgTemplateIdAskMsgXzs string //手机号用户【XXX】发送模板消息模板ID(小助手) WxMsgTemplateIdAskMsgMobile string //手机号用户【XXX】发送模板消息 WxMsgTemplateIdAskMsgMobileAll string //手机号用户【XXX】发送模板消rm -- WxMsgTemplateIdAskMsgMobilePublic string //手机号用户【XXX】发送模板消rm -- WxMsgTemplateIdYXSpecialReview string //王芳、葛琳和沈涛-- TemplateIdByProductXzs string //产品运行报告通知-模板ID(小助手) WxMsgTemplateIdArticleUserRemind string //用户阅读报告通知-模板ID WxMsgCategoryTemplateIdArticleUserRemind string //用户阅读报告通知-类目模板ID WxMsgTemplateIdArticleUserRemindXzs string //用户阅读报告通知-模板ID(小助手) WxMsgTemplateIdActivityChangeApplyXzs string //查研观向活动变更通知-模板ID(小助手) WxMsgTemplateIdActivitySign string //查研观向活动签到通知-模板ID(小助手) // 类目模板 WxCategoryMsgTemplateIdApplyXzs string //申请待处理(买方研选) WxCategoryMsgTemplateIdActivitySign string //买方研选活动签到通知-类目模板ID(买方研选) WxMsgCategoryTemplateIdCompanyApprovalMessageRai string //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply string //买方研选关注的产业下,单个活动/研选报告发布通知-类目模板ID WxMsgCategoryTemplateIdAddMessage string //专栏文章留言-类目模板ID //权益内容组手机号 RAI_MOBILE_GAO_YI_WEN string // 权益高亦文手机号 RAI_MOBILE_DONG_HENG string // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI string // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN string // 权益葛琳手机号 ) // 微信公众号配置信息 var ( WxPublicId string //微信原始ID WxPublicAppId string WxPublicAppSecret string WxPlatform = 10 //注册平台,1:日度点评公众号,2:管理后台,3:pc端网站,4:查研观向小程序 WxPayJsapiNotifyUrl string //微信小程序支付下单回调接口 ) var ( IndexName string IndexNameArticleHistory string //文章阅读记录Es索引 IndexNameComprehensive string //综合搜索Es索引 OnlineTime string SummaryArticleId int YanxSummaryPermissionId int //研选纪要分类ID YanxViewpointPermissionId int //研选观点分类ID EmailTechnology string //科技行业专家邮箱 EmailMedicine string //医药行业专家邮箱 EmailConsumption string //消费行业专家邮箱 EmailZhizao string //智造行业专家邮箱 EmailStrategy string //策略行业专家邮箱 EmailExpert string //研选行业专家邮箱 EmaiWhiteUserList string //白名单邮箱 IsTask bool //是否执行定时任务 HtgjDefaultSaleName string //海通默认销售名称 HtgjSalt string //海通加密使用的盐 HtgjName string //海通国际名称 HtgjPublicMobile string //海通国际公共请求的手机号 ActSendMsgMobile string //研选活动带问发送模板消息接收者的手机号 (汪洋手机号) StrategyPlatform string //策略品台跳转链接地址 ArticleTaskClassMobile string //策略平台报告自动归类消息通知对象 YiDongZhengTongYunUrl string //易董 证通云请求域名 YiDongZhengTongYunAppid string //易董 证通云请求appid YiDongZhengTongYunSecret string //易董 证通云请求secret YiDongHuaWeiYunUrl string //易董 华为云请求域名 YiDonggetOriginalLink string //易董 短连接转为长链接 ShangHaiCrmApiLink string //上海CRM用户同步api调用地址 ) // 模板消息推送 var ( SendWxTemplateMsgUrl string SendWxCategoryTemplateMsgUrl string ) // 日志配置 var ( LogPath string //调用过程中的日志存放地址 LogFile string LogDataPath string //调用过程中图表相关的日志存放地址 LogDataFile string BinLogPath string //数据库相关的日志存放地址 BinLogFile string ApiLogPath string //接口请求地址和接口返回值日志存放地址 ApiLogFile string LogMaxDays int //日志最大保留天数 ) func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } fmt.Println("line 80:", tmpRunMode, err) RunMode = tmpRunMode fmt.Println("RunMode:", RunMode) if RunMode == "" { localIp, err := GetLocalIP() fmt.Println("localIp:", localIp) if localIp == "10.0.0.123" { RunMode = "debug" } else { RunMode = "release" } fmt.Println("RunMode:", RunMode) configPath := `/home/code/config/hongze_mfyx/conf/app.conf` fmt.Println("configPath:", configPath) err = web.LoadAppConfig("ini", configPath) if err != nil { fmt.Println("web.LoadAppConfig Err:" + err.Error()) } } config, err := web.AppConfig.GetSection(RunMode) if err != nil { panic("配置文件读取错误 " + err.Error()) } //beego.Info(RunMode + " 模式") MYSQL_URL = config["mysql_url"] MYSQL_URL_CYGX = config["mysql_url_cygx"] MYSQL_URL_RDDP = config["mysql_url_rddp"] MYSQL_URL_TACTICS = config["mysql_url_tactics"] MYSQL_URL_COMEIN_DATA = config["mysql_url_comein_data"] REDIS_CACHE = config["beego_cache"] if len(REDIS_CACHE) <= 0 { panic("redis链接参数没有配置") } Rc, Re = cache.NewCache(REDIS_CACHE) //初始化缓存 if Re != nil { fmt.Println(Re) panic(Re) } IsTask, err = web.AppConfig.Bool("IsTask") if err != nil { panic("定时任务配置文件读取错误 " + err.Error()) } fmt.Println("IsTask:", IsTask) OnlineTime = "2021-06-01 00:00:01" //上线时间 SummaryArticleId = 1000000 //手动添加的纪要库开始ID YanxSummaryPermissionId = 1001 //研选纪要分类ID YanxViewpointPermissionId = 1002 //研选观点分类ID WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829,17758061174" WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829" // 王芳沈涛张传星 WxMsgTemplateIdYXSpecialReview = "18621268829,18258485832,18767183922" // 王芳、葛琳和沈涛 HtgjDefaultSaleName = "王芳" HtgjSalt = "HTGJ&HZ" HtgjName = "海通国际" HtgjPublicMobile = "18767183955" StrategyPlatform = "https://vmp.hzinsights.com/v2/articles/" if RunMode == "release" { WxAppId = "wx5e3240ab90c247ac" WxAppSecret = "6b1316b46dc9c63429f5c1df6f51b4ac" WxId = "gh_1959b919b204" //模板消息ID WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk" WxMsgTemplateIdApplyCancel = "iEi4YRHwcPbc2PSEF1pptc39H4NsAJPrUIPEk2ynwiA" WxMsgTemplateIdPermissionApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk" WxMsgTemplateIdActivityApply = "MwZ5wxfd0O1Yt0Pkf6OkfWP4USQzZbiEo5SkZ26735s" WxPublicAppId = "wx4a844c734d8c8e56" WxPublicAppSecret = "26c586e7ccb3c575433f0f37797b3eeb" WxPublicId = "gh_b67e0049fb8c" IndexName = "cygx_article_v03_23" IndexNameArticleHistory = "cygx_article_history_v07_08" IndexNameComprehensive = "cygx_comprehensive" //接收附件邮箱 EmailTechnology = "mlluo@hzinsights.com;jxu@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;hwang@hzinsights.com;rli@hzinsights.com" //科技行业专家邮箱 EmailMedicine = "xlzheng@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;yxyan@hzinsights.com;ppwang@hzinsights.com" //医药行业专家邮箱 EmailConsumption = "yrhuang@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com;jxu@hzinsights.com;hychen@hzinsights.com;lwang@hzinsights.com" //消费行业专家邮箱 EmailZhizao = "xfma@hzinsights.com;agne@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com" //智造行业专家邮箱 EmailStrategy = "experts@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com" //策略行业专家邮箱 EmailExpert = "experts@hzinsights.com;tshen@hzinsights.com;cxzhang@hzinsights.com" //研选行业专家邮箱 EmaiWhiteUserList = "tshen@hzinsights.com;cxzhang@hzinsights.com;yyli@hzinsights.com" //白名单邮箱 WxMsgTemplateIdAskMsg = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk" WxMsgTemplateIdArticleUserRemind = "fxnlsjx-gm3dAZVJf6f3w27wA7anETl42kexXLP8FDs" WxMsgCategoryTemplateIdArticleUserRemind = "4fwzgJ-YQndzH5OJWLkd0grvftgqhvP285t_oXUboi7DaaIhMI" WxMsgTemplateIdAskMsgMobile = "" //ActSendMsgMobile = "15618524605" ActSendMsgMobile = "15557270714" // 汪洋手机号 ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672" ShangHaiCrmApiLink = "https://crm.hzinsights.com/" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" SendWxCategoryTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_category_template_msg" WxPayJsapiNotifyUrl = "https://mfyx.hzinsights.com/api/wechat/wxpay/notify" } else { WxAppId = "wx5e3240ab90c247ac" WxAppSecret = "6b1316b46dc9c63429f5c1df6f51b4ac" WxId = "gh_1959b919b204" //模板消息ID WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" WxMsgTemplateIdApplyCancel = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" WxMsgTemplateIdPermissionApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" WxMsgTemplateIdActivityApply = "Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY" WxMsgTemplateIdActivityChange = "qfNuops-CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" WxMsgCategoryTemplateIdArticleUserRemind = "4fwzgJ-2xUiyQqNkFCPd8vsGpOnNWWE2inZO4BXjfio" WxPublicAppId = "wx9b5d7291e581233a" WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861" WxPublicId = "gh_5dc508325c6f" IndexName = "cygx_article_v1" IndexNameArticleHistory = "cygx_article_history_v1" IndexNameComprehensive = "cygx_comprehensive_test" //接收附件邮箱 EmailTechnology = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //科技行业专家邮箱 EmailMedicine = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //医药行业专家邮箱 EmailConsumption = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //消费行业专家邮箱 EmailZhizao = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //智造行业专家邮箱 EmailStrategy = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //策略行业专家邮箱 EmailExpert = "jhwang@hzinsights.com;cxzhang@hzinsights.com" //研选行业专家邮箱 EmaiWhiteUserList = "cxzhang@hzinsights.com" WxMsgTemplateIdAskMsg = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016,17758061174" ActSendMsgMobile = "15557270714" ArticleTaskClassMobile = "15557270714,18767183922,17706316791,17758061174" ShangHaiCrmApiLink = "http://106.15.192.100:8100/" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" SendWxCategoryTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_category_template_msg" //SendWxCategoryTemplateMsgUrl = "http://8.136.199.33:8086/v1/wechat/send_category_template_msg" WxPayJsapiNotifyUrl = "https://testmfyx.hzinsights.com/api/wechat/wxpay/notify" } //查研观向小助手 if RunMode != "release" { //原有的模板ID WxPublicIdXzs = "wx5e3240ab90c247ac" //查研观向小助手 WxPublicSecretXzs = "f4d52e34021eee262dce9682b31f8861" //查研观向小助手 WxMsgTemplateIdActivityApplyXzs = "U3su--7d6xsCDcP6Tya0N0wWpKn_uI0zO1cutRK52cc" //活动预约消息提醒(小助手) WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //手机号用户【XXX】发送模板消息模板ID(小助手) WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //申请待处理(小助手) WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" ////预约取消提醒(小助手) TemplateIdByProductXzs = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" //产品运行报告通知-模板ID(小助手) WxMsgTemplateIdActivityChangeApplyXzs = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //查研观向活动变更通知-模板ID(小助手) WxMsgTemplateIdActivitySign = "3l5cxpqH6c9kkLe9ow7qzqd0uYEOdY3A_PB8wRWkiHk" //查研观向活动签到通知-模板ID(小助手) // 类目模版 WxCategoryMsgTemplateIdApplyXzs = "IemWOTzbnLBqJ2ozSiFqm13WjaotoC3V4uXaxTij08I" WxCategoryMsgTemplateIdActivitySign = "aczgUYZASO97UJiCD_nDmD1eNWZAWudzw3JYcvjJ2x4" WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "wU4x_c5XruwuA44VZelyklRNOfq4XrU9ILckTtDs6hg" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply = "wLeV7tVK4ZJBoAvsmfXkHveVW8yefGAkwnVKQWRi8uQ" WxMsgCategoryTemplateIdAddMessage = "Ery3Y-cBtPqdpXJd07jKqbZdxkcTpK_74wAQNWYDOvY" //权益内容组手机号测试环境没什么用,配合测试切换他们的手机号 RAI_MOBILE_GAO_YI_WEN = "17706316791" //权益高亦文手机号 RAI_MOBILE_DONG_HENG = "15557270714" // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI = "15557270714" // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN = "15557270714" // 权益葛琳手机号 } else { //新的模板ID WxPublicIdXzs = "wxb7cb8a15abad5b8e" //查研观向小助手 WxPublicSecretXzs = "f425ba2863084249722af1e2a5cfffd3" //查研观向小助手 WxMsgTemplateIdActivityApplyXzs = "mItHdTF6swcunM4P36lOjnLknGbHaLqYdbOsRKscBq4" //活动预约消息提醒(小助手) WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //手机号用户【XXX】发送模板消息模板ID(小助手) WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //申请待处理(小助手) WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM" ////预约取消提醒(小助手) TemplateIdByProductXzs = "tNcCUiK_uUkuxaFF7M9NP2RwLkw8uHFjG-TDIxGUKxo" //产品运行报告通知-模板ID(小助手) WxMsgTemplateIdActivityChangeApplyXzs = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" //查研观向活动变更通知-模板ID(小助手) WxMsgTemplateIdActivitySign = "GIcOqewJql4rQ_dvhUna2knWIVogKulaqRxtZKnWZeo" //查研观向活动签到通知-模板ID(小助手) // 类目模版 WxCategoryMsgTemplateIdApplyXzs = "HKD03oZfSv8LJgeoHz0pynai3G2Ls4h8zZ6BfOpZmIA" WxCategoryMsgTemplateIdActivitySign = "11rITVC5Gl8qwetxl92NqY887Uk14kg3nPtEA_i_zLo" WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "t1CcxcOkoZkWZrDRs6zYUlceBGYMV3mhkBYUa8a6Mx0" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply = "IBMqiE61lVgUfFM4rsH0XCH57R_G3PbWvRbnzg9JHPI" WxMsgCategoryTemplateIdAddMessage = "_SzJRvXmlIp4Uh7Xbyem9G2pOqMDsHRsL0BQkCPFslk" //权益内容组手机号 RAI_MOBILE_GAO_YI_WEN = "15000123056" //权益高亦文手机号 RAI_MOBILE_DONG_HENG = "15216736473" // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI = "18701809782" // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN = "18258485832" // 权益葛琳手机号 } //日志配置 { LogPath = config["log_path"] LogFile = config["log_file"] LogDataPath = config["log_data_path"] LogDataFile = config["log_data_file"] BinLogPath = config["binlog_path"] BinLogFile = config["binlog_file"] ApiLogPath = config["apilog_path"] ApiLogFile = config["apilog_file"] logMaxDaysStr := config["log_max_day"] LogMaxDays, _ = strconv.Atoi(logMaxDaysStr) } //易董开放api配置 YiDongApiConfig() } // YiDongApiConfig 易董开放api配置 func YiDongApiConfig() { if RunMode == "release" { YiDongZhengTongYunUrl = "https://services.valueonline.cn/" YiDongZhengTongYunAppid = "ca86a257ebb46fce" YiDongZhengTongYunSecret = "338db2b2ca86a257ebb46fced9003f53" YiDongHuaWeiYunUrl = "https://achievement.valueonline.cn/" YiDonggetOriginalLink = "https://services.easy-board.com.cn/short-link/getOriginalLink?shortKey=" } else { YiDongZhengTongYunUrl = "https://services-dev.valueonline.cn/" YiDongZhengTongYunAppid = "d9bfb79627ac30d0" YiDongZhengTongYunSecret = "96a61dd2d9bfb79627ac30d02188bbe2" YiDongHuaWeiYunUrl = "https://achievement-test.valueonline.cn/" YiDonggetOriginalLink = "https://services-dev.valueonline.cn/short-link/getOriginalLink?shortKey=" } } // //YiDongZhengTongYunUrl string //易董 证通云请求域名 //YiDongZhengTongYunAppid string //易董 证通云请求appid //YiDongZhengTongYunSecret string //易董 证通云请求secret //YiDongHuaWeiYunUrl string //易董 华为云请求域名 //http://webapi.brilliantstart.cn/api/ //http://webapi.brilliantstart.cn/swagger/ //http://139.196.122.219:8603/swagger/