package utils import ( "fmt" "github.com/beego/beego/v2/server/web" "github.com/rdlucklib/rdluck_tools/cache" ) var ( RunMode string //运行模式 MYSQL_URL string //数据库连接 MYSQL_URL_CYGX string //查研观向数据库连接 MYSQL_URL_RDDP string //数据库连接 MYSQL_URL_TACTICS string REDIS_CACHE string //缓存地址 Rc *cache.Cache //redis缓存 Re error //redis错误 ) // 微信配置信息 var ( WxId string //微信原始ID WxAppId string //查研观向小程序 WxAppSecret string //查研观向小程序 WxPublicAppId string //查研观向小助手公众号 WxPublicAppSecret string //查研观向小助手公众号 WxOpenAppId string //公众平台AppId WxOpenAppSecret string //公众平台AppSecret HeadimgurlDefault string //默认头像 WxMsgTemplateIdApplyXzs string //申请待处理(小助手) WxMsgTemplateIdApplyCancelXzs string //预约取消提醒(小助手) WxMsgTemplateIdApply string //申请待处理 WxMsgTemplateIdAskMsgMobile string //手机号用户【XXX】发送模板消息 WxMsgTemplateIdAskMsgMobileAll string //手机号用户【XXX】发送模板消rm -- WxMsgTemplateIdAskMsgXzs string //手机号用户【XXX】发送模板消息模板ID(小助手) IndexName string IndexNameComprehensive string //综合搜索Es索引 WxMsgTemplateIdAskMsgMobilePublic string //手机号用户【XXX】发送模板消rm -- WxMsgTemplateIdArticleUserRemind string //用户阅读报告通知-模板ID ActSendMsgMobile string //活动带问发送模板消息接收者的手机号 YiDongZhengTongYunUrl string //易董 证通云请求域名 YiDongZhengTongYunAppid string //易董 证通云请求appid YiDongZhengTongYunSecret string //易董 证通云请求secret YiDongHuaWeiYunUrl string //易董 华为云请求域名 YiDonggetOriginalLink string //易董 短连接转为长链接 ) // 模板消息推送 var ( SendWxTemplateMsgUrl string ) func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } RunMode = tmpRunMode if RunMode == "" { localIp, err := GetLocalIP() fmt.Println("localIp:", localIp) if localIp == "10.0.0.123" { RunMode = "debug" } else { RunMode = "release" } configPath := `/home/code/config/hongze_clpt/conf/app.conf` 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()) } fmt.Println(RunMode + " 模式") MYSQL_URL = config["mysql_url"] MYSQL_URL_CYGX = config["mysql_url_cygx"] MYSQL_URL_RDDP = config["mysql_url_rddp"] 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) } WxAppId = "wxcc32b61f96720d2f" WxAppSecret = "06894933fafb24dafead7eaae09c08e0" WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829,18955528215" WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829" if RunMode == "release" { WxPublicAppId = "wxb7cb8a15abad5b8e" //查研观向小助手 WxPublicAppSecret = "f425ba2863084249722af1e2a5cfffd3" //查研观向小助手 WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //申请待处理(小助手) WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM" ////预约取消提醒(小助手) WxMsgTemplateIdApply = "PaoDanHGlt1kFw5q-4_ipJSwO3FyZpxSSNg4rwB7YCk" WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016" WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA" //手机号用户【XXX】发送模板消息模板ID(小助手) WxMsgTemplateIdArticleUserRemind = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" WxOpenAppId = "wx26ccbe242908ed73" //公众平台AppId WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8" //公众平台AppSecret IndexName = "cygx_article_v03_23" IndexNameComprehensive = "cygx_comprehensive" ActSendMsgMobile = "15618524605" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" } else { WxPublicAppId = "wx9b5d7291e581233a" //弘则投研公众号 开发者ID(AppID) WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861" //弘则投研公众号秘钥 WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //申请待处理(小助手) WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8" ////预约取消提醒(小助手) WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016" WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo" //手机号用户【XXX】发送模板消息模板ID(小助手) WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" WxOpenAppId = "wx294d2825f451f851" //公众平台AppId WxOpenAppSecret = "7bf62d2d037280f8b635c6eca2f31db9" //公众平台AppSecret IndexName = "cygx_article_v1" IndexNameComprehensive = "cygx_comprehensive_test" ActSendMsgMobile = "17634786714" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" } HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png" //易董开放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=" } } //http://webapi.brilliantstart.cn/api/ //http://webapi.brilliantstart.cn/swagger/ //http://139.196.122.219:8603/swagger/