diff --git a/cmd/api/server.go b/cmd/api/server.go
index 088fa0c..68f49a9 100644
--- a/cmd/api/server.go
+++ b/cmd/api/server.go
@@ -76,7 +76,9 @@ func run() error {
Handler: r,
}
go func() {
+ jobs.InitJob()
jobs.Setup()
+
}()
diff --git a/config/db.sql b/config/db.sql
index 6004ec7..ca98399 100644
--- a/config/db.sql
+++ b/config/db.sql
@@ -452,8 +452,8 @@ INSERT INTO sys_user VALUES (2, 'zhangwj', '13211111111', 3, NULL, NULL, '0', 'q
INSERT INTO sys_setting VALUES (1, 'go-admin管理系统', 'https://gitee.com/mydearzwj/image/raw/master/img/go-admin.png', '2020-08-05 14:27:34', '2020-08-07 10:13:31' ,NULL);
-INSERT INTO sys_job VALUES (1, '接口测试', 'DEFAULT', 1, '0/5 * * * * ?', 'http://localhost:8000', 1, 1, 0, '2020-08-03 14:54:03', '2020-08-11 21:48:47', NULL, '', '', 1);
-INSERT INTO sys_job VALUES (2, '函数测试', 'DEFAULT', 2, '0/5 * * * * ?', 'ExamplesNoParam', 1, 1, 0, '2020-08-11 21:41:23', '2020-08-11 21:41:31', NULL, '', '', 2);
+INSERT INTO sys_job VALUES (1, '接口测试', 'DEFAULT', 1, '0/5 * * * * ?', 'http://localhost:8000', 1, 1, 2, 0, '', '', '2020-08-03 14:54:03', '2020-08-11 21:48:47', NULL);
+INSERT INTO sys_job VALUES (2, '函数测试', 'DEFAULT', 2, '0/5 * * * * ?', 'ExamplesOne', 1, 1, 2, 0, '', '', '2020-08-11 21:41:23', '2020-08-11 21:41:31', NULL);
COMMIT;
-- 数据完成 ;
\ No newline at end of file
diff --git a/jobs/examples.go b/jobs/examples.go
index ed0a562..cef1996 100644
--- a/jobs/examples.go
+++ b/jobs/examples.go
@@ -7,10 +7,11 @@ import (
// 需要将定义的struct 添加到字典中;
// 字典 key 可以配置到 自动任务 调用目标 中;
-func init() {
- var mp = make(map[string]JobsExec, 10)
- mp["ExamplesOne"] = ExamplesOne{}
- jobList = mp
+func InitJob() {
+ jobList = map[string]JobsExec{
+ "ExamplesOne": ExamplesOne{},
+ // ...
+ }
}
// 新添加的job 必须按照以下格式定义,并实现Exec函数
diff --git a/jobs/jobbase.go b/jobs/jobbase.go
index 6b4ee04..6140259 100644
--- a/jobs/jobbase.go
+++ b/jobs/jobbase.go
@@ -36,12 +36,8 @@ type ExecJob struct {
func (e *ExecJob) Run() {
startTime := time.Now()
- var mp = jobList
- lock.Lock()
- var obj = mp[e.InvokeTarget]
- lock.Unlock()
+ var obj = jobList[e.InvokeTarget]
CallExec(obj.(JobsExec))
- //fmt.Println("CallExec exec success")
// 结束时间
endTime := time.Now()
diff --git a/template/vue.go.template b/template/vue.go.template
index e19ee05..55f2a93 100644
--- a/template/vue.go.template
+++ b/template/vue.go.template
@@ -1,139 +1,19 @@
{{$tableComment:=.TableComment}}
-
-
- {{range .Columns}}
- {{- $x := .IsQuery -}}
- {{- if ($x) -}}
-
- {{if eq .DictType "" -}}
-
- {{- else -}}
-
-
-
- {{- end}}
-
- {{end}}
- {{- end }}
-
- 搜索
- 重置
-
-
-
-
-
- 新增
-
-
-
- 修改
-
-
-
- 删除
-
-
-
-
-
-
- {{- range .Columns -}}
- {{- $x := .IsList -}}
- {{- if ($x) }}
- {{- if ne .DictType "" -}}
-
-
- {{ "{{" }} {{.JsonField}}Format(scope.row) {{"}}"}}
-
-
- {{- end -}}
- {{- if eq .DictType "" -}}
-
- {{- end -}}
-
- {{- end }}
- {{- end }}
-
-
- 修改
-
- 删除
-
-
-
-
-
-
-
-
-
-
- {{ range .Columns }}
- {{- $x := .IsInsert -}}
- {{- if ($x) -}}
- {{- if (.Pk) }}
- {{- else if eq .GoField "CreatedAt" -}}
- {{- else if eq .GoField "UpdatedAt" -}}
- {{- else if eq .GoField "DeletedAt" -}}
- {{- else if eq .GoField "UpdateBy" -}}
- {{- else if eq .GoField "CreateBy" -}}
- {{- else }}
+
+
+
+
+ {{range .Columns}}
+ {{- $x := .IsQuery -}}
+ {{- if ($x) -}}
- {{ if eq "input" .HtmlType -}}
-
- {{- else if eq "select" .HtmlType -}}
-
+ {{if eq .DictType "" -}}
+
+ {{- else -}}
+
- {{- else if eq "radio" .HtmlType -}}
-
- {{"{{"}} dict.dictLabel {{"}}"}}
-
- {{- else if eq "datetime" .HtmlType -}}
-
-
- {{- else if eq "textarea" .HtmlType -}}
-
-
- {{- end }}
+ {{- end}}
+ {{end}}
+ {{- end }}
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+
+ 修改
+
+
+
+ 删除
+
+
+
+
+
+
+ {{- range .Columns -}}
+ {{- $x := .IsList -}}
+ {{- if ($x) }}
+ {{- if ne .DictType "" -}}
+
+
+ {{ "{{" }} {{.JsonField}}Format(scope.row) {{"}}"}}
+
+
+ {{- end -}}
+ {{- if eq .DictType "" -}}
+
+ {{- end -}}
+
{{- end }}
{{- end }}
- {{- end }}
-
-
-
-
+
+
+ 修改
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+ {{ range .Columns }}
+ {{- $x := .IsInsert -}}
+ {{- if ($x) -}}
+ {{- if (.Pk) }}
+ {{- else if eq .GoField "CreatedAt" -}}
+ {{- else if eq .GoField "UpdatedAt" -}}
+ {{- else if eq .GoField "DeletedAt" -}}
+ {{- else if eq .GoField "UpdateBy" -}}
+ {{- else if eq .GoField "CreateBy" -}}
+ {{- else }}
+
+ {{ if eq "input" .HtmlType -}}
+
+ {{- else if eq "select" .HtmlType -}}
+
+
+
+ {{- else if eq "radio" .HtmlType -}}
+
+ {{"{{"}} dict.dictLabel {{"}}"}}
+
+ {{- else if eq "datetime" .HtmlType -}}
+
+
+ {{- else if eq "textarea" .HtmlType -}}
+
+
+ {{- end }}
+
+ {{- end }}
+ {{- end }}
+ {{- end }}
+
+
+
+
+
+