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 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 WxMsgTemplateIdYXSpecialReview string //王芳、葛琳和沈涛-- ActSendMsgMobile string //活动带问发送模板消息接收者的手机号 YiDongZhengTongYunUrl string //易董 证通云请求域名 YiDongZhengTongYunAppid string //易董 证通云请求appid YiDongZhengTongYunSecret string //易董 证通云请求secret YiDongHuaWeiYunUrl string //易董 华为云请求域名 YiDonggetOriginalLink string //易董 短连接转为长链接 //权益内容组手机号 RAI_MOBILE_GAO_YI_WEN string // 权益高亦文手机号 RAI_MOBILE_DONG_HENG string // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI string // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN string // 权益葛琳手机号 ZHOU_QI_ID int // 行业周期的ID ) // 模板消息推送 var ( SendWxTemplateMsgUrl string SendWxCategoryTemplateMsgUrl string // 类目模板 WxCategoryMsgTemplateIdApplyXzs string //申请待处理(买方研选) WxCategoryMsgTemplateIdActivitySign string //买方研选活动签到通知-类目模板ID(买方研选) WxMsgCategoryTemplateIdCompanyApprovalMessageRai string //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply string //买方研选关注的产业下,单个活动/研选报告发布通知-类目模板ID ) // 日志配置 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()) } 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" WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829" // 王芳沈涛张传星(类目模板消息都接收的人) WxMsgTemplateIdYXSpecialReview = "18621268829,18258485832,18767183922" // 王芳、葛琳和沈涛 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 = "fxnlsjx-gm3dAZVJf6f3w27wA7anETl42kexXLP8FDs" WxOpenAppId = "wx26ccbe242908ed73" //公众平台AppId WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8" //公众平台AppSecret IndexName = "cygx_article_v03_23" IndexNameComprehensive = "cygx_comprehensive" ActSendMsgMobile = "15557270714" 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" // 类目模版 WxCategoryMsgTemplateIdApplyXzs = "HKD03oZfSv8LJgeoHz0pynai3G2Ls4h8zZ6BfOpZmIA" WxCategoryMsgTemplateIdActivitySign = "11rITVC5Gl8qwetxl92NqY887Uk14kg3nPtEA_i_zLo" WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "t1CcxcOkoZkWZrDRs6zYUlceBGYMV3mhkBYUa8a6Mx0" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply = "IBMqiE61lVgUfFM4rsH0XCH57R_G3PbWvRbnzg9JHPI" //权益内容组手机号 RAI_MOBILE_GAO_YI_WEN = "15000123056" //权益高亦文手机号 RAI_MOBILE_DONG_HENG = "15216736473" // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI = "18701809782" // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN = "18258485832" // 权益葛琳手机号 } 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" 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" // 类目模版 WxCategoryMsgTemplateIdApplyXzs = "IemWOTzbnLBqJ2ozSiFqm13WjaotoC3V4uXaxTij08I" WxCategoryMsgTemplateIdActivitySign = "aczgUYZASO97UJiCD_nDmD1eNWZAWudzw3JYcvjJ2x4" WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "wU4x_c5XruwuA44VZelyklRNOfq4XrU9ILckTtDs6hg" //权益销售签约成功通知买方研选类目模版消息通知-类目模板ID WxMsgCategoryTemplateIdActivityPublishApply = "wLeV7tVK4ZJBoAvsmfXkHveVW8yefGAkwnVKQWRi8uQ" //权益内容组手机号测试环境没什么用,配合测试切换他们的手机号 RAI_MOBILE_GAO_YI_WEN = "17706316791" //权益高亦文手机号 RAI_MOBILE_DONG_HENG = "15557270714" // 权益董衡手机号 RAI_MOBILE_WU_ANG_DI = "15557270714" // 权益吴昂迪手机号 RAI_MOBILE_GE_LIN = "15557270714" // 权益葛琳手机号 } HeadimgurlDefault = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202202/20220225/XFBBOUmDC5AXkfxnHiuqKpPtoofH.png" //日志配置 { 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=" } } // 行业ID信息 func ChartPermissionId() { if RunMode == "release" { ZHOU_QI_ID = 62 } else { ZHOU_QI_ID = 148 } } //http://webapi.brilliantstart.cn/api/ //http://webapi.brilliantstart.cn/swagger/ //http://139.196.122.219:8603/swagger/