forked from x/icebergs
opt some
This commit is contained in:
parent
7e40569cba
commit
07156e688e
@ -130,6 +130,9 @@ func _hash_inputs(m *ice.Message, prefix, chain string, field, value string) {
|
||||
if field == kit.MDB_HASH {
|
||||
list[key]++
|
||||
} else {
|
||||
if kit.Format(val["count"]) != "" {
|
||||
list[kit.Format(val[field])] = kit.Int(val["count"])
|
||||
}
|
||||
list[kit.Format(val[field])]++
|
||||
}
|
||||
})
|
||||
@ -137,7 +140,7 @@ func _hash_inputs(m *ice.Message, prefix, chain string, field, value string) {
|
||||
m.Push(field, k)
|
||||
m.Push(kit.MDB_COUNT, i)
|
||||
}
|
||||
m.Sort(kit.MDB_COUNT, "int_r")
|
||||
m.SortIntR(kit.MDB_COUNT)
|
||||
}
|
||||
|
||||
func HashAction(fields ...string) map[string]*ice.Action {
|
||||
|
1
conf.go
1
conf.go
@ -146,6 +146,7 @@ const ( // PROCESS
|
||||
PROCESS_LOCATION = "_location"
|
||||
PROCESS_REFRESH = "_refresh"
|
||||
PROCESS_REWRITE = "_rewrite"
|
||||
PROCESS_DISPLAY = "_display"
|
||||
PROCESS_FIELD = "_field"
|
||||
PROCESS_INNER = "_inner"
|
||||
|
||||
|
@ -86,7 +86,7 @@ func _action_show(m *ice.Message, river, storm, index string, arg ...string) {
|
||||
m.Cmdy(cmds, arg) // 执行命令
|
||||
}
|
||||
}
|
||||
func _action_upload(m *ice.Message, arg ...string) {
|
||||
func _action_upload(m *ice.Message) {
|
||||
msg := m.Cmd(web.CACHE, web.UPLOAD)
|
||||
m.Option(ice.MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME), msg.Append(kit.MDB_SIZE))
|
||||
}
|
||||
|
@ -55,7 +55,11 @@ func init() {
|
||||
m.RenderDownload(p)
|
||||
}
|
||||
}},
|
||||
CMD: {Name: "cmd path auto up home", Help: "命令", Action: map[string]*ice.Action{
|
||||
CMD: {Name: "cmd path auto upload up home", Help: "命令", Action: map[string]*ice.Action{
|
||||
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||
_action_upload(m)
|
||||
m.Upload(path.Join(m.Conf(CMD, kit.META_PATH), strings.TrimPrefix(path.Dir(m.R.URL.Path), "/cmd")))
|
||||
}},
|
||||
"home": {Name: "home", Help: "根目录", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessLocation("/chat/cmd/")
|
||||
}},
|
||||
|
@ -26,7 +26,7 @@ func init() {
|
||||
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(web.SPIDE, web.SPIDE_DEV, web.SPIDE_RAW,
|
||||
m.Option(cli.CMD), m.Option(cli.API), web.SPIDE_DATA, m.Option(cli.ARG)))))
|
||||
m.Info(`curl "` + m.Option(cli.API) + `" -H "Content-Type: application/json"` + ` -d '` + m.Option(cli.ARG) + `'`)
|
||||
m.ProcessInner()
|
||||
m.ProcessDisplay("/plugin/local/wiki/json.js")
|
||||
}},
|
||||
cli.CHECK: {Name: "check", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.ProcessInner(); len(arg) > 0 {
|
||||
|
@ -142,7 +142,7 @@ func init() {
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, TASK, m.Prefix(TASK))
|
||||
}},
|
||||
TASK: {Name: "task zone id auto insert export import", Help: "任务", Action: map[string]*ice.Action{
|
||||
TASK: {Name: "task zone id auto insert export import", Help: "任务", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||
_task_create(m, arg[1])
|
||||
_task_insert(m, arg[1], arg[2:]...)
|
||||
@ -181,7 +181,7 @@ func init() {
|
||||
END: {Name: "end", Help: "完成", Hand: func(m *ice.Message, arg ...string) {
|
||||
_task_modify(m, STATUS, FINISH)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
}, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Fields(len(arg), "time,zone,count", m.Conf(TASK, kit.META_FIELD))
|
||||
if m.Cmdy(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, arg); len(arg) == 0 {
|
||||
m.PushAction(mdb.REMOVE)
|
||||
|
@ -11,14 +11,12 @@ const JSON = "json"
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{
|
||||
Configs: map[string]*ice.Config{
|
||||
JSON: {Name: JSON, Help: "数据表格", Value: kit.Data(
|
||||
kit.MDB_PATH, ice.USR_LOCAL_EXPORT, kit.MDB_REGEXP, ".*\\.csv",
|
||||
JSON: {Name: JSON, Help: "数据结构", Value: kit.Data(
|
||||
kit.MDB_PATH, ice.USR_LOCAL_EXPORT, kit.MDB_REGEXP, ".*\\.json",
|
||||
)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
JSON: {Name: "json path auto", Help: "数据结构", Meta: kit.Dict(
|
||||
ice.Display("/plugin/local/wiki/json.js"),
|
||||
), Action: map[string]*ice.Action{
|
||||
JSON: {Name: "json path auto", Help: "数据结构", Meta: kit.Dict(ice.Display("/plugin/local/wiki/json.js")), Action: map[string]*ice.Action{
|
||||
nfs.SAVE: {Name: "save path text", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||
_wiki_save(m, JSON, arg[0], arg[1])
|
||||
}},
|
||||
|
@ -26,7 +26,7 @@ func _favor_list(m *ice.Message, zone, id string, fields ...string) {
|
||||
// 列表信息
|
||||
m.Push(zone, value, fields, val)
|
||||
})
|
||||
m.Sort(kit.MDB_ID, "int_r")
|
||||
m.SortIntR(kit.MDB_ID)
|
||||
return
|
||||
}
|
||||
m.Grows(FAVOR, kit.Keys(kit.MDB_HASH, key), kit.MDB_ID, id, func(index int, value map[string]interface{}) {
|
||||
|
@ -172,6 +172,10 @@ func (m *Message) ProcessField(arg ...interface{}) {
|
||||
m.Process(PROCESS_FIELD)
|
||||
m.Option("_prefix", arg...)
|
||||
}
|
||||
func (m *Message) ProcessDisplay(arg ...interface{}) {
|
||||
m.Process(PROCESS_DISPLAY)
|
||||
m.Option("_display", arg...)
|
||||
}
|
||||
func (m *Message) ProcessInner() { m.Process(PROCESS_INNER) }
|
||||
func (m *Message) ProcessHold() { m.Process(PROCESS_HOLD) }
|
||||
func (m *Message) ProcessBack() { m.Process(PROCESS_BACK) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user