add commad sys
This commit is contained in:
@@ -21,7 +21,7 @@ type CommandModel struct {
|
||||
// NewCommand -
|
||||
func NewCommand(key, value, platform, binding string, requireManage, requireInit bool) (c *CommandModel, err error) {
|
||||
if len(key) == 0 || len(value) == 0 {
|
||||
return nil, errors.New("cmd, server or value is empty")
|
||||
return nil, errors.New("key, server or value is empty")
|
||||
}
|
||||
|
||||
c = &CommandModel{
|
||||
@@ -100,10 +100,10 @@ func GetGlobalCommand(key string) (list []*CommandModel, err error) {
|
||||
return nil, errors.New("key is empty")
|
||||
}
|
||||
db := models.GetConn()
|
||||
query := `select "cmd", "server", "value", "require_manage", "require_init", "ctime", "mtime"
|
||||
query := `select "key", "platform", "binding", "value", "require_manage", "require_init", "ctime", "mtime"
|
||||
from "command"
|
||||
where
|
||||
"cmd" = $1
|
||||
"key" = $1
|
||||
and "platform" = ''
|
||||
and "binding" = ''`
|
||||
err = db.Select(&list, query, key)
|
||||
|
||||
Reference in New Issue
Block a user