package utils import ( "fmt" beego "github.com/beego/beego/v2/adapter" "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_URL_WEEKLY_TRIAL string // ETA试用 MYSQL_URL_ETA string MYSQL_URL_CYGX string // 查研观向 REDIS_CACHE string //缓存地址 Rc *cache.Cache //redis缓存 Re error //redis错误 ) var ( CompanyId int AdminId int RealName string ) var ( WxAppId string WxAppSecret string TemplateId string RemindTemplateId string AppointmentRemindTemplateId string //活动预约通知模板id YbCommonTemplateId string //研报小程序消息模板ID WxYbAppId string //微信研报小程序 //内部员工公众号(弘则部门) AdminWxAppId string AdminWxAppSecret string TemplateIdByProduct string //产品运行报告通知-模板ID WxMsgTemplateIdWithYbCommunityQuestion string ) // oss配置 /*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" )*/ // 阿里云配置 var ( Bucketname string Endpoint string Imghost string UploadDir string Upload_Audio_Dir string AccessKeyId string AccessKeySecret string ) // ES配置 var ( ES_URL string // ES服务器地址 ES_USERNAME string // ES账号 ES_PASSWORD string // ES密码 ) var ( EsReportIndexName string //研报ES索引 EsEnglishReportIndexName string //英文研报ES索引 ) var ( THS_SendUrl string //同花顺地址url THS_SyncWxGroupUrl string //同花顺同步微信群url THS_List_Url string // 同花顺报告列表地址url THS_PubKey string //同花顺公钥 ) // 经济数据库 var ( EDB_LIB_URL string ) // 进门财经账号信息 var ( COMEIN_URL string COMEIN_APPID string COMEIN_SECREKEY string COMEIN_WHITELIST_APPID string COMEIN_WHITELIST_SECREKEY string ) // 模板消息推送 var ( SendWxTemplateMsgUrl string ) // 科大讯飞--语音合成 var ( XfHostUrl 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" } //RunMode = "release" configPath := `/home/code/config/hongze_task/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()) } beego.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_URL_WEEKLY_TRIAL = config["mysql_url_weekly_trial"] MYSQL_URL_ETA = config["mysql_url_eta"] MYSQL_URL_CYGX = config["mysql_url_cygx"] 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) } //同花顺公钥 THS_PubKey = `-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqugglfCboOEfWtHlGBOW 40a4Y3xOs0MPBwjTOzHgcaWzx5XCc20VftGVXkWlpjs8u4dza/Bp1SV7SJ5Y7U95 jgUOP8Js9Qgp6UVqBJDJf3i1KpjHzlk3ma8zxAYUAdieEUE+SKSxSY+BD9A6lpf5 n+igXLmzR5GeVGFeLzoMhB1+pXgGhW30ao9wPwuRF7DBl+FKa/ACi7iXLiwXVgqT FFi29TKeerEENu3EpMXvPml7tNUiVmVW6d83hlascfbAlkShwuHLSGpLqK7brtg6 jRS9hreKFKb0BUQ4TB26e7IDCstbMRvUp4+OGezexzic5NYPQ8uLo5OTaS7f7PrW ZwIDAQAB -----END PUBLIC KEY-----` WxYbAppId = "wxb059c872d79b9967" //弘则研报小程序 //内部员工公众号(弘则部门) AdminWxAppId = "wx1392111da5426e9e" AdminWxAppSecret = "30eceb7cf29bf2f046031155ab55d7b4" if RunMode == "release" { CompanyId = 16 RealName = "超级管理员" WxAppId = "wx4a844c734d8c8e56" WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb" TemplateId = "DGvLwidav-OZc07klLv5mxwxO63qHdWS5Cj-rTDvTQo" RemindTemplateId = "rCvkgRatnK_3N9pnQEErUyjFkyVpyAGuYtv3HwY82K4" AppointmentRemindTemplateId = `pdbn6Wr84Rr-Ek7zrYHcxh5RO5ROILHjbkj3em68954` //活动预约通知模板id //同花顺正式地址 THS_SendUrl = `https://board.10jqka.com.cn/gateway/ps/syncNews` THS_SyncWxGroupUrl = `https://board.10jqka.com.cn/gateway/ps/syncWechatGroupInfo` THS_List_Url = `https://board.10jqka.com.cn/gateway/ps/syncNews/listPage` //同花顺,万得接口服务地址(阿里云windows服务器地址;内网地址) Hz_Server_Data_Url = "http://172.19.173.231:7000/" EDB_LIB_URL = "http://172.19.173.232:8300/edbapi/" //EDB_LIB_URL = "http://47.102.213.75:8300/edbapi/" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" YbCommonTemplateId = "dYg6iHooRq74PyCXmw_Ns7qdJZmbtLoKS2p2FKeaXl0" WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 } else { CompanyId = 16 RealName = "超级管理员" AdminId = 11 WxAppId = "wx9b5d7291e581233a" WxAppSecret = "f4d52e34021eee262dce9682b31f8861" TemplateId = "DGvLwidav-OZc07klLv5mxwxO63qHdWS5Cj-rTDvTQo" RemindTemplateId = "rCvkgRatnK_3N9pnQEErUyjFkyVpyAGuYtv3HwY82K4" AppointmentRemindTemplateId = `U3su--7d6xsCDcP6Tya0N0wWpKn_uI0zO1cutRK52cc` //活动预约通知模板id //同花顺测试地址 THS_SendUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncNews` THS_SyncWxGroupUrl = `https://mtest.10jqka.com.cn/gateway/ps/syncWechatGroupInfo` THS_List_Url = `https://mtest.10jqka.com.cn/gateway/ps/syncNews/listPage` //同花顺,万得接口服务地址(阿里云windows服务器地址;外网地址) Hz_Server_Data_Url = "http://139.196.136.213:7000/" EDB_LIB_URL = "http://8.136.199.33:8300/edbapi/" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" YbCommonTemplateId = "CB7bOl7f3viMG4s1uhRo7WM0Jbx3WvodKuIZ8A_z8fM" WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 } // 微信模版消息 { TemplateIdByProduct = config["template_id_by_product"] } // oss { Endpoint = config["endpoint"] } // ES配置 { ES_URL = config["es_url"] ES_USERNAME = config["es_username"] ES_PASSWORD = config["es_password"] } // ES 索引 { EsReportIndexName = config["es_report_index_name"] EsEnglishReportIndexName = config["es_english_report_index_name"] } // 科大讯飞 { XfHostUrl = config["xf_host_url"] } // OSS相关 { Endpoint = config["endpoint"] Bucketname = config["bucket_name"] Imghost = config["img_host"] UploadDir = config["upload_dir"] Upload_Audio_Dir = config["upload_audio_dir"] AccessKeyId = config["access_key_id"] AccessKeySecret = config["access_key_secret"] } // 进门财经开放api配置 ComeinOpenApiConfig() } // 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" COMEIN_WHITELIST_APPID = "39b48779-debd-446a-a303-900322d8e356" COMEIN_WHITELIST_SECREKEY = "9102a767f20f11ecb5d6b8599f142ed4" } else { COMEIN_URL = "https://testserver.comein.cn/comein/index.php" COMEIN_APPID = "7b966708-4a8b-4d24-9066-fe29920e7eee" COMEIN_SECREKEY = "76e004876fae4b3c8721a3f4c2d115da" COMEIN_WHITELIST_APPID = "997fc880-766c-4f5a-8cd6-28aa08cd15ff" COMEIN_WHITELIST_SECREKEY = "ba361e9b1bd04d018a5bca2241e9f1fa" } } //http://entryapi.brilliantstart.cn //http://entryapi.brilliantstart.cn/swagger/