123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- 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
- 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
- WxMsgTemplateIdYXSpecialReview string
- ActSendMsgMobile string
- YiDongZhengTongYunUrl string
- YiDongZhengTongYunAppid string
- YiDongZhengTongYunSecret string
- 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
- )
- var (
- SendWxTemplateMsgUrl string
- SendWxCategoryTemplateMsgUrl string
-
- WxCategoryMsgTemplateIdApplyXzs string
- WxCategoryMsgTemplateIdActivitySign string
- WxMsgCategoryTemplateIdCompanyApprovalMessageRai string
- WxMsgCategoryTemplateIdActivityPublishApply 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())
- }
- 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"
- WxMsgTemplateIdArticleUserRemind = "fxnlsjx-gm3dAZVJf6f3w27wA7anETl42kexXLP8FDs"
- WxOpenAppId = "wx26ccbe242908ed73"
- WxOpenAppSecret = "0851cc85027c6eb74a400016648ecda8"
- 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"
- 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"
- 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"
- SendWxCategoryTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_category_template_msg"
-
-
- WxCategoryMsgTemplateIdApplyXzs = "IemWOTzbnLBqJ2ozSiFqm13WjaotoC3V4uXaxTij08I"
- WxCategoryMsgTemplateIdActivitySign = "aczgUYZASO97UJiCD_nDmD1eNWZAWudzw3JYcvjJ2x4"
- WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "wU4x_c5XruwuA44VZelyklRNOfq4XrU9ILckTtDs6hg"
- 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)
- }
-
- 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="
- }
- }
- func ChartPermissionId() {
- if RunMode == "release" {
- ZHOU_QI_ID = 62
- } else {
- ZHOU_QI_ID = 148
- }
- }
|