Finish the download archive feature.
This commit is contained in:
@ -188,7 +188,7 @@ func (this *TankApplication) HandleMirror() {
|
||||
}
|
||||
|
||||
response, err := http.PostForm(urlString, params)
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
|
||||
bodyBytes, err := ioutil.ReadAll(response.Body)
|
||||
|
||||
@ -235,7 +235,7 @@ func (this *TankApplication) HandleCrawl() {
|
||||
}
|
||||
|
||||
response, err := http.PostForm(urlString, params)
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
|
||||
bodyBytes, err := ioutil.ReadAll(response.Body)
|
||||
|
||||
|
@ -145,7 +145,7 @@ func (this *TankConfig) ReadFromConfigFile() {
|
||||
if this.item.MatterPath == "" {
|
||||
this.matterPath = util.GetHomePath() + "/matter"
|
||||
} else {
|
||||
this.matterPath = this.item.MatterPath
|
||||
this.matterPath = util.UniformPath(this.item.MatterPath)
|
||||
}
|
||||
util.MakeDirAll(this.matterPath)
|
||||
|
||||
@ -179,6 +179,7 @@ func (this *TankConfig) MysqlUrl() string {
|
||||
|
||||
//文件存放路径
|
||||
func (this *TankConfig) MatterPath() string {
|
||||
|
||||
return this.matterPath
|
||||
}
|
||||
|
||||
@ -209,11 +210,11 @@ func (this *TankConfig) FinishInstall(mysqlPort int, mysqlHost string, mysqlSche
|
||||
//写入到配置文件中(不能使用os.O_APPEND 否则会追加)
|
||||
filePath := util.GetConfPath() + "/tank.json"
|
||||
f, err := os.OpenFile(filePath, os.O_RDWR|os.O_CREATE, 0777)
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
_, err = f.Write(jsonStr)
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
err = f.Close()
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
|
||||
this.ReadFromConfigFile()
|
||||
|
||||
|
@ -2,6 +2,7 @@ package support
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/eyebluecn/tank/code/core"
|
||||
"github.com/eyebluecn/tank/code/tool/util"
|
||||
"github.com/robfig/cron"
|
||||
"log"
|
||||
@ -30,7 +31,7 @@ func (this *TankLogger) Init() {
|
||||
expression := "0 0 0 * * ?"
|
||||
cronJob := cron.New()
|
||||
err := cronJob.AddFunc(expression, this.maintain)
|
||||
util.PanicError(err)
|
||||
core.PanicError(err)
|
||||
cronJob.Start()
|
||||
this.Info("[cron job] 每日00:00维护日志")
|
||||
|
||||
|
@ -89,7 +89,7 @@ func (this *TankRouter) GlobalPanicHandler(writer http.ResponseWriter, request *
|
||||
}
|
||||
}
|
||||
//全局方便的异常拦截
|
||||
if strings.HasSuffix(file, "util/util_framework.go") {
|
||||
if strings.HasSuffix(file, "core/handler.go") {
|
||||
_, file, line, ok = runtime.Caller(4)
|
||||
if !ok {
|
||||
file = "???"
|
||||
@ -133,7 +133,7 @@ func (this *TankRouter) GlobalPanicHandler(writer http.ResponseWriter, request *
|
||||
}
|
||||
|
||||
//错误情况记录。
|
||||
go util.RunWithRecovery(func() {
|
||||
go core.RunWithRecovery(func() {
|
||||
this.footprintService.Trace(writer, request, time.Now().Sub(startTime), false)
|
||||
})
|
||||
}
|
||||
@ -181,7 +181,7 @@ func (this *TankRouter) ServeHTTP(writer http.ResponseWriter, request *http.Requ
|
||||
}
|
||||
|
||||
//正常的访问记录会落到这里。
|
||||
go util.RunWithRecovery(func() {
|
||||
go core.RunWithRecovery(func() {
|
||||
this.footprintService.Trace(writer, request, time.Now().Sub(startTime), true)
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user