修复配置bug

This commit is contained in:
hoteas 2022-08-03 12:07:55 +08:00
parent adfb2236dc
commit a8d78832df
5 changed files with 74 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import (
. "code.hoteas.com/golang/hotime/db"
. "code.hoteas.com/golang/hotime/log"
"database/sql"
"fmt"
"github.com/sirupsen/logrus"
"io/ioutil"
"net/http"
@ -237,10 +238,8 @@ func (that *Application) SetConfig(configPath ...string) {
}
that.Log = GetLog(that.Config.GetString("logFile"), true)
that.Error = Error{Logger: that.Log}
if that.Config.Get("webConnectLogShow") == nil || that.Config.GetBool("webConnectLogShow") {
that.WebConnectLog = GetLog(that.Config.GetString("webConnectLogFile"), false)
if that.Error.GetError() != nil {
fmt.Println(that.Error.GetError().Error())
}
//文件如果损坏则不写入配置防止配置文件数据丢失
@ -267,6 +266,12 @@ func (that *Application) SetConfig(configPath ...string) {
}
that.Log = GetLog(that.Config.GetString("logFile"), true)
that.Error = Error{Logger: that.Log}
if that.Config.Get("webConnectLogShow") == nil || that.Config.GetBool("webConnectLogShow") {
that.WebConnectLog = GetLog(that.Config.GetString("webConnectLogFile"), false)
}
}
// SetConnectListener 连接判断,返回false继续传输至控制层true则停止传输

View File

@ -8,6 +8,14 @@ var Config = Map{
"name": "HoTimeDashBoard",
//"id": "2f92h3herh23rh2y8",
"label": "HoTime管理平台",
"labelConfig": Map{
"show": "开启",
"add": "添加",
"delete": "删除",
"edit": "编辑",
"info": "查看详情",
"download": "下载清单",
},
"menus": []Map{
//{"label": "平台首页", "name": "HelloWorld", "icon": "el-icon-s-home"},
//{"label": "测试表格", "table": "table", "icon": "el-icon-suitcase"},

View File

@ -23,12 +23,13 @@
],
"db": {
"mysql": {
"host": "192.168.6.253",
"name": "dgs-cms",
"password": "dasda8454456",
"host": "192.168.2.20",
"name": "gov_crawler",
"password": "fh22y8b882d",
"port": "3306",
"prefix": "",
"user": "root"
}
},
"defFile": [
"index.html",

View File

@ -0,0 +1,49 @@
{
"cache": {
"db": {
"db": false,
"session": true,
"timeout": 7200
},
"memory": {
"db": true,
"session": true,
"timeout": 7200
}
},
"codeConfig": [
{
"config": "config/admin.json",
"configDB": "config/adminDB.json",
"mode": 0,
"name": "",
"rule": "config/rule.json",
"table": "admin"
}
],
"db": {
"mysql": {
"host": "192.168.2.20",
"name": "gov_crawler",
"password": "fh22y8b882d",
"port": "3306",
"prefix": "",
"user": "root"
}
},
"defFile": [
"index.html",
"index.htm"
],
"error": {
"1": "内部系统异常",
"2": "访问权限异常",
"3": "请求参数异常",
"4": "数据处理异常",
"5": "数据结果异常"
},
"mode": 2,
"port": "8081",
"sessionName": "HOTIME",
"tpt": "tpt"
}

View File

@ -94,6 +94,9 @@ func findCaller(skip int) string {
if file == "code/makecode.go" {
file, line = getCaller(skip + i + j)
}
if strings.Index(file, "common/") == 0 {
file, line = getCaller(skip + i + j)
}
if strings.Contains(file, "application.go") {
file, line = getCaller(skip + i + j)
}