forked from x/ContextOS
add mdb.note.search
This commit is contained in:
parent
399bfd20bd
commit
91594beb2c
@ -1,4 +1,5 @@
|
|||||||
~aaa
|
~aaa
|
||||||
|
user root shy shy
|
||||||
user root shaoying shaoying
|
user root shaoying shaoying
|
||||||
user root oLqNu5iJYXXLbHM9WuvM0W1obfHM what
|
user root oLqNu5iJYXXLbHM9WuvM0W1obfHM what
|
||||||
user root o978M0XIrcmco28CU1UbPgNxIL78 what
|
user root o978M0XIrcmco28CU1UbPgNxIL78 what
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
~mdb
|
||||||
|
config save note.json note
|
||||||
|
~aaa
|
||||||
|
config save auth.json auth
|
||||||
|
|
@ -1,3 +1,8 @@
|
|||||||
|
# ~aaa
|
||||||
|
# config load auth.json auth
|
||||||
|
# ~mdb
|
||||||
|
# config load note.json note
|
||||||
|
#
|
||||||
source common.shy
|
source common.shy
|
||||||
~ssh
|
~ssh
|
||||||
remote auto
|
remote auto
|
||||||
|
@ -113,10 +113,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
":": []string{"command"},
|
":": []string{"command"},
|
||||||
"::": []string{"command", "list"},
|
"::": []string{"command", "list"},
|
||||||
|
|
||||||
// "pwd": []string{"nfs.pwd"},
|
"note": []string{"mdb.note"},
|
||||||
// "path": []string{"nfs.path"},
|
"pwd": []string{"nfs.pwd"},
|
||||||
// "dir": []string{"nfs.dir"},
|
"path": []string{"nfs.path"},
|
||||||
// "git": []string{"nfs.git"},
|
"dir": []string{"nfs.dir"},
|
||||||
|
"git": []string{"nfs.git"},
|
||||||
"brow": []string{"web.brow"},
|
"brow": []string{"web.brow"},
|
||||||
"ifconfig": []string{"tcp.ifconfig"},
|
"ifconfig": []string{"tcp.ifconfig"},
|
||||||
}, Help: "启动脚本"},
|
}, Help: "启动脚本"},
|
||||||
|
@ -359,6 +359,13 @@ var Index = &Context{Name: "ctx", Help: "模块中心", Server: &CTX{},
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := msg.Data[k]; ok {
|
||||||
|
b, e := json.MarshalIndent(v, "", " ")
|
||||||
|
m.Log("fuck", " %v", b)
|
||||||
|
m.Log("fuck", " %v", e)
|
||||||
|
m.Echo(kit.Formats(v))
|
||||||
|
return e
|
||||||
|
}
|
||||||
for i, v := range msg.Meta[k] {
|
for i, v := range msg.Meta[k] {
|
||||||
m.Add("append", "index", i)
|
m.Add("append", "index", i)
|
||||||
m.Add("append", "value", v)
|
m.Add("append", "value", v)
|
||||||
|
@ -499,9 +499,11 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
hm, _ := kit.Hash("type", arg[0], "name", "shy")
|
hm, _ := kit.Hash("type", arg[0], "name", "shy")
|
||||||
if len(arg) == 2 && arg[0] == "value" {
|
if len(arg) == 2 && arg[0] == "value" {
|
||||||
hm, _ = kit.Hash("type", "index", "name", arg[1])
|
hm, _ = kit.Hash("type", "index", "name", arg[1])
|
||||||
|
hm = m.Conf("note", []string{hm, "ship", "value", "data"})
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
} else if len(arg) == 2 && arg[0] == "note" {
|
} else if len(arg) == 2 && arg[0] == "note" {
|
||||||
hm, _ = kit.Hash("type", "model", "name", arg[1])
|
hm, _ = kit.Hash("type", "model", "name", arg[1])
|
||||||
|
hm = m.Conf("note", []string{hm, "ship", "note", "data"})
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,6 +515,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
m.Add("append", "access_time", model["access_time"])
|
m.Add("append", "access_time", model["access_time"])
|
||||||
m.Add("append", "type", model["type"])
|
m.Add("append", "type", model["type"])
|
||||||
m.Add("append", "name", model["name"])
|
m.Add("append", "name", model["name"])
|
||||||
|
m.Add("append", "view", kit.Format(model["view"]))
|
||||||
m.Add("append", "data", kit.Format(model["data"]))
|
m.Add("append", "data", kit.Format(model["data"]))
|
||||||
m.Add("append", "ship", kit.Format(model["ship"]))
|
m.Add("append", "ship", kit.Format(model["ship"]))
|
||||||
}
|
}
|
||||||
@ -521,12 +524,48 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
|
case "search":
|
||||||
|
hv, _ := kit.Hash("type", "value", "name", arg[1], "data", kit.Select(m.Option(arg[1]), arg, 2))
|
||||||
|
hn := m.Conf("note", []string{hv, "ship", "note", "data"})
|
||||||
|
|
||||||
|
for i := 0; hn != "" && i < kit.Int(kit.Select(m.Conf("page_limit"), m.Option("limit"))); hn, i = m.Conf("note", []string{hn, "ship", hv, "data"}), i+1 {
|
||||||
|
note := m.Confm("note", hn)
|
||||||
|
hvs := kit.Trans(note["data"])
|
||||||
|
hm := kit.Format(kit.Chain(note, "ship.model.data"))
|
||||||
|
|
||||||
|
value := []interface{}{}
|
||||||
|
m.Confm("note", []string{hm, "data"}, func(i int, model map[string]interface{}) {
|
||||||
|
value = append(value, map[string]interface{}{
|
||||||
|
"type": model["type"], "name": model["name"],
|
||||||
|
"value": m.Conf("note", []string{hvs[i], "data"}),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
m.Add("append", "key", hn)
|
||||||
|
m.Add("append", "create_time", note["create_time"])
|
||||||
|
m.Add("append", "access_time", note["access_time"])
|
||||||
|
m.Add("append", "type", note["type"])
|
||||||
|
m.Add("append", "name", note["name"])
|
||||||
|
m.Add("append", "model", m.Conf("note", []string{hm, "name"}))
|
||||||
|
m.Add("append", "view", kit.Format(m.Conf("note", []string{hm, "view"})))
|
||||||
|
m.Add("append", "value", kit.Format(value))
|
||||||
|
m.Add("append", "data", kit.Format(note["data"]))
|
||||||
|
m.Add("append", "ship", kit.Format(note["ship"]))
|
||||||
|
}
|
||||||
|
m.Table()
|
||||||
|
|
||||||
case "model":
|
case "model":
|
||||||
// 模板详情
|
// 模板详情
|
||||||
hm, _ := kit.Hash("type", arg[0], "name", arg[1])
|
hm, _ := kit.Hash("type", arg[0], "name", arg[1])
|
||||||
if len(arg) == 2 {
|
if len(arg) == 2 {
|
||||||
m.CopyFuck(m.Cmd("mdb.config", "note", hm), "append").Set("result").Table()
|
m.CopyFuck(m.Cmd("mdb.config", "note", hm), "append").Set("result").Table()
|
||||||
return
|
break
|
||||||
|
}
|
||||||
|
if arg[2] == "view" {
|
||||||
|
for i := 4; i < len(arg)-1; i += 2 {
|
||||||
|
m.Conf("note", []string{hm, "view", arg[3], arg[i]}, arg[i+1])
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作模板
|
// 操作模板
|
||||||
@ -610,7 +649,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
|
|
||||||
data := []interface{}{}
|
data := []interface{}{}
|
||||||
m.Confm("note", []string{hm, "data"}, func(i int, index map[string]interface{}) {
|
m.Confm("note", []string{hm, "data"}, func(i int, index map[string]interface{}) {
|
||||||
hv := m.Cmdx("mdb.note", "value", index["type"], kit.Select("", arg, i+2))
|
hv := m.Cmdx("mdb.note", "value", index["type"], kit.Select(m.Option(kit.Format(index["name"])), arg, i+2))
|
||||||
data = append(data, hv)
|
data = append(data, hv)
|
||||||
|
|
||||||
ship[hv] = map[string]interface{}{"type": "note", "data": m.Conf("note", []string{hv, "ship", "note", "data"})}
|
ship[hv] = map[string]interface{}{"type": "note", "data": m.Conf("note", []string{hv, "ship", "note", "data"})}
|
||||||
|
@ -145,7 +145,7 @@ func (web *WEB) HandleCmd(m *ctx.Message, key string, cmd *ctx.Command) {
|
|||||||
msg.Optionv("debug", false)
|
msg.Optionv("debug", false)
|
||||||
|
|
||||||
msg.Option("GOOS", m.Conf("runtime", "host.GOOS"))
|
msg.Option("GOOS", m.Conf("runtime", "host.GOOS"))
|
||||||
msg.Option("GOOS", m.Conf("runtime", "host.GOARCH"))
|
msg.Option("GOARCH", m.Conf("runtime", "host.GOARCH"))
|
||||||
agent := r.Header.Get("User-Agent")
|
agent := r.Header.Get("User-Agent")
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(agent, "Macintosh"):
|
case strings.Contains(agent, "Macintosh"):
|
||||||
@ -172,6 +172,22 @@ func (web *WEB) HandleCmd(m *ctx.Message, key string, cmd *ctx.Command) {
|
|||||||
msg.Option(k, v)
|
msg.Option(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch r.Header.Get("Content-Type") {
|
||||||
|
case "application/json":
|
||||||
|
var data interface{}
|
||||||
|
json.NewDecoder(r.Body).Decode(&data)
|
||||||
|
msg.Optionv("content_data", data)
|
||||||
|
|
||||||
|
switch d := data.(type) {
|
||||||
|
case map[string]interface{}:
|
||||||
|
for k, v := range d {
|
||||||
|
for _, v := range kit.Trans(v) {
|
||||||
|
msg.Add("option", k, v)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if msg.Put("option", "request", r).Put("option", "response", w).Sess("web", msg); web.Login(msg, w, r) {
|
if msg.Put("option", "request", r).Put("option", "response", w).Sess("web", msg); web.Login(msg, w, r) {
|
||||||
msg.Log("cmd", "%s [] %v", key, msg.Meta["option"])
|
msg.Log("cmd", "%s [] %v", key, msg.Meta["option"])
|
||||||
cmd.Hand(msg, msg.Target(), msg.Option("path"))
|
cmd.Hand(msg, msg.Target(), msg.Option("path"))
|
||||||
|
@ -198,6 +198,10 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if m.Option("username") == "o978M0XIrcmco28CU1UbPgNxIL78" {
|
||||||
|
m.Option("username", "shy")
|
||||||
|
}
|
||||||
|
|
||||||
// 创建空间
|
// 创建空间
|
||||||
if !m.Options("bench") && m.Option("bench", m.Cmd("aaa.sess", m.Option("sessid"), "bench").Append("key")) == "" {
|
if !m.Options("bench") && m.Option("bench", m.Cmd("aaa.sess", m.Option("sessid"), "bench").Append("key")) == "" {
|
||||||
m.Option("bench", m.Cmdx("aaa.work", m.Option("sessid"), "mp"))
|
m.Option("bench", m.Cmdx("aaa.work", m.Option("sessid"), "mp"))
|
||||||
@ -205,10 +209,10 @@ var Index = &ctx.Context{Name: "chat", Help: "会议中心",
|
|||||||
m.Option("current_ctx", kit.Select("chat", m.Magic("bench", "current_ctx")))
|
m.Option("current_ctx", kit.Select("chat", m.Magic("bench", "current_ctx")))
|
||||||
|
|
||||||
// 执行命令
|
// 执行命令
|
||||||
cmd := strings.Split(m.Option("cmd"), " ")
|
cmd := kit.Trans(m.Optionv("cmd"))
|
||||||
if !m.Cmds("aaa.work", m.Option("bench"), "right", m.Option("username"), "mp", cmd[0]) {
|
if !m.Cmds("aaa.work", m.Option("bench"), "right", m.Option("username"), "mp", cmd[0]) {
|
||||||
m.Echo("no right %s %s", "chat", cmd[0])
|
m.Echo("no right %s %s", "chat", cmd[0])
|
||||||
} else if m.Cmdy(m.Option("cmd")); m.Appends("redirect") {
|
} else if m.Cmdy(cmd); m.Appends("redirect") {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
|
@ -177,6 +177,8 @@ func Formats(arg ...interface{}) string {
|
|||||||
default:
|
default:
|
||||||
if b, e := json.MarshalIndent(val, "", " "); e == nil {
|
if b, e := json.MarshalIndent(val, "", " "); e == nil {
|
||||||
result = append(result, string(b))
|
result = append(result, string(b))
|
||||||
|
} else {
|
||||||
|
result = append(result, fmt.Sprintf("%#v", val))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user