123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- 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
- Re error
- )
- var (
- WxId string
- WxAppId string
- WxAppSecret string
- WxPublicAppId string
- WxPublicAppSecret string
- WxOpenAppId string
- WxOpenAppSecret string
- HeadimgurlDefault string
- WxMsgTemplateIdApplyXzs string
- WxMsgTemplateIdApplyCancelXzs string
- WxMsgTemplateIdApply string
- WxMsgTemplateIdAskMsgMobile string
- WxMsgTemplateIdAskMsgMobileAll string
- WxMsgTemplateIdAskMsgXzs string
- IndexName string
- IndexNameComprehensive string
- WxMsgTemplateIdAskMsgMobilePublic string
- WxMsgTemplateIdArticleUserRemind string
- ActSendMsgMobile string
- YiDongZhengTongYunUrl string
- YiDongZhengTongYunAppid string
- YiDongZhengTongYunSecret string
- 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"
- WxMsgTemplateIdArticleUserRemind = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s"
- WxOpenAppId = "wx26ccbe242908ed73"
- WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8"
- 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"
- WxPublicAppSecret = "f4d52e34021eee262dce9682b31f8861"
- WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
- WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdAskMsgMobile = "15557270714,17634786714,18767183922,17516315016"
- WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
- WxOpenAppId = "wx294d2825f451f851"
- WxOpenAppSecret = "7bf62d2d037280f8b635c6eca2f31db9"
- 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"
-
- YiDongApiConfig()
- }
- 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="
- }
- }
|