package utils import ( "fmt" beeLogger "github.com/beego/bee/v2/logger" "github.com/beego/beego/v2/server/web" "github.com/rdlucklib/rdluck_tools/cache" ) var ( RunMode string //运行模式 MYSQL_URL string //数据库连接 MYSQL_URL_RDDP string //数据库连接 MYSQL_URL_EDB string MYSQL_URL_DATA string MYSQL_URL_GL string MYSQL_LOG_URL string MYSQL_URL_COMEIN_DATA string // 路演记录数据库 REDIS_CACHE string //缓存地址 Rc *cache.Cache //redis缓存 Re error //redis错误 ) var ( STATIC_DIR string ) // 微信配置信息 var ( WxId string //微信原始ID WxAppId string WxAppSecret string TemplateIdByProduct string //产品运行报告通知-模板ID TemplateRedirectUrl string //模板消息跳转地址 DayReportTemplateRedirectUrl string //模板消息跳转地址(晨报、周报) TemplateIdByCompanyApply string //客户申请单审批通知-模板ID TemplateCompanyApplyRedirectUrl string //审批单模板消息跳转地址 TemplateIdByCompanyReceive string //销售跨部门领取客户通知-模板ID TemplateIdByCompanyReceivePermission string //销售"添加客户/领取客户"权限变更通知 WxMsgTemplateIdActivityChangeApply string //查研观向活动变更通知-模板ID WxMsgTemplateIdActivityChangeApplyXzs string //查研观向活动变更通知-模板ID(小助手) TemplateIdByProductXzs string //产品运行报告通知-模板ID(小助手) WxCygxAppId string //查研观向小程序APPID WxMsgTemplateIdAskByUser string //查研观向用户提问新消息推送ID WxCrmAppId string //随手办公小程序APPID WxPublicIdXzs string //查研观向小助手公众号 WxPublicSecretXzs string //查研观向小助手公众号 WxYbAppId string //弘则研报小程序APPID YiDongHuaWeiYunUrl string //易董 华为云请求域名 WxMsgTemplateIdWithRoadshowPending string //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult string //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice string //路演->研究员收到活动删除通知 WxMsgTemplateIdWithYbCommunityQuestion string // 研报小程序->问答社区回复通知 WxMsgTemplateIdWithSealApplyFinished string // 用印申请-已签回通知 //内部员工公众号(弘则部门) AdminWxAppId string AdminWxAppSecret string UserTemplateIdByProduct string //客户产品运行报告通知-模板ID ) var ( THS_SendUrl string //同花顺地址url THS_PubKey string //同花顺公钥 ) var ( IndexName string //Es索引 IndexNameArticleHistory string //文章阅读记录Es索引 SummaryArticleId int //手动添加的纪要库开始ID YanxSummaryPermissionId int //研选纪要分类ID YanxViewpointPermissionId int //研选观点分类ID DATA_INDEX_NAME string //数据指标库索引 CHART_INDEX_NAME string //研究图库索引 EsReportIndexName string //研报ES索引 EsEnglishReportIndexName string //英文研报ES索引 Hz_CeLue_Article_Url string //策略平台报告地址 MY_CHART_INDEX_NAME string //研究图库(MY ETA)索引 EsSemanticAnalysisDocIndexName string //ES语义分析文档索引名 ) var ( Bucketname string = "hongze" Endpoint string Imghost string = "https://hongze.oss-accelerate.aliyuncs.com/" Upload_dir string = "static/images/" Upload_Audio_Dir string = "static/audio/" AccessKeyId string = "LTAIFMZYQhS2BTvW" AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq" ) // LibreOfficePath LibreOfficePath的地址 var LibreOfficePath string // 经济数据库 var ( EDB_LIB_URL string ) // 上海crm开放api配置 var ( CRM_OPEN_API_URL string CRM_OPEN_API_APP_KEY string CRM_OPEN_API_APP_SECRET string ) // 全时会议账号信息 var ( QsAppID string QsSecretKey string QsUserId int64 QsUserName string ) // 进门财经账号信息 var ( COMEIN_URL string COMEIN_APPID string COMEIN_SECREKEY string ) // 模板消息推送 var ( SendWxTemplateMsgUrl string ) // ppt转图片服务的地址 var Ppt2ImageUrl string // 开放openapi的地址 var HongzeOpenApiHost string var EnglishShareUrl string //英文研报群发邮件分享地址 var EnPolicyReportUrl string func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } 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_ETA_mobile_api/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()) } beeLogger.Log.Info(RunMode + " 模式") MYSQL_URL = config["mysql_url"] MYSQL_URL_RDDP = config["mysql_url_rddp"] MYSQL_URL_EDB = config["mysql_url_edb"] MYSQL_URL_DATA = config["mysql_url_data"] MYSQL_URL_GL = config["mysql_url_gl"] MYSQL_LOG_URL = config["mysql_url_log"] 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) } WxCygxAppId = "wxcc32b61f96720d2f" SummaryArticleId = 1000000 //手动添加的纪要库开始ID YanxSummaryPermissionId = 1001 //研选纪要分类ID YanxViewpointPermissionId = 1002 //研选观点分类ID Hz_CeLue_Article_Url = "https://vmp.hzinsights.com/v2/articles/" //策略平台项目报告地址 //随手办公 微信小程序appid WxCrmAppId = `wx67b68e39913e511e` WxYbAppId = `wxb059c872d79b9967` //弘则研报小程序 //内部员工公众号(弘则部门) AdminWxAppId = "wx1392111da5426e9e" AdminWxAppSecret = "30eceb7cf29bf2f046031155ab55d7b4" THS_PubKey = `-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqugglfCboOEfWtHlGBOW 40a4Y3xOs0MPBwjTOzHgcaWzx5XCc20VftGVXkWlpjs8u4dza/Bp1SV7SJ5Y7U95 jgUOP8Js9Qgp6UVqBJDJf3i1KpjHzlk3ma8zxAYUAdieEUE+SKSxSY+BD9A6lpf5 n+igXLmzR5GeVGFeLzoMhB1+pXgGhW30ao9wPwuRF7DBl+FKa/ACi7iXLiwXVgqT FFi29TKeerEENu3EpMXvPml7tNUiVmVW6d83hlascfbAlkShwuHLSGpLqK7brtg6 jRS9hreKFKb0BUQ4TB26e7IDCstbMRvUp4+OGezexzic5NYPQ8uLo5OTaS7f7PrW ZwIDAQAB -----END PUBLIC KEY-----` if RunMode == "release" { TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id=" DayReportTemplateRedirectUrl = "https://report.hzinsights.com/#/allindex/" //晨报模板跳转url TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list" STATIC_DIR = "/home/static/imgs/" Endpoint = "oss-cn-shanghai-internal.aliyuncs.com" //Endpoint = "oss-cn-shanghai.aliyuncs.com" IndexName = "cygx_article_v03_23" IndexNameArticleHistory = "cygx_article_history_v07_08" TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list" //同花顺正式地址 THS_SendUrl = `https://board.10jqka.com.cn/gateway/ps/syncNews` DATA_INDEX_NAME = "hz_data_lib_v20220214" CHART_INDEX_NAME = "hz_chart_lib_v2" MY_CHART_INDEX_NAME = "hz_my_chart_v1" //同花顺,万得接口服务地址(阿里云windows服务器地址;内网地址) Hz_Server_Data_Url = "http://172.19.173.231:7000/" EDB_LIB_URL = "http://172.19.173.232:8300/edbapi/" EsReportIndexName = "research_report_v1" EsEnglishReportIndexName = "english_report_v1" EsSemanticAnalysisDocIndexName = "semantic_analysis_v1" WxRelease() SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" HongzeOpenApiHost = "http://127.0.0.1:8609" EnglishShareUrl = "https://ybpcen.hzinsights.com" EnPolicyReportUrl = "https://en.hzinsights.com/v2api/" } else { TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id=" DayReportTemplateRedirectUrl = "http://report.brilliantstart.cn/#/allindex/" //晨报模板跳转url TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list" STATIC_DIR = "static/imgs/" Endpoint = "oss-cn-shanghai.aliyuncs.com" IndexName = "cygx_article_v1" IndexNameArticleHistory = "cygx_article_history_v1" //同花顺测试地址 THS_SendUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncNews` DATA_INDEX_NAME = "test_hz_data_lib_v20220120" CHART_INDEX_NAME = "test_hz_chart_lib_v2" MY_CHART_INDEX_NAME = "test_hz_my_chart_v1" //同花顺,万得接口服务地址(阿里云windows服务器地址;外网地址) Hz_Server_Data_Url = "http://139.196.136.213:7000/" EDB_LIB_URL = "http://8.136.199.33:8300/edbapi/" //EDB_LIB_URL = "http://127.0.0.1:8900/edbapi/" EsReportIndexName = "test_research_report_v1" EsEnglishReportIndexName = "test_english_report_v1" EsSemanticAnalysisDocIndexName = "test_semantic_analysis_v1" WxDebug() SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" HongzeOpenApiHost = "http://127.0.0.1:8608" EnglishShareUrl = "http://8.136.199.33:8301" //EnPolicyReportUrl = "https://beta.internal.hzinsights.com/v2api/" EnPolicyReportUrl = "https://en.hzinsights.com/v2api/" } tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath") if err != nil { panic("配置文件读取libreOfficePath错误 " + err.Error()) } LibreOfficePath = tmpLibreOfficePath //上海crm开放api配置 CrmOpenApiConfig() //初始化全时开放api配置 initQsOpenApiConfig() //进门财经开放api配置 ComeinOpenApiConfig() //易董开放api配置 YiDongApiConfig() // 初始化内部服务配置 initSystemServer() } // 测试环境模板消息 func WxDebug() { WxAppId = "wx9b5d7291e581233a" WxAppSecret = "f4d52e34021eee262dce9682b31f8861" WxId = "gh_5dc508325c6f" //模板消息 { TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" WxMsgTemplateIdAskByUser = `qfNuops-sKrfIkbA7U97A7gSrX03mUpoEpJksRUdloo` TemplateIdByCompanyApply = "yqaDUavXAKBpsPqTr0zYXAGIQYeCijZtWwFsT07wTbE" //销售跨部门领取客户通知 TemplateIdByCompanyReceive = "-ccp916f5rjMhwj8CtOAW_d_Os6ran8q5okVCENg924" //销售"添加客户/领取客户"权限变更通知 TemplateIdByCompanyReceivePermission = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" WxMsgTemplateIdActivityChangeApply = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //路演 WxMsgTemplateIdWithRoadshowPending = "1JG9fvKx9o9B-wkZe_gBFQQzMBnp07-hvpZI9QiFcKQ" //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->研究员收到活动删除通知 // 研报小程序 WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 WxMsgTemplateIdWithSealApplyFinished = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 用印申请-已签回通知 UserTemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" } //查研观向小助手 { //原有的模板ID WxPublicIdXzs = "wx9b5d7291e581233a" //查研观向小助手 WxPublicSecretXzs = "f4d52e34021eee262dce9682b31f8861" //查研观向小助手 WxMsgTemplateIdActivityChangeApplyXzs = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" //查研观向活动变更通知-模板ID(小助手) TemplateIdByProductXzs = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" //产品运行报告通知-模板ID(小助手) } } // 生产环境模板消息 func WxRelease() { WxAppId = "wx4a844c734d8c8e56" WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb" WxId = "gh_b67e0049fb8c" //模板消息 { TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84" TemplateIdByCompanyApply = "yqaDUavXAKBpsPqTr0zYXAGIQYeCijZtWwFsT07wTbE" WxMsgTemplateIdActivityChangeApply = "dYg6iHooRq74PyCXmw_Ns7qdJZmbtLoKS2p2FKeaXl0" //销售跨部门领取客户通知 TemplateIdByCompanyReceive = "-ccp916f5rjMhwj8CtOAW_d_Os6ran8q5okVCENg924" //销售"添加客户/领取客户"权限变更通知 TemplateIdByCompanyReceivePermission = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演 WxMsgTemplateIdWithRoadshowPending = "1JG9fvKx9o9B-wkZe_gBFQQzMBnp07-hvpZI9QiFcKQ" //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->研究员收到活动删除通知 // 研报小程序 WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 WxMsgTemplateIdWithSealApplyFinished = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 用印申请-已签回通知 UserTemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84" //用户产品允许通知模版 } //查研观向小助手 { //新的模板ID WxPublicIdXzs = "wxb7cb8a15abad5b8e" //查研观向小助手 WxPublicSecretXzs = "f425ba2863084249722af1e2a5cfffd3" //查研观向小助手 WxMsgTemplateIdActivityChangeApplyXzs = "7qe3i4MrGxAIPhJeMgoqqw6j0A_foUB65DLSmxKe05s" //查研观向活动变更通知-模板ID(小助手) TemplateIdByProductXzs = "tNcCUiK_uUkuxaFF7M9NP2RwLkw8uHFjG-TDIxGUKxo" //产品运行报告通知-模板ID(小助手) } } // CrmOpenApiConfig 上海crm开放api配置 func CrmOpenApiConfig() { if RunMode == "release" { CRM_OPEN_API_URL = "http://crm.hzinsights.com/openapi" CRM_OPEN_API_APP_KEY = "26945134" CRM_OPEN_API_APP_SECRET = "b99cb2bdec70d20156000f664ec5ac30" } else { CRM_OPEN_API_URL = "http://106.15.192.100:8100/openapi" CRM_OPEN_API_APP_KEY = "26945134" CRM_OPEN_API_APP_SECRET = "b99cb2bdec70d20156000f664ec5ac30" } } // initQsOpenApiConfig 全时开放api配置 func initQsOpenApiConfig() { QsAppID = "ed1cc7c87c97089263fc899fbab193b0" QsSecretKey = "d92b91265dbbc5e3af44edfb82503635" if RunMode == "release" { QsUserId = 22330940 QsUserName = "1406228535@qq.com" } else { QsUserId = 19896481 QsUserName = "pyan@hzinsights.com" } } // ComeinOpenApiConfig 进门开放api配置 func ComeinOpenApiConfig() { if RunMode == "release" { COMEIN_URL = "https://server.comein.cn/comein/index.php" COMEIN_APPID = "39b48779-debd-446a-a303-900322d8e356" COMEIN_SECREKEY = "9102a767f20f11ecb5d6b8599f142ed4" } else { COMEIN_URL = "https://testserver.comein.cn/comein/index.php" COMEIN_APPID = "7b966708-4a8b-4d24-9066-fe29920e7eee" COMEIN_SECREKEY = "76e004876fae4b3c8721a3f4c2d115da" } } // YiDongApiConfig 易董开放api配置 func YiDongApiConfig() { if RunMode == "release" { YiDongHuaWeiYunUrl = "https://achievement.valueonline.cn/" } else { YiDongHuaWeiYunUrl = "https://achievement-test.valueonline.cn/" } } // initSystemServer 内部服务配置 func initSystemServer() { if RunMode == "release" { // ppt 转图片服务地址 Ppt2ImageUrl = "http://172.19.173.232:8086/v1/image/ppt2img" } else { // ppt 转图片服务地址 Ppt2ImageUrl = "http://127.0.0.1:8086/v1/image/ppt2img" } } //http://adminapi.brilliantstart.cn/admin/ //http://adminapi.brilliantstart.cn/swagger/ //http://8.136.199.33:8602/swagger/