mirror of
https://shylinux.com/x/icebergs
synced 2025-04-27 17:58:29 +08:00
opt task
This commit is contained in:
parent
a0ad9d3e13
commit
dc398e9044
@ -92,10 +92,12 @@ const (
|
|||||||
AUTO = "auto"
|
AUTO = "auto"
|
||||||
MAKE = "make"
|
MAKE = "make"
|
||||||
|
|
||||||
OPEN = "open"
|
BEGIN = "begin"
|
||||||
CLOSE = "close"
|
END = "end"
|
||||||
START = "start"
|
START = "start"
|
||||||
STOP = "stop"
|
STOP = "stop"
|
||||||
|
OPEN = "open"
|
||||||
|
CLOSE = "close"
|
||||||
|
|
||||||
RELOAD = "reload"
|
RELOAD = "reload"
|
||||||
RESTART = "restart"
|
RESTART = "restart"
|
||||||
|
@ -32,7 +32,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
for _, k := range strings.Split(arg[0], ",") {
|
for _, k := range strings.Split(arg[0], ",") {
|
||||||
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
||||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, value[kit.MDB_TYPE], arg[1], kit.Select("", arg, 2))
|
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, arg[0], arg[1], kit.Select("", arg, 2))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
@ -203,6 +203,9 @@ func _file_trash(m *ice.Message, name string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _file_search(m *ice.Message, kind, name, text string, arg ...string) {
|
func _file_search(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
|
if kind == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
rg, e := regexp.Compile("")
|
rg, e := regexp.Compile("")
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
@ -128,15 +128,17 @@ func _favor_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
if name != value[kit.MDB_NAME] && !strings.Contains(kit.Format(value[kit.MDB_TEXT]), name) {
|
if name != value[kit.MDB_NAME] && !strings.Contains(kit.Format(value[kit.MDB_TEXT]), name) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Push("pod", m.Option("pod"))
|
m.Push("pod", m.Option(ice.MSG_USERPOD))
|
||||||
m.Push("ctx", "web")
|
m.Push("ctx", m.Prefix())
|
||||||
m.Push("cmd", SPIDE)
|
m.Push("cmd", FAVOR)
|
||||||
m.Push(key, value, []string{kit.MDB_TIME}, val)
|
m.Push(key, value, []string{kit.MDB_TIME}, val)
|
||||||
m.Push(kit.MDB_SIZE, kit.FmtSize(int64(len(kit.Format(value[kit.MDB_TEXT])))))
|
m.Push(kit.MDB_SIZE, kit.FmtSize(int64(len(kit.Format(value[kit.MDB_TEXT])))))
|
||||||
m.Push(key, value, []string{kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}, val)
|
m.Push(key, value, []string{kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}, val)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
func _favor_render(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
|
}
|
||||||
|
|
||||||
func _favor_modify(m *ice.Message, zone, id, pro, set, old string) {
|
func _favor_modify(m *ice.Message, zone, id, pro, set, old string) {
|
||||||
m.Richs(FAVOR, nil, zone, func(key string, val map[string]interface{}) {
|
m.Richs(FAVOR, nil, zone, func(key string, val map[string]interface{}) {
|
||||||
@ -314,6 +316,9 @@ func init() {
|
|||||||
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_favor_search(m, arg[0], arg[1], arg[2], arg[3:]...)
|
_favor_search(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
}},
|
}},
|
||||||
|
mdb.RENDER: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_favor_render(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
|
}},
|
||||||
kit.MDB_SHARE: {Name: "share arg...", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
kit.MDB_SHARE: {Name: "share arg...", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_favor_share(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), arg...)
|
_favor_share(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), arg...)
|
||||||
}},
|
}},
|
||||||
|
@ -111,7 +111,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
C: {Name: C, Help: "c", Action: map[string]*ice.Action{
|
C: {Name: C, Help: "c", Action: map[string]*ice.Action{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Option(cli.CMD_DIR, m.Option("_path"))
|
m.Option(cli.CMD_DIR, m.Option("_path"))
|
||||||
_c_find(m, kit.Select("main", arg, 1))
|
_c_find(m, kit.Select("main", arg, 1))
|
||||||
m.Cmdy(mdb.SEARCH, "man2", arg[1:])
|
m.Cmdy(mdb.SEARCH, "man2", arg[1:])
|
||||||
@ -126,7 +129,10 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
MAN: {Name: MAN, Help: "man", Action: map[string]*ice.Action{
|
MAN: {Name: MAN, Help: "man", Action: map[string]*ice.Action{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
for _, k := range []string{"1", "2", "3", "8"} {
|
for _, k := range []string{"1", "2", "3", "8"} {
|
||||||
if text := _c_help(m, k, kit.Select("main", arg, 1)); text != "" {
|
if text := _c_help(m, k, kit.Select("main", arg, 1)); text != "" {
|
||||||
m.Push(kit.MDB_FILE, arg[1]+".man"+k)
|
m.Push(kit.MDB_FILE, arg[1]+".man"+k)
|
||||||
|
@ -120,7 +120,10 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
GO: {Name: GO, Help: "go", Action: map[string]*ice.Action{
|
GO: {Name: GO, Help: "go", Action: map[string]*ice.Action{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Option(cli.CMD_DIR, m.Option("_path"))
|
m.Option(cli.CMD_DIR, m.Option("_path"))
|
||||||
_go_find(m, kit.Select("main", arg, 1))
|
_go_find(m, kit.Select("main", arg, 1))
|
||||||
_go_tags(m, kit.Select("main", arg, 1))
|
_go_tags(m, kit.Select("main", arg, 1))
|
||||||
|
@ -61,7 +61,10 @@ func init() {
|
|||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
|
|
||||||
JS: {Name: JS, Help: "js", Action: map[string]*ice.Action{
|
JS: {Name: JS, Help: "js", Action: map[string]*ice.Action{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Option(cli.CMD_DIR, m.Option("_path"))
|
m.Option(cli.CMD_DIR, m.Option("_path"))
|
||||||
_js_find(m, kit.Select("main", arg, 1))
|
_js_find(m, kit.Select("main", arg, 1))
|
||||||
_js_grep(m, kit.Select("main", arg, 1))
|
_js_grep(m, kit.Select("main", arg, 1))
|
||||||
|
@ -21,7 +21,10 @@ func init() {
|
|||||||
m.Cmd(mdb.RENDER, mdb.CREATE, SH, SH, c.Cap(ice.CTX_FOLLOW))
|
m.Cmd(mdb.RENDER, mdb.CREATE, SH, SH, c.Cap(ice.CTX_FOLLOW))
|
||||||
}},
|
}},
|
||||||
SH: {Name: SH, Help: "sh", Action: map[string]*ice.Action{
|
SH: {Name: SH, Help: "sh", Action: map[string]*ice.Action{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == kit.MDB_FOREACH {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Option(cli.CMD_DIR, m.Option("_path"))
|
m.Option(cli.CMD_DIR, m.Option("_path"))
|
||||||
_c_find(m, kit.Select("main", arg, 1))
|
_c_find(m, kit.Select("main", arg, 1))
|
||||||
m.Cmdy(mdb.SEARCH, "man1", arg[1:])
|
m.Cmdy(mdb.SEARCH, "man1", arg[1:])
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package team
|
package team
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
|
"github.com/shylinux/icebergs/base/gdb"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
@ -25,7 +28,7 @@ const (
|
|||||||
BEGIN_TIME = "begin_time"
|
BEGIN_TIME = "begin_time"
|
||||||
CLOSE_TIME = "close_time"
|
CLOSE_TIME = "close_time"
|
||||||
|
|
||||||
EXPORT = "usr/export/web.team/task.csv"
|
EXPORT = "usr/export/web.team.task/list.csv"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
ScaleDay = "day"
|
ScaleDay = "day"
|
||||||
@ -42,11 +45,11 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func _task_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
func _task_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
||||||
|
fields := strings.Split(kit.Select("begin_time,zone,id,status,level,type,name,text", m.Option("fields")), ",")
|
||||||
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
||||||
if zone = kit.Format(kit.Value(val, "meta.zone")); id == "" {
|
if zone = kit.Format(kit.Value(val, "meta.zone")); id == "" {
|
||||||
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||||
m.Push(zone, value)
|
m.Push(zone, value, fields)
|
||||||
m.Push(ZONE, zone)
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -61,6 +64,55 @@ func _task_create(m *ice.Message, zone string) {
|
|||||||
m.Log_CREATE(ZONE, zone)
|
m.Log_CREATE(ZONE, zone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func _task_insert(m *ice.Message, zone, kind, name, text, begin_time, close_time string, arg ...string) {
|
||||||
|
m.Richs(TASK, nil, zone, func(key string, value map[string]interface{}) {
|
||||||
|
id := m.Grow(TASK, kit.Keys(kit.MDB_HASH, key), kit.Dict(
|
||||||
|
kit.MDB_TYPE, kind, kit.MDB_NAME, name, kit.MDB_TEXT, text,
|
||||||
|
BEGIN_TIME, begin_time, CLOSE_TIME, begin_time,
|
||||||
|
STATUS, StatusPrepare, LEVEL, 3, SCORE, 3,
|
||||||
|
kit.MDB_EXTRA, kit.Dict(arg),
|
||||||
|
))
|
||||||
|
m.Log_INSERT(ZONE, zone, kit.MDB_ID, id, kit.MDB_TYPE, kind, kit.MDB_NAME, name)
|
||||||
|
m.Echo("%d", id)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func _task_modify(m *ice.Message, zone, id, pro, set string) {
|
||||||
|
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
||||||
|
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), kit.MDB_ID, id, func(index int, value map[string]interface{}) {
|
||||||
|
switch pro {
|
||||||
|
case ZONE, kit.MDB_ID, kit.MDB_TIME:
|
||||||
|
m.Info("not allow %v", key)
|
||||||
|
case STATUS:
|
||||||
|
if value[STATUS] == set {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
switch value[STATUS] {
|
||||||
|
case StatusCancel, StatusFinish:
|
||||||
|
m.Info("not allow %v", key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch set {
|
||||||
|
case StatusProcess:
|
||||||
|
kit.Value(value, BEGIN_TIME, m.Time())
|
||||||
|
case StatusCancel, StatusFinish:
|
||||||
|
kit.Value(value, CLOSE_TIME, m.Time())
|
||||||
|
}
|
||||||
|
fallthrough
|
||||||
|
default:
|
||||||
|
m.Log_MODIFY(ZONE, zone, kit.MDB_ID, id, kit.MDB_KEY, pro, kit.MDB_VALUE, set)
|
||||||
|
kit.Value(value, pro, set)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
func _task_delete(m *ice.Message, zone, id string) {
|
||||||
|
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
||||||
|
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), kit.MDB_ID, id, func(index int, value map[string]interface{}) {
|
||||||
|
m.Log_DELETE(ZONE, zone, kit.MDB_ID, id)
|
||||||
|
kit.Value(value, STATUS, StatusCancel)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
func _task_export(m *ice.Message, file string) {
|
func _task_export(m *ice.Message, file string) {
|
||||||
f, p, e := kit.Create(file)
|
f, p, e := kit.Create(file)
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
@ -98,6 +150,7 @@ func _task_export(m *ice.Message, file string) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
m.Log_EXPORT("file", p, "count", count)
|
m.Log_EXPORT("file", p, "count", count)
|
||||||
|
m.Echo(p)
|
||||||
}
|
}
|
||||||
func _task_import(m *ice.Message, file string) {
|
func _task_import(m *ice.Message, file string) {
|
||||||
f, e := os.Open(file)
|
f, e := os.Open(file)
|
||||||
@ -136,57 +189,34 @@ func _task_import(m *ice.Message, file string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
m.Log_IMPORT("file", file, "count", count)
|
m.Log_IMPORT("file", file, "count", count)
|
||||||
|
m.Echo(file)
|
||||||
}
|
}
|
||||||
|
func _task_search(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
|
m.Richs(TASK, nil, kit.MDB_FOREACH, func(key string, val map[string]interface{}) {
|
||||||
|
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||||
|
if value[kit.MDB_NAME] == name || strings.Contains(kit.Format(value[kit.MDB_TEXT]), name) {
|
||||||
|
m.Push("pod", m.Option(ice.MSG_USERPOD))
|
||||||
|
m.Push("ctx", m.Prefix())
|
||||||
|
m.Push("cmd", TASK)
|
||||||
|
m.Push("time", value[kit.MDB_TIME])
|
||||||
|
m.Push("size", 1)
|
||||||
|
m.Push("type", TASK)
|
||||||
|
m.Push("name", value[kit.MDB_NAME])
|
||||||
|
m.Push("text", kit.Format("%s:%d", kit.Value(val, "meta.zone"), kit.Int(value[kit.MDB_ID])))
|
||||||
|
|
||||||
func _task_insert(m *ice.Message, zone, kind, name, text, begin_time, close_time string, arg ...string) {
|
|
||||||
m.Richs(TASK, nil, zone, func(key string, value map[string]interface{}) {
|
|
||||||
id := m.Grow(TASK, kit.Keys(kit.MDB_HASH, key), kit.Dict(
|
|
||||||
kit.MDB_TYPE, kind, kit.MDB_NAME, name, kit.MDB_TEXT, text,
|
|
||||||
BEGIN_TIME, begin_time, CLOSE_TIME, begin_time,
|
|
||||||
STATUS, StatusPrepare, LEVEL, 3, SCORE, 3,
|
|
||||||
kit.MDB_EXTRA, kit.Dict(arg),
|
|
||||||
))
|
|
||||||
m.Log_INSERT(ZONE, zone, kit.MDB_ID, id, kit.MDB_TYPE, kind, kit.MDB_NAME, name)
|
|
||||||
m.Echo("%d", id)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
func _task_modify(m *ice.Message, zone, id, pro, set, old string) {
|
|
||||||
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
|
||||||
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), kit.MDB_ID, id, func(index int, value map[string]interface{}) {
|
|
||||||
switch pro {
|
|
||||||
case ZONE, kit.MDB_ID, kit.MDB_TIME:
|
|
||||||
m.Info("not allow %v", key)
|
|
||||||
case STATUS:
|
|
||||||
if value[STATUS] == set {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
switch value[STATUS] {
|
|
||||||
case StatusCancel, StatusFinish:
|
|
||||||
m.Info("not allow %v", key)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch set {
|
|
||||||
case StatusProcess:
|
|
||||||
kit.Value(value, BEGIN_TIME, m.Time())
|
|
||||||
case StatusCancel, StatusFinish:
|
|
||||||
kit.Value(value, CLOSE_TIME, m.Time())
|
|
||||||
}
|
|
||||||
fallthrough
|
|
||||||
default:
|
|
||||||
m.Log_MODIFY(ZONE, zone, kit.MDB_ID, id, kit.MDB_KEY, pro, kit.MDB_VALUE, set, "old", old)
|
|
||||||
kit.Value(value, pro, set)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func _task_delete(m *ice.Message, zone, id string) {
|
func _task_render(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, zone), func(key string, val map[string]interface{}) {
|
ls := strings.Split(text, ":")
|
||||||
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), kit.MDB_ID, id, func(index int, value map[string]interface{}) {
|
m.Richs(TASK, nil, ls[0], func(key string, val map[string]interface{}) {
|
||||||
m.Log_DELETE(ZONE, zone, kit.MDB_ID, id)
|
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), "id", ls[1], func(index int, value map[string]interface{}) {
|
||||||
kit.Value(value, STATUS, StatusCancel)
|
m.Push("detail", value)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func _task_plugin(m *ice.Message, arg ...string) {
|
func _task_plugin(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
kit.Fetch(m.Confv(MISS, "meta.plug"), func(key string, value map[string]interface{}) {
|
kit.Fetch(m.Confv(MISS, "meta.plug"), func(key string, value map[string]interface{}) {
|
||||||
@ -198,9 +228,39 @@ func _task_plugin(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
m.Cmdy(kit.Keys(arg[0], arg[1]), arg[2:])
|
m.Cmdy(kit.Keys(arg[0], arg[1]), arg[2:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func _task_input(m *ice.Message, key, value string) {
|
func _task_input(m *ice.Message, key, value string) {
|
||||||
m.Cmdy(kit.Keys(m.Option("zone"), m.Option("type")), "action", "input", key, value)
|
m.Cmdy(kit.Keys(m.Option("zone"), m.Option("type")), "action", "input", key, value)
|
||||||
}
|
}
|
||||||
|
func _task_scope(m *ice.Message, arg ...string) (time.Time, time.Time) {
|
||||||
|
begin_time := time.Now()
|
||||||
|
if len(arg) > 1 {
|
||||||
|
begin_time, _ = time.ParseInLocation(ice.MOD_TIME, arg[1], time.Local)
|
||||||
|
}
|
||||||
|
end_time := begin_time
|
||||||
|
|
||||||
|
switch begin_time = begin_time.Add(-time.Duration(begin_time.UnixNano()) % (24 * time.Hour)); arg[0] {
|
||||||
|
case ScaleDay:
|
||||||
|
end_time = begin_time.AddDate(0, 0, 1)
|
||||||
|
case ScaleWeek:
|
||||||
|
begin_time = begin_time.AddDate(0, 0, -int(begin_time.Weekday()))
|
||||||
|
end_time = begin_time.AddDate(0, 0, 7)
|
||||||
|
case ScaleMonth:
|
||||||
|
begin_time = begin_time.AddDate(0, 0, -begin_time.Day()+1)
|
||||||
|
end_time = begin_time.AddDate(0, 1, 0)
|
||||||
|
case ScaleYear:
|
||||||
|
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1)
|
||||||
|
end_time = begin_time.AddDate(1, 0, 0)
|
||||||
|
case ScaleLong:
|
||||||
|
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1)
|
||||||
|
begin_time = begin_time.AddDate(-begin_time.Year()%5, 0, 0)
|
||||||
|
end_time = begin_time.AddDate(5, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
begin_time = begin_time.Add(-8 * time.Hour)
|
||||||
|
end_time = end_time.Add(-8 * time.Hour)
|
||||||
|
return begin_time, end_time
|
||||||
|
}
|
||||||
|
|
||||||
var Index = &ice.Context{Name: "team", Help: "团队中心",
|
var Index = &ice.Context{Name: "team", Help: "团队中心",
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
@ -216,9 +276,60 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
|
|||||||
m.Conf(MISS, kit.Keys("meta.plug", s.Name, key), cmd.Name)
|
m.Conf(MISS, kit.Keys("meta.plug", s.Name, key), cmd.Name)
|
||||||
})
|
})
|
||||||
m.Load()
|
m.Load()
|
||||||
|
|
||||||
|
m.Cmd(mdb.SEARCH, mdb.CREATE, TASK, TASK, m.Prefix())
|
||||||
|
m.Cmd(mdb.RENDER, mdb.CREATE, TASK, TASK, m.Prefix())
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save(TASK) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save(TASK) }},
|
||||||
|
|
||||||
|
TASK: {Name: "task zone=auto id=auto auto 添加:button 导出:button 导入:button", Help: "任务", Meta: kit.Dict(
|
||||||
|
mdb.INSERT, kit.List(
|
||||||
|
"_input", "text", "name", "zone",
|
||||||
|
"_input", "text", "name", "type",
|
||||||
|
"_input", "text", "name", "name",
|
||||||
|
"_input", "text", "name", "text",
|
||||||
|
"_input", "text", "name", "begin_time",
|
||||||
|
"_input", "text", "name", "close_time",
|
||||||
|
"_input", "text", "name", "cmds",
|
||||||
|
"_input", "text", "name", "args",
|
||||||
|
),
|
||||||
|
), Action: map[string]*ice.Action{
|
||||||
|
mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_create(m, arg[1])
|
||||||
|
_task_insert(m, arg[1], arg[3], arg[5], arg[7], arg[9], arg[11], arg[12:]...)
|
||||||
|
}},
|
||||||
|
mdb.MODIFY: {Name: "modify key value", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), arg[0], arg[1])
|
||||||
|
}},
|
||||||
|
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_delete(m, m.Option(ZONE), m.Option(kit.MDB_ID))
|
||||||
|
}},
|
||||||
|
mdb.EXPORT: {Name: "export file", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_export(m, kit.Select(EXPORT, arg, 0))
|
||||||
|
}},
|
||||||
|
mdb.IMPORT: {Name: "import file", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_import(m, kit.Select(EXPORT, arg, 0))
|
||||||
|
}},
|
||||||
|
|
||||||
|
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_search(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
|
}},
|
||||||
|
mdb.RENDER: {Name: "render type name text", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_render(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
|
}},
|
||||||
|
|
||||||
|
gdb.BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), STATUS, StatusProcess)
|
||||||
|
}},
|
||||||
|
gdb.END: {Name: "end", Help: "完成", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), STATUS, StatusFinish)
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
_task_list(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
|
||||||
|
if len(arg) < 2 {
|
||||||
|
m.PushAction("开始", "完成")
|
||||||
|
}
|
||||||
|
}},
|
||||||
PLAN: {Name: "plan scale:select=day|week|month|year|long begin_time=@date end_time=@date auto", Help: "计划", Meta: kit.Dict(
|
PLAN: {Name: "plan scale:select=day|week|month|year|long begin_time=@date end_time=@date auto", Help: "计划", Meta: kit.Dict(
|
||||||
"display", "/plugin/local/team/plan.js", "detail", []string{StatusPrepare, StatusProcess, StatusCancel, StatusFinish},
|
"display", "/plugin/local/team/plan.js", "detail", []string{StatusPrepare, StatusProcess, StatusCancel, StatusFinish},
|
||||||
), Action: map[string]*ice.Action{
|
), Action: map[string]*ice.Action{
|
||||||
@ -226,51 +337,26 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
|
|||||||
_task_create(m, arg[0])
|
_task_create(m, arg[0])
|
||||||
_task_insert(m, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5])
|
_task_insert(m, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5])
|
||||||
}},
|
}},
|
||||||
|
mdb.MODIFY: {Name: "modify key value", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), arg[0], arg[1])
|
||||||
|
}},
|
||||||
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_task_delete(m, m.Option(ZONE), m.Option(kit.MDB_ID))
|
_task_delete(m, m.Option(ZONE), m.Option(kit.MDB_ID))
|
||||||
}},
|
}},
|
||||||
mdb.MODIFY: {Name: "modify key value old", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), arg[0], arg[1], arg[2])
|
|
||||||
}},
|
|
||||||
mdb.IMPORT: {Name: "import file", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_task_import(m, kit.Select(EXPORT, arg, 0))
|
|
||||||
}},
|
|
||||||
mdb.EXPORT: {Name: "export file", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
|
mdb.EXPORT: {Name: "export file", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_task_export(m, kit.Select(EXPORT, arg, 0))
|
_task_export(m, kit.Select(EXPORT, arg, 0))
|
||||||
}},
|
}},
|
||||||
"plugin": {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
mdb.IMPORT: {Name: "import file", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_task_import(m, kit.Select(EXPORT, arg, 0))
|
||||||
|
}},
|
||||||
|
mdb.PLUGIN: {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_task_plugin(m, arg...)
|
_task_plugin(m, arg...)
|
||||||
}},
|
}},
|
||||||
"input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
"input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_task_input(m, arg[0], arg[1])
|
_task_input(m, arg[0], arg[1])
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
begin_time := time.Now()
|
begin_time, end_time := _task_scope(m, arg...)
|
||||||
if len(arg) > 1 {
|
|
||||||
begin_time, _ = time.ParseInLocation(ice.MOD_TIME, arg[1], time.Local)
|
|
||||||
}
|
|
||||||
end_time := begin_time
|
|
||||||
|
|
||||||
switch begin_time = begin_time.Add(-time.Duration(begin_time.UnixNano()) % (24 * time.Hour)); arg[0] {
|
|
||||||
case ScaleDay:
|
|
||||||
end_time = begin_time.AddDate(0, 0, 1)
|
|
||||||
case ScaleWeek:
|
|
||||||
begin_time = begin_time.AddDate(0, 0, -int(begin_time.Weekday()))
|
|
||||||
end_time = begin_time.AddDate(0, 0, 7)
|
|
||||||
case ScaleMonth:
|
|
||||||
begin_time = begin_time.AddDate(0, 0, -begin_time.Day()+1)
|
|
||||||
end_time = begin_time.AddDate(0, 1, 0)
|
|
||||||
case ScaleYear:
|
|
||||||
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1)
|
|
||||||
end_time = begin_time.AddDate(1, 0, 0)
|
|
||||||
case ScaleLong:
|
|
||||||
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1)
|
|
||||||
begin_time = begin_time.AddDate(-begin_time.Year()%5, 0, 0)
|
|
||||||
end_time = begin_time.AddDate(5, 0, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
begin_time = begin_time.Add(-8 * time.Hour)
|
|
||||||
end_time = end_time.Add(-8 * time.Hour)
|
|
||||||
m.Logs("info", "begin", begin_time, "end", end_time)
|
m.Logs("info", "begin", begin_time, "end", end_time)
|
||||||
|
|
||||||
m.Set(ice.MSG_OPTION, "end_time")
|
m.Set(ice.MSG_OPTION, "end_time")
|
||||||
@ -286,31 +372,6 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
TASK: {Name: "task zone=auto id=auto auto", Help: "任务", Action: map[string]*ice.Action{
|
|
||||||
mdb.DELETE: {Name: "delete", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_task_delete(m, m.Option(ZONE), m.Option(kit.MDB_ID))
|
|
||||||
}},
|
|
||||||
mdb.MODIFY: {Name: "modify key value old", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_task_modify(m, m.Option(ZONE), m.Option(kit.MDB_ID), arg[0], arg[1], arg[2])
|
|
||||||
}},
|
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
if len(arg) < 3 {
|
|
||||||
_task_list(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(arg) == 5 {
|
|
||||||
arg = append(arg, m.Time())
|
|
||||||
}
|
|
||||||
if len(arg) == 6 {
|
|
||||||
arg = append(arg, m.Time("1h"))
|
|
||||||
}
|
|
||||||
|
|
||||||
_task_create(m, arg[0])
|
|
||||||
_task_insert(m, arg[0], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7:]...)
|
|
||||||
}},
|
|
||||||
MISS: {Name: "miss", Help: "miss", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
}},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,12 +10,8 @@ image qrcode `https://weixin.qq.com`
|
|||||||
|
|
||||||
|
|
||||||
chapter "应用"
|
chapter "应用"
|
||||||
field "miss" web.chat.meet.miss args `[ ]`
|
field "task" web.team.task args `[ ]`
|
||||||
field "date" web.chat.meet.date args `[ ]`
|
field "plan" web.team.plan args `[ ]`
|
||||||
field "feel" web.wiki.feel args `[ usr/export/web.chat.meet.miss/feel/ ]`
|
|
||||||
|
|
||||||
field "user" user
|
|
||||||
field "sess" sess
|
|
||||||
|
|
||||||
chapter "项目"
|
chapter "项目"
|
||||||
section "icebergs"
|
section "icebergs"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user