123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- 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
- Re error
- )
- var (
- WxId string
- WxAppId string
- WxAppSecret string
- WxMfyxAppId string
- WxMfyxAppSecret string
- WxPublicIdXzs string
- WxPublicSecretXzs string
- WxMsgTemplateIdApply string
- WxMsgTemplateIdApplyXzs string
- WxMsgTemplateIdApplyCancel string
- WxMsgTemplateIdApplyCancelXzs string
- WxMsgTemplateIdPermissionApply string
- WxMsgTemplateIdActivityApply string
- WxMsgTemplateIdActivityApplyXzs string
- WxMsgTemplateIdActivityChange string
- WxMsgTemplateIdAskMsg string
- WxMsgTemplateIdAskMsgXzs string
- WxMsgTemplateIdAskMsgMobile string
- WxMsgTemplateIdAskMsgMobileAll string
- WxMsgTemplateIdAskMsgMobilePublic string
- TemplateIdByProductXzs string
- WxMsgTemplateIdArticleUserRemind string
- WxMsgTemplateIdArticleUserRemindXzs string
- WxMsgTemplateIdActivityChangeApplyXzs string
- WxMsgTemplateIdActivitySign string
-
- WxCategoryMsgTemplateIdApplyXzs string
- WxCategoryMsgTemplateIdActivitySign string
- WxMsgCategoryTemplateIdCompanyApprovalMessageRai string
- WxMsgCategoryTemplateIdActivityPublishApply string
- WxMsgCategoryTemplateIdArticleUserRemind string
- WxMsgCategoryTemplateIdAddMessage string
-
- RAI_MOBILE_GAO_YI_WEN string
- RAI_MOBILE_DONG_HENG string
- RAI_MOBILE_WU_ANG_DI string
- RAI_MOBILE_GE_LIN string
- RAI_SERVE_GROUP_ID string
- )
- var (
- WxPublicId string
- WxPublicAppId string
- WxPublicAppSecret string
- WxPlatform = 4
- )
- var (
- IndexName string
- IndexNameArticleHistory string
- IndexNameComprehensive string
- OnlineTime string
- SummaryArticleId int
- YanxSummaryPermissionId int
- YanxViewpointPermissionId int
- 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
- YiDongZhengTongYunSecret string
- YiDongHuaWeiYunUrl string
- YiDonggetOriginalLink string
- ShangHaiCrmApiLink string
- ZHOU_QI_ID int
- )
- var (
- SendWxTemplateMsgUrl string
- SendWxCategoryTemplateMsgUrl string
- )
- var (
- FiccYbEtaHubBusinessCode string
- FiccYbEtaHubAppId string
- FiccYbEtaHubSecret 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_cygx/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())
- }
-
- 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
- YanxSummaryPermissionId = 1001
- YanxViewpointPermissionId = 1002
- WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
- WxMsgTemplateIdAskMsgMobilePublic = "15557270714,18767183922,18621268829"
- HtgjDefaultSaleName = "王芳"
- HtgjSalt = "HTGJ&HZ"
- HtgjName = "海通国际"
- HtgjPublicMobile = "18767183955"
- StrategyPlatform = "https://vmp.hzinsights.com/v2/articles/"
-
- WxMfyxAppId = "wx5e3240ab90c247ac"
- WxMfyxAppSecret = "6b1316b46dc9c63429f5c1df6f51b4ac"
- if RunMode == "release" {
- WxAppId = "wxcc32b61f96720d2f"
- WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
- WxId = "gh_a9d3744e1072"
-
- 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;tkding@hzinsights.com;xfma@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;tkding@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"
- WxMsgTemplateIdAskMsgMobile = ""
-
- ActSendMsgMobile = "15557270714"
- ArticleTaskClassMobile = "15557270714,18767183922,15216736473,15000123056,18701809782,17706316791,18652179672"
- RAI_SERVE_GROUP_ID = "68,72"
- 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"
- } else {
- WxAppId = "wxcc32b61f96720d2f"
- WxAppSecret = "06894933fafb24dafead7eaae09c08e0"
- WxId = "gh_a9d3744e1072"
-
- WxMsgTemplateIdApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdApplyCancel = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
- WxMsgTemplateIdPermissionApply = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdActivityApply = "Y59n_AHg-RLCKaz293geW76KDHpGL1qOnE7eF_lxelY"
- WxMsgTemplateIdActivityChange = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
- WxMsgTemplateIdArticleUserRemind = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM"
- 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"
- ActSendMsgMobile = "15557270714"
- ArticleTaskClassMobile = "15557270714,18767183922,17706316791"
- RAI_SERVE_GROUP_ID = "132,134"
- 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"
-
- }
-
- if RunMode != "release" {
-
- WxPublicIdXzs = "wx9b5d7291e581233a"
- WxPublicSecretXzs = "f4d52e34021eee262dce9682b31f8861"
- WxMsgTemplateIdActivityApplyXzs = "U3su--7d6xsCDcP6Tya0N0wWpKn_uI0zO1cutRK52cc"
- WxMsgTemplateIdAskMsgXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdApplyXzs = "qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo"
- WxMsgTemplateIdApplyCancelXzs = "UU_d7ks0XZBnWg2xFzxL9Heilm4kisX39K7dr4SDdO8"
- TemplateIdByProductXzs = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY"
- WxMsgTemplateIdActivityChangeApplyXzs = "4fwzgJ-2xUiyQqNkFCPd8vsGpOnNWWE2inZO4BXjfio"
- WxMsgTemplateIdActivitySign = "3l5cxpqH6c9kkLe9ow7qzqd0uYEOdY3A_PB8wRWkiHk"
-
- WxCategoryMsgTemplateIdApplyXzs = "IemWOTzbnLBqJ2ozSiFqm13WjaotoC3V4uXaxTij08I"
- WxCategoryMsgTemplateIdActivitySign = "aczgUYZASO97UJiCD_nDmD1eNWZAWudzw3JYcvjJ2x4"
- WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "wU4x_c5XruwuA44VZelyklRNOfq4XrU9ILckTtDs6hg"
- WxMsgCategoryTemplateIdActivityPublishApply = "wLeV7tVK4ZJBoAvsmfXkHveVW8yefGAkwnVKQWRi8uQ"
- WxMsgCategoryTemplateIdArticleUserRemind = "4fwzgJ-2xUiyQqNkFCPd8vsGpOnNWWE2inZO4BXjfio"
- 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 {
-
- WxPublicIdXzs = "wxb7cb8a15abad5b8e"
- WxPublicSecretXzs = "f425ba2863084249722af1e2a5cfffd3"
- WxMsgTemplateIdActivityApplyXzs = "mItHdTF6swcunM4P36lOjnLknGbHaLqYdbOsRKscBq4"
- WxMsgTemplateIdAskMsgXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA"
- WxMsgTemplateIdApplyXzs = "IpS-yuNNQc8osCoy20jPHNkvBUyKRL1NGn7c0G9xmQA"
- WxMsgTemplateIdApplyCancelXzs = "gCSCAWNNhjkzE2V1cjbIV_Ex68R_8LM_u25qDlSKWyM"
- TemplateIdByProductXzs = "tNcCUiK_uUkuxaFF7M9NP2RwLkw8uHFjG-TDIxGUKxo"
- WxMsgTemplateIdActivityChangeApplyXzs = "Q03y1p7epHx8jnz-mHTwm8O5XEfd-XnrQB01Goldmqo"
- WxMsgTemplateIdActivitySign = "GIcOqewJql4rQ_dvhUna2knWIVogKulaqRxtZKnWZeo"
-
- WxCategoryMsgTemplateIdApplyXzs = "HKD03oZfSv8LJgeoHz0pynai3G2Ls4h8zZ6BfOpZmIA"
- WxCategoryMsgTemplateIdActivitySign = "11rITVC5Gl8qwetxl92NqY887Uk14kg3nPtEA_i_zLo"
- WxMsgCategoryTemplateIdCompanyApprovalMessageRai = "t1CcxcOkoZkWZrDRs6zYUlceBGYMV3mhkBYUa8a6Mx0"
- WxMsgCategoryTemplateIdActivityPublishApply = "IBMqiE61lVgUfFM4rsH0XCH57R_G3PbWvRbnzg9JHPI"
- WxMsgCategoryTemplateIdArticleUserRemind = "4fwzgJ-YQndzH5OJWLkd0grvftgqhvP285t_oXUboi7DaaIhMI"
- 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)
- }
-
- YiDongApiConfig()
- ChartPermissionId()
- FiccYbEtaHub()
- }
- 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
- }
- }
- func FiccYbEtaHub() {
- if RunMode == "release" {
- ZHOU_QI_ID = 62
- } else {
- FiccYbEtaHubAppId = "IaiJJNFKBXuUgFaG"
- FiccYbEtaHubSecret = "CJYZocTkUoBZrxaFGzsvFdQCNtqlISqo"
- }
- }
|