package utils import ( "fmt" "github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/server/web" "github.com/rdlucklib/rdluck_tools/cache" "github.com/rdlucklib/rdluck_tools/log" ) var ( RunMode string //运行模式 MYSQL_URL string //数据库连接 MYSQL_URL_RDDP string //数据库连接 REDIS_CACHE string //缓存地址 Rc *cache.Cache //redis缓存 Re error //redis错误 ) //微信配置信息 var ( WxId string //微信原始ID WxAppId string WxAppSecret string TemplateIdByProduct string //产品运行报告通知-模板ID TemplateRedirectUrl string //模板消息跳转地址 WxPlatform int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1 TemplateIdByCompanyApply string //客户申请单审批通知-模板ID TemplateCompanyApplyRedirectUrl string //审批单模板消息跳转地址 //内部员工公众号(弘则部门) AdminWxAppId string AdminWxAppSecret string //微信小程序appid WxId2 string //微信原始ID WxAppId2 string WxAppSecret2 string WxPlatform2 int //用户来源,需要入库,用来保存该用户来自哪个平台,默认是:1 WxYbAppId string //弘则研报小程序APPID WxMsgTemplateIdWithRoadshowPending string //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult string //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice string //路演->研究员收到活动删除通知 WxMsgTemplateIdWithSealApplyFinished string // 用印申请-已签回通知 WxMsgTemplateIdWithYbCommunityQuestion string // 研报小程序->问答社区回复通知 SendWxTemplateMsgUrl string //模板消息推送 ) var ( STATIC_DIR string ) var ApiLog *log.Log // LibreOfficePath LibreOfficePath的地址 var LibreOfficePath string // 上海crm开放api配置 var ( CRM_OPEN_API_URL string CRM_OPEN_API_APP_KEY string CRM_OPEN_API_APP_SECRET string ) 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" ) func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } RunMode = tmpRunMode if RunMode == "" { localIp, tempErr := GetLocalIP() if tempErr != nil { fmt.Println("init GetLocalIP Err:" + tempErr.Error()) } fmt.Println("localIp:", localIp) if localIp == "10.0.0.123" { RunMode = "debug" } else { RunMode = "release" } fmt.Println("RunMode:", RunMode) configPath := `/home/code/config/hongze_mobile_admin/conf/app.conf` tempErr = web.LoadAppConfig("ini", configPath) if tempErr != nil { fmt.Println("web.LoadAppConfig Err:" + tempErr.Error()) } } fmt.Println(RunMode, "模式") config, err := web.AppConfig.GetSection(RunMode) if err != nil { panic("配置文件读取错误 " + err.Error()) } logs.Info(RunMode + " 模式") MYSQL_URL = config["mysql_url"] 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) } //小程序appid配置 WxAppId2 = `wx67b68e39913e511e` WxId2 = `wx67b68e39913e511e` WxAppSecret2 = `660b0375f701a19220bb8a662b41c77c` WxPlatform2 = 5 WxYbAppId = `wxb059c872d79b9967` //弘则研报小程序 if RunMode == "release" { //oss STATIC_DIR = "/home/static/imgs/" Endpoint = "oss-cn-shanghai-internal.aliyuncs.com" } else { //oss配置 STATIC_DIR = "static/imgs/" Endpoint = "oss-cn-shanghai.aliyuncs.com" } tmpLibreOfficePath, err := web.AppConfig.String("libreOfficePath") if err != nil { panic("配置文件读取libreOfficePath错误 " + err.Error()) } LibreOfficePath = tmpLibreOfficePath //日志类 if RunMode == "release" { logDir := `/data/rdlucklog/hongze_mobile_admin` ApiLog = log.Init("20060102.api", logDir) } else { ApiLog = log.Init("20060102.api") } //上海crm开放api配置 CrmOpenApiConfig() //微信配置 wxConfig() } // 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" } } func wxConfig() { if RunMode == "release" { WxAppId = "wx4a844c734d8c8e56" WxAppSecret = "26c586e7ccb3c575433f0f37797b3eeb" WxId = "gh_b67e0049fb8c" TemplateIdByProduct = "Cp2wF8gvBtxyWV4DeYuI172oqwyYXVRSm3AyJO42d84" TemplateRedirectUrl = "https://ficc.hzinsights.com/reportdtl?id=" WxPlatform = 1 TemplateIdByCompanyApply = "yqaDUavXAKBpsPqTr0zYXAGIQYeCijZtWwFsT07wTbE" TemplateCompanyApplyRedirectUrl = "https://ficc.hzinsights.com/approval/approval/list" //路演 WxMsgTemplateIdWithRoadshowPending = "1JG9fvKx9o9B-wkZe_gBFQQzMBnp07-hvpZI9QiFcKQ" //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->研究员收到活动删除通知 WxMsgTemplateIdWithSealApplyFinished = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 用印申请-已签回通知 // 研报小程序 WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 //内部员工公众号(弘则部门) AdminWxAppId = "wx1392111da5426e9e" AdminWxAppSecret = "30eceb7cf29bf2f046031155ab55d7b4" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" } else { WxAppId = "wx9b5d7291e581233a" WxAppSecret = "f4d52e34021eee262dce9682b31f8861" WxId = "gh_5dc508325c6f" TemplateIdByProduct = "-YjuPOB7Fqd-S3ilabYa6wvjDY9aXmeEfPN6DCiy-EY" TemplateRedirectUrl = "http://rddpweb.brilliantstart.cn/reportdtl?id=" WxPlatform = 1 TemplateIdByCompanyApply = "yqaDUavXAKBpsPqTr0zYXAGIQYeCijZtWwFsT07wTbE" TemplateCompanyApplyRedirectUrl = "http://advisoryadmin.brilliantstart.cn/approval/approval/list" //路演 WxMsgTemplateIdWithRoadshowPending = "1JG9fvKx9o9B-wkZe_gBFQQzMBnp07-hvpZI9QiFcKQ" //路演->研究员收到待处理的申请 WxMsgTemplateIdWithRoadshowDetailResult = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->销售收到处理结果 WxMsgTemplateIdWithRoadshowDeleteNotice = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" //路演->研究员收到活动删除通知 WxMsgTemplateIdWithSealApplyFinished = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 用印申请-已签回通知 // 研报小程序 WxMsgTemplateIdWithYbCommunityQuestion = "rciDm9ThigRBGi1SZ4TFd74XA4aoAxSz_ugdv_tZ450" // 研报小程序->问答社区回复通知 //内部员工公众号(弘则部门) AdminWxAppId = "wx1392111da5426e9e" AdminWxAppSecret = "30eceb7cf29bf2f046031155ab55d7b4" SendWxTemplateMsgUrl = "http://127.0.0.1:8086/v1/wechat/send_template_msg" } } //http://webapi.brilliantstart.cn/api/ //http://webapi.brilliantstart.cn/swagger/ //http://8.136.199.33:8607/swagger/