Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zentaoatf
提交
65bb9ba7
Z
zentaoatf
项目概览
易企天创
/
zentaoatf
大约 1 年 前同步成功
通知
11
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zentaoatf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
65bb9ba7
编写于
12月 23, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove special char in download url
上级
5a22c712
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
17 deletion
+24
-17
src/server/cron/cron.go
src/server/cron/cron.go
+7
-7
src/server/server.go
src/server/server.go
+2
-1
src/server/service/task.go
src/server/service/task.go
+1
-1
src/server/utils/common/bak.go
src/server/utils/common/bak.go
+6
-6
src/server/utils/const/const.go
src/server/utils/const/const.go
+2
-2
src/utils/date/date.go
src/utils/date/date.go
+6
-0
未找到文件。
src/server/cron/cron.go
浏览文件 @
65bb9ba7
...
...
@@ -59,15 +59,15 @@ func (s *CronService) heartBeat() {
}
// has task to run,register busy, then run
//
build := s.taskService.Peek()
build
:=
s
.
taskService
.
Peek
()
s
.
heartBeatService
.
HeartBeat
(
true
)
// run
//
s.taskService.Start()
//
//
s.execService.Exec(build)
//
//
s.taskService.Remove()
//
s.taskService.End()
s
.
taskService
.
Start
()
s
.
execService
.
Exec
(
build
)
s
.
taskService
.
Remove
()
s
.
taskService
.
End
()
}
}
src/server/server.go
浏览文件 @
65bb9ba7
...
...
@@ -16,6 +16,7 @@ import (
"net/http"
"os"
"strconv"
"strings"
)
type
Server
struct
{
...
...
@@ -162,7 +163,7 @@ func (s *Server) post(req *http.Request) (resp domain.RespData, err error) {
func
Download
(
w
http
.
ResponseWriter
,
fi
string
)
{
logDir
:=
vari
.
ZTFDir
+
"log-agent"
+
constant
.
PthSep
file
,
_
:=
os
.
Open
(
logDir
+
fi
)
file
,
_
:=
os
.
Open
(
logDir
+
strings
.
Replace
(
fi
,
"-"
,
"/"
,
1
)
)
defer
file
.
Close
()
fileHeader
:=
make
([]
byte
,
512
)
...
...
src/server/service/task.go
浏览文件 @
65bb9ba7
...
...
@@ -71,7 +71,7 @@ func (s *TaskService) ListHistory() (data []map[string]string) {
data
=
serverUtils
.
ListHistoryLog
()
for
key
,
item
:=
range
data
{
data
[
key
][
"url"
]
=
fmt
.
Sprintf
(
"http://%s:%s/down?f=%s"
,
vari
.
IP
,
strconv
.
Itoa
(
vari
.
Port
),
item
[
"name"
])
data
[
key
][
"url"
]
=
fmt
.
Sprintf
(
"http://%s:%s/down
load
?f=%s"
,
vari
.
IP
,
strconv
.
Itoa
(
vari
.
Port
),
item
[
"name"
])
}
return
...
...
src/server/utils/common/bak.go
浏览文件 @
65bb9ba7
...
...
@@ -15,8 +15,8 @@ import (
func
BakLog
(
src
string
)
{
now
:=
time
.
Now
()
dateStr
:=
dateUtils
.
DateStr
(
now
)
timeStr
:=
dateUtils
.
TimeStr
(
now
)
dateStr
:=
dateUtils
.
DateStr
NoSep
(
now
)
timeStr
:=
dateUtils
.
TimeStr
NoSep
(
now
)
dateDir
:=
vari
.
AgentLogDir
+
dateStr
+
constant
.
PthSep
dist
:=
dateDir
+
timeStr
+
".zip"
...
...
@@ -34,12 +34,12 @@ func removeHistoryLog(root string) {
for
_
,
dir
:=
range
dirs
{
name
:=
dir
.
Name
()
pass
,
_
:=
regexp
.
MatchString
(
`^[0-9]{
4}-[0-9]{2}-[0-9]{2
}$`
,
name
)
pass
,
_
:=
regexp
.
MatchString
(
`^[0-9]{
8
}$`
,
name
)
if
!
pass
{
continue
}
tm
,
err
:=
dateUtils
.
StrToDate
(
name
)
tm
,
err
:=
time
.
Parse
(
"20060102"
,
name
)
if
err
==
nil
&&
time
.
Now
()
.
Unix
()
-
tm
.
Unix
()
>
7
*
24
*
3600
{
fileUtils
.
RmDir
(
root
+
name
)
}
...
...
@@ -51,7 +51,7 @@ func ListHistoryLog() (ret []map[string]string) {
for
_
,
dir
:=
range
dirs
{
dirName
:=
dir
.
Name
()
pass
,
_
:=
regexp
.
MatchString
(
`^[0-9]{
4}-[0-9]{2}-[0-9]{2
}$`
,
dirName
)
pass
,
_
:=
regexp
.
MatchString
(
`^[0-9]{
8
}$`
,
dirName
)
if
!
pass
{
continue
}
...
...
@@ -64,7 +64,7 @@ func ListHistoryLog() (ret []map[string]string) {
continue
}
item
:=
map
[
string
]
string
{
"name"
:
dirName
+
constant
.
PthSep
+
name
}
item
:=
map
[
string
]
string
{
"name"
:
dirName
+
"-"
+
name
}
ret
=
append
(
ret
,
item
)
}
}
...
...
src/server/utils/const/const.go
浏览文件 @
65bb9ba7
...
...
@@ -3,8 +3,8 @@ package serverConst
import
constant
"github.com/easysoft/zentaoatf/src/utils/const"
const
(
HeartBeatInterval
=
15
CheckUpgradeInterval
=
15
HeartBeatInterval
=
60
CheckUpgradeInterval
=
30
AgentRunTime
=
30
*
60
AgentLogDir
=
"log-agent"
...
...
src/utils/date/date.go
浏览文件 @
65bb9ba7
...
...
@@ -7,10 +7,16 @@ import (
func
DateStr
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"2006-01-02"
)
}
func
DateStrNoSep
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"20060102"
)
}
func
TimeStr
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"15:04:05"
)
}
func
TimeStrNoSep
(
tm
time
.
Time
)
string
{
return
tm
.
Format
(
"150405"
)
}
func
DateTimeStrFmt
(
tm
time
.
Time
,
fm
string
)
string
{
return
tm
.
Format
(
fm
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录