Compare commits

..

11 Commits

Author SHA1 Message Date
lmk
206cf7d79f 支持sqlite 2026-03-30 14:28:35 +08:00
georgeHao
626612c689 支持mod 2024-03-28 14:32:18 +08:00
georgehao
89a79256b1 优化页面 2022-05-02 14:09:45 +08:00
georgehao
60196f512b 优化操作体验 reload 2022-05-02 13:21:02 +08:00
georgehao
c33a256438 表格尺寸调整 2021-05-19 08:31:02 +08:00
georgehao
405bc8d4ec Merge branch 'master' of https://github.com/george518/PPGo_Job 2021-05-18 00:40:04 +08:00
georgehao
5fbc2bbe6e V2.8.1
修复几处bug
2021-05-18 00:31:24 +08:00
George Hao
fdb6ab575c Merge pull request #45 from whoisix/master
修复任务列表下次执行时间问题,修改错别字
2021-05-18 00:06:40 +08:00
georgehao
78efeef490 支持k8s登录&优化任务列表页操作 2020-04-14 04:57:56 +08:00
alexliux
b3678fa970 修复命令出错时日志不记录bug 2019-10-17 11:23:15 +08:00
georgehao
6afe97330d 修正执行器(服务器)状态 2019-08-13 23:20:17 +08:00
26 changed files with 419 additions and 443 deletions

View File

@@ -1,5 +1,5 @@
AppName = PPGo_Job2 AppName = PPGo_Job2
HTTPPort = 8080 HTTPPort = 8082
RunMode = dev RunMode = dev
SessionOn = true SessionOn = true
@@ -15,11 +15,13 @@ site.name = 定时任务管理器
notify.type = 0 notify.type = 0
# 数据库配置 # 数据库配置
db.host = 127.0.0.1 db.type = sqlite
db.host = localhost
db.user = root db.user = root
db.password = "123456" db.password = "root"
db.port = 3306 db.port = 3306
db.name = ppgo_job2 db.name = lmk
db.path = ./data/ppgo_job.db
db.prefix = pp_ db.prefix = pp_
db.timezone = Asia/Shanghai db.timezone = Asia/Shanghai

View File

@@ -77,7 +77,7 @@ func (self *BaseController) Auth() {
} }
isHasAuth := strings.Contains(self.allowUrl, self.controllerName+"/"+self.actionName) isHasAuth := strings.Contains(self.allowUrl, self.controllerName+"/"+self.actionName)
noAuth := "ajaxsave/table/loginin/loginout/getnodes/startapitask/apistart/apipause" noAuth := "ajaxsave/table/loginin/loginout/getnodes/start/apitask/apistart/apipause"
isNoAuth := strings.Contains(noAuth, self.actionName) isNoAuth := strings.Contains(noAuth, self.actionName)
if isHasAuth == false && isNoAuth == false { if isHasAuth == false && isNoAuth == false {

View File

@@ -8,11 +8,11 @@
package controllers package controllers
import ( import (
"encoding/json"
"github.com/astaxie/beego"
"github.com/george518/PPGo_Job/models" "github.com/george518/PPGo_Job/models"
"strings" "strings"
"time" "time"
"github.com/astaxie/beego"
"encoding/json"
) )
type NotifyTplController struct { type NotifyTplController struct {
@@ -85,6 +85,10 @@ func (self *NotifyTplController) AjaxSave() {
notifyTpl.Content = strings.TrimSpace(self.GetString("content")) notifyTpl.Content = strings.TrimSpace(self.GetString("content"))
notifyTpl.Status, _ = self.GetInt("status") notifyTpl.Status, _ = self.GetInt("status")
if notifyTpl.Type == models.NotifyTplTypeSystem {
self.ajaxMsg("系统模板禁止更新", MSG_ERR)
}
if notifyTpl.TplType == 1 || notifyTpl.TplType == 2 || notifyTpl.TplType == 3 { if notifyTpl.TplType == 1 || notifyTpl.TplType == 2 || notifyTpl.TplType == 3 {
m := make(map[string]string) m := make(map[string]string)
err := json.Unmarshal([]byte(notifyTpl.Content), &m) err := json.Unmarshal([]byte(notifyTpl.Content), &m)
@@ -93,10 +97,6 @@ func (self *NotifyTplController) AjaxSave() {
} }
} }
if notifyTpl.Type == models.NotifyTplTypeSystem {
self.ajaxMsg("系统模板禁止更新", MSG_ERR)
}
if err := notifyTpl.Update(); err != nil { if err := notifyTpl.Update(); err != nil {
self.ajaxMsg("更新失败,"+err.Error(), MSG_ERR) self.ajaxMsg("更新失败,"+err.Error(), MSG_ERR)
} }

View File

@@ -117,9 +117,9 @@ func (self *TaskController) Copy() {
self.ajaxMsg(err.Error(), MSG_ERR) self.ajaxMsg(err.Error(), MSG_ERR)
} }
if task.Status == 1 { //if task.Status == 1 {
self.ajaxMsg("运行状态无法编辑任务,请先暂停任务", MSG_ERR) // self.ajaxMsg("运行状态无法编辑任务,请先暂停任务", MSG_ERR)
} //}
self.Data["task"] = task self.Data["task"] = task
self.Data["adminInfo"] = AllAdminInfo("") self.Data["adminInfo"] = AllAdminInfo("")

35
go.mod Normal file
View File

@@ -0,0 +1,35 @@
module PPGo_Job
go 1.25.0
require (
github.com/astaxie/beego v1.12.3
github.com/george518/PPGo_Job v2.8.0+incompatible
)
require (
filippo.io/edwards25519 v1.2.0 // indirect
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/go-sql-driver/mysql v1.9.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/linxiaozhi/go-telnet v0.0.0-20190217183315-a500ff0c2efc // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.23.2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.67.5 // indirect
github.com/prometheus/procfs v0.20.1 // indirect
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

216
go.sum Normal file
View File

@@ -0,0 +1,216 @@
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk=
github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ=
github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA=
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394 h1:OYA+5W64v3OgClL+IrOD63t4i/RW7RqrAVl9LTZ9UqQ=
github.com/axgle/mahonia v0.0.0-20180208002826-3358181d7394/go.mod h1:Q8n74mJTIgjX4RBBcHnJ05h//6/k6foqmgE45jTQtxg=
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI=
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/george518/PPGo_Job v2.8.0+incompatible h1:cSii3OAs9PfygboD8bpUZI/+raGmqW8z2GVA4nE37Hk=
github.com/george518/PPGo_Job v2.8.0+incompatible/go.mod h1:D/af0ZB2/BqQXpXz6nm+oMrQX1Z3pitGRUwOxoby3ig=
github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/linxiaozhi/go-telnet v0.0.0-20190217183315-a500ff0c2efc h1:FQTpORWGxHvz83hOXnlbdSuraUA4fumQ0dPDdCaxN7g=
github.com/linxiaozhi/go-telnet v0.0.0-20190217183315-a500ff0c2efc/go.mod h1:kkwxiW1i3uS0OgPQO4bkgBDeJuinEx1uR5DOGE12IQA=
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U=
github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o=
github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02 h1:v9ezJDHA1XGxViAUSIoO/Id7Fl63u6d0YmsAm+/p2hs=
github.com/shiena/ansicolor v0.0.0-20230509054315-a9deabde6e02/go.mod h1:RF16/A3L0xSa0oSERcnhd8Pu3IXSDZSK2gmGIMsttFE=
github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=

View File

@@ -222,16 +222,19 @@ func RemoteCommandJob(id int, serverId int, name string, command string, servers
jobresult.OutMsg = "" jobresult.OutMsg = ""
jobresult.ErrMsg = "" jobresult.ErrMsg = ""
jobresult.IsTimeout = false jobresult.IsTimeout = false
jobresult.IsOk = true
key, err := ioutil.ReadFile(servers.PrivateKeySrc) key, err := ioutil.ReadFile(servers.PrivateKeySrc)
if err != nil { if err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("读取私钥失败,%v", err.Error())
return return
} }
// Create the Signer for this private key. // Create the Signer for this private key.
signer, err := ssh.ParsePrivateKey(key) signer, err := ssh.ParsePrivateKey(key)
if err != nil { if err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("创建签名失败,%v", err.Error())
return return
} }
addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port)
@@ -250,6 +253,7 @@ func RemoteCommandJob(id int, serverId int, name string, command string, servers
client, err := ssh.Dial("tcp", addr, config) client, err := ssh.Dial("tcp", addr, config)
if err != nil { if err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败,%v", err.Error())
return return
} }
@@ -258,6 +262,7 @@ func RemoteCommandJob(id int, serverId int, name string, command string, servers
session, err := client.NewSession() session, err := client.NewSession()
if err != nil { if err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败,%v", err.Error())
return return
} }
defer session.Close() defer session.Close()
@@ -269,16 +274,18 @@ func RemoteCommandJob(id int, serverId int, name string, command string, servers
var c bytes.Buffer var c bytes.Buffer
session.Stdout = &b session.Stdout = &b
session.Stderr = &c session.Stderr = &c
jobresult.IsTimeout = false
//session.Output(command) //session.Output(command)
if err := session.Run(command); err != nil { if err := session.Run(command); err != nil {
jobresult.ErrMsg = c.String()
jobresult.OutMsg = b.String()
jobresult.IsOk = false jobresult.IsOk = false
return return
} }
jobresult.OutMsg = b.String() jobresult.OutMsg = b.String()
jobresult.ErrMsg = c.String() jobresult.ErrMsg = c.String()
jobresult.IsOk = true jobresult.IsOk = true
jobresult.IsTimeout = false
return return
} }
return job return job
@@ -306,6 +313,7 @@ func RemoteCommandJobByPassword(id int, serverId int, name string, command strin
jobresult.OutMsg = "" jobresult.OutMsg = ""
jobresult.ErrMsg = "" jobresult.ErrMsg = ""
jobresult.IsTimeout = false jobresult.IsTimeout = false
jobresult.IsOk = true
// get auth method // get auth method
auth = make([]ssh.AuthMethod, 0) auth = make([]ssh.AuthMethod, 0)
@@ -325,6 +333,7 @@ func RemoteCommandJobByPassword(id int, serverId int, name string, command strin
if client, err = ssh.Dial("tcp", addr, clientConfig); err != nil { if client, err = ssh.Dial("tcp", addr, clientConfig); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("连接服务器失败,%v", err.Error())
return return
} }
@@ -333,6 +342,7 @@ func RemoteCommandJobByPassword(id int, serverId int, name string, command strin
// create session // create session
if session, err = client.NewSession(); err != nil { if session, err = client.NewSession(); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("连接服务器失败,%v", err.Error())
return return
} }
@@ -343,12 +353,9 @@ func RemoteCommandJobByPassword(id int, serverId int, name string, command strin
//session.Output(command) //session.Output(command)
if err := session.Run(command); err != nil { if err := session.Run(command); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
return
} }
jobresult.OutMsg = b.String() jobresult.OutMsg = b.String()
jobresult.ErrMsg = c.String() jobresult.ErrMsg = c.String()
jobresult.IsOk = true
jobresult.IsTimeout = false
return return
} }
@@ -369,11 +376,13 @@ func RemoteCommandJobByTelnetPassword(id int, serverId int, name string, command
jobresult.OutMsg = "" jobresult.OutMsg = ""
jobresult.ErrMsg = "" jobresult.ErrMsg = ""
jobresult.IsTimeout = false jobresult.IsTimeout = false
jobresult.IsOk = true
addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port) addr := fmt.Sprintf("%s:%d", servers.ServerIp, servers.Port)
conn, err := gote.DialTimeout("tcp", addr, timeout) conn, err := gote.DialTimeout("tcp", addr, timeout)
if err != nil { if err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败0%v", err.Error())
return return
} }
@@ -383,26 +392,31 @@ func RemoteCommandJobByTelnetPassword(id int, serverId int, name string, command
if _, err = conn.Read(buf); err != nil { if _, err = conn.Read(buf); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-1%v", err.Error())
return return
} }
if _, err = conn.Write([]byte(servers.ServerAccount + "\r\n")); err != nil { if _, err = conn.Write([]byte(servers.ServerAccount + "\r\n")); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-2%v", err.Error())
return return
} }
if _, err = conn.Read(buf); err != nil { if _, err = conn.Read(buf); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-3%v", err.Error())
return return
} }
if _, err = conn.Write([]byte(servers.Password + "\r\n")); err != nil { if _, err = conn.Write([]byte(servers.Password + "\r\n")); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-4%v", err.Error())
return return
} }
if _, err = conn.Read(buf); err != nil { if _, err = conn.Read(buf); err != nil {
jobresult.IsOk = false jobresult.IsOk = false
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-5%v", err.Error())
return return
} }
@@ -419,6 +433,7 @@ func RemoteCommandJobByTelnetPassword(id int, serverId int, name string, command
for _, c := range commandArr { for _, c := range commandArr {
_, err = conn.Write([]byte(c + "\r\n")) _, err = conn.Write([]byte(c + "\r\n"))
if err != nil { if err != nil {
jobresult.ErrMsg = fmt.Sprintf("服务器连接失败-6%v", err.Error())
jobresult.IsOk = false jobresult.IsOk = false
return return
} }
@@ -573,6 +588,9 @@ func PollServer(j *Job) bool {
server.Status = 1 server.Status = 1
server.Update() server.Update()
return false return false
} else {
server.Status = 0
server.Update()
} }
return true return true
@@ -714,7 +732,7 @@ func (j *Job) Run() {
content = strings.Replace(content, "{{TaskId}}", strconv.Itoa(j.Task.Id), -1) content = strings.Replace(content, "{{TaskId}}", strconv.Itoa(j.Task.Id), -1)
content = strings.Replace(content, "{{ServerId}}", strconv.Itoa(j.ServerId), -1) content = strings.Replace(content, "{{ServerId}}", strconv.Itoa(j.ServerId), -1)
content = strings.Replace(content, "{{TaskName}}", j.Task.TaskName, -1) content = strings.Replace(content, "{{TaskName}}", j.Task.TaskName, -1)
content = strings.Replace(content, "{{ExecuteCommand}}", j.Task.Command, -1) content = strings.Replace(content, "{{ExecuteCommand}}", strings.Replace(j.Task.Command, "\"", "\\\"", -1), -1)
content = strings.Replace(content, "{{ExecuteTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1) content = strings.Replace(content, "{{ExecuteTime}}", beego.Date(time.Unix(log.CreateTime, 0), "Y-m-d H:i:s"), -1)
content = strings.Replace(content, "{{ProcessTime}}", strconv.FormatFloat(float64(log.ProcessTime)/1000, 'f', 6, 64), -1) content = strings.Replace(content, "{{ProcessTime}}", strconv.FormatFloat(float64(log.ProcessTime)/1000, 'f', 6, 64), -1)
content = strings.Replace(content, "{{ExecuteStatus}}", TextStatus[status], -1) content = strings.Replace(content, "{{ExecuteStatus}}", TextStatus[status], -1)

View File

@@ -9,16 +9,55 @@ package models
import ( import (
"net/url" "net/url"
"os"
"path/filepath"
"github.com/astaxie/beego" "github.com/astaxie/beego"
"github.com/astaxie/beego/orm" "github.com/astaxie/beego/orm"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"
) )
var StartTime int64 var StartTime int64
func Init(startTime int64) { func Init(startTime int64) {
StartTime = startTime StartTime = startTime
dbType := beego.AppConfig.String("db.type")
if dbType == "" {
dbType = "mysql"
}
if dbType == "sqlite" {
dbpath := beego.AppConfig.String("db.path")
if dbpath == "" {
dbpath = "./data/ppgo_job.db"
}
dir := filepath.Dir(dbpath)
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
panic(err)
}
dsn := dbpath
orm.RegisterDataBase("default", "sqlite3", dsn)
orm.RegisterModel(
new(Admin),
new(Auth),
new(Role),
new(RoleAuth),
new(ServerGroup),
new(TaskServer),
new(Ban),
new(Group),
new(Task),
new(TaskLog),
new(NotifyTpl),
)
if beego.AppConfig.String("runmode") == "dev" {
orm.Debug = true
}
} else {
dbhost := beego.AppConfig.String("db.host") dbhost := beego.AppConfig.String("db.host")
dbport := beego.AppConfig.String("db.port") dbport := beego.AppConfig.String("db.port")
dbuser := beego.AppConfig.String("db.user") dbuser := beego.AppConfig.String("db.user")
@@ -50,6 +89,7 @@ func Init(startTime int64) {
if beego.AppConfig.String("runmode") == "dev" { if beego.AppConfig.String("runmode") == "dev" {
orm.Debug = true orm.Debug = true
} }
}
} }
func TableName(name string) string { func TableName(name string) string {

View File

@@ -9,7 +9,6 @@ package models
import ( import (
"fmt" "fmt"
"strconv"
"time" "time"
"github.com/astaxie/beego/orm" "github.com/astaxie/beego/orm"
@@ -109,7 +108,7 @@ func TaskGetById(id int) (*Task, error) {
return task, nil return task, nil
} }
//修改为逻辑删除 // 修改为逻辑删除
func TaskDel(id int) (int64, error) { func TaskDel(id int) (int64, error) {
return orm.NewOrm().QueryTable(TableName("task")).Filter("id", id).Update(orm.Params{ return orm.NewOrm().QueryTable(TableName("task")).Filter("id", id).Update(orm.Params{
"status": -1, "status": -1,
@@ -118,24 +117,12 @@ func TaskDel(id int) (int64, error) {
//return err //return err
} }
//运行总次数 // 运行总次数
func TaskTotalRunNum() (int64, error) { func TaskTotalRunNum() (int64, error) {
var total int64
res := make(orm.Params) err := orm.NewOrm().Raw("SELECT COALESCE(SUM(execute_times), 0) as num FROM " + TableName("task")).QueryRow(&total)
_, err := orm.NewOrm().Raw("select sum(execute_times) as num,task_name from pp_task").RowsToMap(&res, "num", "task_name")
if err != nil { if err != nil {
return 0, err return 0, err
} }
return total, nil
for k, _ := range res {
i64, err := strconv.ParseInt(k, 10, 64)
if err != nil {
return 0, err
}
return i64, nil
}
return 0, nil
} }

File diff suppressed because one or more lines are too long

1
run.sh
View File

@@ -4,7 +4,6 @@
# @Last Modified by: haodaquan # @Last Modified by: haodaquan
# @Last Modified time: 2017-06-29 17:44:45 # @Last Modified time: 2017-06-29 17:44:45
case $1 in case $1 in
start) start)
nohup ./PPGo_Job 2>&1 >> info.log 2>&1 /dev/null & nohup ./PPGo_Job 2>&1 >> info.log 2>&1 /dev/null &

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="realName" id="realName" autocomplete="off" placeholder="真实姓名" > <input class="layui-input" name="realName" id="realName" autocomplete="off" placeholder="真实姓名" >
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -45,6 +45,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/admin/table' ,url: '/admin/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:150} {field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<a class="layui-btn" data-type="tabAdd" id="tabAdd" href="javascript:void(0)">新增</a> <a class="layui-btn layui-btn-sm" data-type="tabAdd" id="tabAdd" href="javascript:void(0)">新增</a>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="code" id="code" autocomplete="off" placeholder="禁用命令" > <input class="layui-input" name="code" id="code" autocomplete="off" placeholder="禁用命令" >
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -43,6 +43,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/ban/table' ,url: '/ban/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:150} {field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="groupName" id="groupName" autocomplete="off" placeholder="分组名称" > <input class="layui-input" name="groupName" id="groupName" autocomplete="off" placeholder="分组名称" >
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -43,6 +43,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/group/table' ,url: '/group/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:150} {field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -34,7 +34,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label mw200">模板内容</label> <label class="layui-form-label mw200">模板内容</label>
<div class="layui-input-inline mw400"> <div class="layui-input-inline mw400">
<textarea rows="10" name="content" id="content" placeholder="请输入模板内容" class="layui-textarea"></textarea> <textarea rows="100" name="content" id="content" style="height: 300px" placeholder="请输入模板内容" class="layui-textarea"></textarea>
</div> </div>
<div class="layui-form-mid layui-word-aux" style="padding: 0px 0px !important;"> <div class="layui-form-mid layui-word-aux" style="padding: 0px 0px !important;">
<pre class="layui-code" style="margin: 0;"> <pre class="layui-code" style="margin: 0;">

View File

@@ -34,7 +34,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label mw200">模板内容</label> <label class="layui-form-label mw200">模板内容</label>
<div class="layui-input-inline mw400"> <div class="layui-input-inline mw400">
<textarea rows="10" name="content" id="content" lay-verify="required" placeholder="请输入模板内容" <textarea rows="100" name="content" id="content" style="height: 300px" lay-verify="required" placeholder="请输入模板内容"
class="layui-textarea">{{.notifyTpl.content}}</textarea> class="layui-textarea">{{.notifyTpl.content}}</textarea>
</div> </div>
<div class="layui-form-mid layui-word-aux" style="padding: 0px 0px !important;"> <div class="layui-form-mid layui-word-aux" style="padding: 0px 0px !important;">

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="tplName" id="tplName" autocomplete="off" placeholder="模板名称"> <input class="layui-input" name="tplName" id="tplName" autocomplete="off" placeholder="模板名称">
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -41,6 +41,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
, url: '/notifytpl/table' , url: '/notifytpl/table'
,size: 'sm' //小尺寸的表格
, cols: [[ , cols: [[
{checkbox: true, fixed: true}, {checkbox: true, fixed: true},
{field: 'id', title: 'ID', align: 'center', sort: true, width: 150}, {field: 'id', title: 'ID', align: 'center', sort: true, width: 150},

View File

@@ -17,6 +17,18 @@
.modal-hide{ .modal-hide{
display: none; display: none;
} }
/*控制按钮和input大小*/
.layui-form-label {
padding: 5px 15px;
}
.layui-input, .layui-select, .layui-textarea {
height: 30px;
line-height: 30px;
}
.layui-form-select dl dd, .layui-form-select dl dt {
line-height: 30px;
}
</style> </style>
<body> <body>
<!-- 公共头部 start--> <!-- 公共头部 start-->

View File

@@ -26,13 +26,14 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">资源分组</label> <label class="layui-form-label">资源分组</label>
<div class="layui-input-inline mw400 "> <div class="layui-input-inline mw400 ">
<input type="checkbox" name="server_group_id" lay-filter="server_group_id" title="本地服务器组" value="0" lay-skin="primary" checked> <input type="checkbox" name="server_group_id" lay-filter="server_group_id" title="本地服务器组" value="0" lay-skin="primary" {{range $ks,$vs:=$.server_group_ids}} {{if eq $vs 0}}checked {{end}}{{end}}>
{{range $k, $v := .serverGroup}} {{range $k, $v := .serverGroup}}
<input type="checkbox" name="server_group_id" lay-filter="server_group_id" title="{{$v.GroupName}}" value="{{$v.GroupId}}" {{range $ks,$vs:=$.server_group_ids}} {{if eq $v.GroupId $vs}}checked{{end}}{{end}} lay-skin="primary"> <input type="checkbox" name="server_group_id" lay-filter="server_group_id" title="{{$v.GroupName}}" value="{{$v.GroupId}}" {{range $ks,$vs:=$.server_group_ids}} {{if eq $vs $v.GroupId}}checked {{end}}{{end}} lay-skin="primary">
{{end}} {{end}}
<input type="hidden" name="server_group_ids" id="server_group_ids" value="{{.role.server_group_ids}}"> <input type="hidden" name="server_group_ids" id="server_group_ids" value="{{.role.server_group_ids}}">
</div> </div>
<div class="layui-form-mid layui-word-aux"></div> <div class="layui-form-mid layui-word-aux"></div>
</div> </div>

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="roleName" id="roleName" autocomplete="off" placeholder="角色名称" > <input class="layui-input" name="roleName" id="roleName" autocomplete="off" placeholder="角色名称" >
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -40,6 +40,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/role/table' ,url: '/role/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:150} {field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -17,7 +17,7 @@
{{end}} {{end}}
</select> </select>
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -51,6 +51,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/server/table' ,url: '/server/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:80} {field:'id', title: 'ID', align:'center',sort: true, width:80}

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -9,7 +9,7 @@
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%">
<input class="layui-input" name="groupName" id="groupName" autocomplete="off" placeholder="分组名称" > <input class="layui-input" name="groupName" id="groupName" autocomplete="off" placeholder="分组名称" >
</div> </div>
<button class="layui-btn" data-type="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload">查询</button>
</div> </div>
</form> </form>
@@ -43,6 +43,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/servergroup/table' ,url: '/servergroup/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
// {checkbox: true, fixed: true}, // {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:150} {field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -2,9 +2,9 @@
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<div class="layui-btn-group"> <div class="layui-btn-group">
<a class="layui-btn" data-type="tabAdd" href="/task/add">新增任务</a> <a class="layui-btn layui-btn-sm" data-type="tabAdd" href="/task/add">新增任务</a>
<button class="layui-btn batch" data-type="batchaudit" >审核通过</button> <button class="layui-btn layui-btn-sm batch" data-type="batchaudit" >审核通过</button>
<button class="layui-btn layui-btn-danger batch" data-type="batchnopass" >审核不通过</button> <button class="layui-btn layui-btn-sm layui-btn-danger batch" data-type="batchnopass" >审核不通过</button>
</div> </div>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
@@ -15,7 +15,7 @@
<input class="layui-input" name="taskName" id="taskName" autocomplete="off" placeholder="任务名称" > <input class="layui-input" name="taskName" id="taskName" autocomplete="off" placeholder="任务名称" >
</div> </div>
<button class="layui-btn" data-type="reload" id="reload">查询</button> <button class="layui-btn layui-btn-sm" data-type="reload" id="search">查询</button>
</div> </div>
</form> </form>
@@ -51,6 +51,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/task/table?status=2' ,url: '/task/table?status=2'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
{checkbox: true, fixed: true}, {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center',sort: true, width:80} {field:'id', title: 'ID', align:'center',sort: true, width:80}
@@ -137,7 +138,7 @@
$.post('/task/ajax'+action, {"ids":ids}, function (out) { $.post('/task/ajax'+action, {"ids":ids}, function (out) {
if (out.status == 0) { if (out.status == 0) {
layer.msg(msgok,{icon: 1,shade:0.3,time:1000},function () { layer.msg(msgok,{icon: 1,shade:0.3,time:1000},function () {
$('#reload').click(); $('#search').click();
}) })
} else { } else {
layer.msg(out.message) layer.msg(out.message)

View File

@@ -1,17 +1,18 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<div class="layui-btn-group"> <div class="layui-btn-group">
<button class="layui-btn" data-type="tabAdd" id="add">新增</button> <button class="layui-btn layui-btn-sm" data-type="tabAdd" id="add">新增</button>
<button class="layui-btn batch" data-type="batchstart" >启动</button> <button class="layui-btn layui-btn-sm batch" data-type="batchstart" >启动</button>
<button class="layui-btn layui-btn-danger batch" data-type="batchpause" >暂停</button>cron <button class="layui-btn layui-btn-sm layui-btn-danger batch" data-type="batchpause" >暂停</button>cron
</div> </div>
</div> </div>
<div class="layui-col-xs6 search_text" style="text-align: right;"> <div class="layui-col-xs6 search_text" style="text-align: right;">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
<div class="demoTable"> <div class="demoTable">
<div class="layui-inline" style="width: 40%"> <div class="layui-inline" style="width: 40%;">
<input class="layui-input" name="task_name" id="task_name" autocomplete="off" placeholder="任务名称" > <input class="layui-input" name="task_name" id="task_name" autocomplete="off" placeholder="任务名称" >
</div> </div>
<div class="layui-inline pp-search" style="width: 20%;text-align: left;"> <div class="layui-inline pp-search" style="width: 20%;text-align: left;">
@@ -22,7 +23,7 @@
{{end}} {{end}}
</select> </select>
</div> </div>
<button class="layui-btn" data-type="reload" id="reload"><i class="fa fa-search"></i>查询</button> <button class="layui-btn layui-btn-sm" data-type="reload" id="search"><i class="fa fa-search"></i>查询</button>
</div> </div>
</form> </form>
</div> </div>
@@ -56,6 +57,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: '/task/table' ,url: '/task/table'
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
{checkbox: true, fixed: true}, {checkbox: true, fixed: true},
{field:'id', title: 'ID', align:'center', width:80,sort: true} {field:'id', title: 'ID', align:'center', width:80,sort: true}
@@ -155,7 +157,7 @@
$.post('/task/ajax'+action, {"ids":ids}, function (out) { $.post('/task/ajax'+action, {"ids":ids}, function (out) {
if (out.status == 0) { if (out.status == 0) {
layer.msg("操作成功",{icon: 1,shade:0.3,time:1000},function () { layer.msg("操作成功",{icon: 1,shade:0.3,time:1000},function () {
$('#reload').click(); $('#search').click();
}) })
} else { } else {
layer.msg(out.message) layer.msg(out.message)

View File

@@ -1,7 +1,7 @@
<div class="layui-layout layui-layout-admin" style="padding-left: 20px;"> <div class="layui-layout layui-layout-admin" style="padding-left: 20px;">
<div class="layui-row" style="margin-top: 20px;"> <div class="layui-row" style="margin-top: 20px;">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<button class="layui-btn layui-btn-danger" data-type="tabDel" id="tabDel">批量删除</button> <button class="layui-btn layui-btn-sm layui-btn-danger" data-type="tabDel" id="tabDel">批量删除</button>
</div> </div>
<div class="layui-col-xs6 search_text"> <div class="layui-col-xs6 search_text">
<form class="layui-form" action="" onsubmit="javascript:return false;"> <form class="layui-form" action="" onsubmit="javascript:return false;">
@@ -44,6 +44,7 @@
table.render({ table.render({
elem: '#table_list' elem: '#table_list'
,url: "/tasklog/table?task_id={{.task_id}}" ,url: "/tasklog/table?task_id={{.task_id}}"
,size: 'sm' //小尺寸的表格
,cols: [[ ,cols: [[
{checkbox: true, fixed: true} {checkbox: true, fixed: true}
// ,{field:'id', title: 'ID', align:'center',sort: true, width:150} // ,{field:'id', title: 'ID', align:'center',sort: true, width:150}

View File

@@ -48,7 +48,7 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">是否修改</label> <label class="layui-form-label">密码修改</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="radio" name="reset_pwd" lay-verify="reset_pwd" value="1" title="是"> <input type="radio" name="reset_pwd" lay-verify="reset_pwd" value="1" title="是">
<input type="radio" name="reset_pwd" lay-verify="reset_pwd" value="2" title="否" checked> <input type="radio" name="reset_pwd" lay-verify="reset_pwd" value="2" title="否" checked>