package utils import ( "fmt" beeLogger "github.com/beego/bee/v2/logger" "github.com/beego/beego/v2/server/web" "strconv" ) var ( RunMode string //运行模式 ) // 公共api内部服务调用 var ( // EDB_LIB_URL 公共指标库 EDB_LIB_URL string APP_EDB_LIB_NAME_EN string EDB_LIB_Md5_KEY string OpUserId int // 操作人id OpUserRealName string // 操作人真实名称 ) // 弘则 const ( APPID = "SJCrpOPvagscPxEv" SECRET = "gLLjT72uFHQZEFtaFCuoZegD1z2ezfyX" ) // 日志配置 var ( LogPath string //调用过程中的日志存放地址 LogFile string BinLogPath string //数据库相关的日志存放地址 BinLogFile string LogMaxDays int //日志最大保留天数 ) // 涌益生猪 var ( YongyiFilePath string //excel文件地址 YongyiOpen string //是否配置涌益生猪数据源,1已配置 ) // 中国煤炭网 var ( CoalMineFilePath string //excel文件地址 CoalMineOpen string //是否配置中国煤炭网数据源,1已配置 CoalMailAttachmentScriptPath string // 获取邮件附件的脚本目录 CoalMailAttachmentOpen string // 获取邮件附件功能,1已配置 CoalMailAttachmentTime string // 获取邮件附件功能时间 CoalMailAttachmentPythonVersion string // 获取邮件附件功能python版本 ) ) // 汾渭煤炭 var ( FenweiFileDir string // excel文件目录 FenweiOldFileDir string // 已读取过的excel文件目录 FenweiOpen string // 是否配置汾渭数据源 ) // 煤炭江湖 var ( MtjhFilePath string //excel文件地址 MtjhOpen string //是否配置煤炭江湖数据源,1已配置 ) var TerminalCode string func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } RunMode = tmpRunMode fmt.Println("RunMode:", RunMode) config, err := web.AppConfig.GetSection(RunMode) if err != nil { panic("配置文件读取错误 " + err.Error()) } beeLogger.Log.Info(RunMode + " 模式") // 公共api内部服务调用 { // 公共指标库相关 EDB_LIB_URL = config["edb_lib_url"] APP_EDB_LIB_NAME_EN = config["app_edb_lib_name_en"] EDB_LIB_Md5_KEY = config["edb_lib_md5_key"] opUserIdStr := config["op_user_id"] if opUserIdStr != `` { OpUserId, err = strconv.Atoi(opUserIdStr) if err != nil { panic("配置文件中操作人配置错误 " + err.Error()) } } OpUserRealName = config["op_user_real_name"] } //日志配置 { LogPath = config["log_path"] LogFile = config["log_file"] BinLogPath = config["binlog_path"] BinLogFile = config["binlog_file"] logMaxDaysStr := config["log_max_day"] LogMaxDays, _ = strconv.Atoi(logMaxDaysStr) } //涌益咨询文件夹配置 { YongyiFilePath = config["yongyi_file_path"] YongyiOpen = config["yongyi_open"] } //中国煤炭网文件夹配置 { CoalMineFilePath = config["coal_mine_file_path"] CoalMineOpen = config["coal_mine_open"] CoalMailAttachmentScriptPath = config["coal_mail_attachment_script_path"] CoalMailAttachmentOpen = config["coal_mail_attachment_open"] CoalMailAttachmentTime = config["coal_mail_attachment_time"] CoalMailAttachmentPythonVersion = config["coal_mail_attachment_python_version"] } // 汾渭配置 { FenweiOpen = config["fenwei_open"] FenweiFileDir = config["fenwei_file_dir"] FenweiOldFileDir = config["fenwei_old_file_dir"] } //煤炭江湖文件夹配置 { MtjhFilePath = config["mtjh_file_path"] MtjhOpen = config["mtjh_open"] } TerminalCode = config["terminal_code"] } //修改接口文档 //http://8.136.199.33:8300/swagger/