123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- package utils
- import (
- "fmt"
- beeLogger "github.com/beego/bee/v2/logger"
- "github.com/beego/beego/v2/server/web"
- "strconv"
- )
- var (
- RunMode string
- )
- var (
-
- EDB_LIB_URL string
- APP_EDB_LIB_NAME_EN string
- EDB_LIB_Md5_KEY string
- OpUserId int
- OpUserRealName string
- )
- const (
- APPID = "SJCrpOPvagscPxEv"
- SECRET = "gLLjT72uFHQZEFtaFCuoZegD1z2ezfyX"
- )
- var (
- LogPath string
- LogFile string
- BinLogPath string
- BinLogFile string
- LogMaxDays int
- )
- var (
- YongyiFilePath string
- YongyiReadFilePath string
- YongyiOpen string
- YongyiDownloadHost string
- )
- var (
- CoalMineFilePath string
- CoalMineOpen string
- CoalMailAttachmentScriptPath string
- CoalMailAttachmentOpen string
- CoalMailAttachmentTime string
- CoalMailAttachmentPythonVersion string
- )
- var (
- FenweiFileDir string
- FenweiOldFileDir string
- FenweiOpen string
- )
- var (
- MtjhFilePath string
- MtjhOpen string
- )
- 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 + " 模式")
-
- {
-
- 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"]
- YongyiReadFilePath = config["yongyi_read_file_path"]
- YongyiOpen = config["yongyi_open"]
- YongyiDownloadHost = config["yongyi_download_host"]
- if YongyiDownloadHost == "" {
- YongyiDownloadHost = "http://127.0.0.1:7010/"
- }
- }
-
- {
- 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"]
- }
|