diff --git a/base/mdb/hash.go b/base/mdb/hash.go index 0a1edcae..5a8aad45 100644 --- a/base/mdb/hash.go +++ b/base/mdb/hash.go @@ -137,7 +137,7 @@ func _hash_export(m *ice.Message, prefix, chain, file string) { m.Logs(EXPORT, KEY, path.Join(prefix, chain), FILE, p) m.Conf(prefix, kit.Keys(chain, HASH), "") - m.Echo(p) + m.Echo(p).StatusTime(LINK, "/share/local/"+p) } func _hash_import(m *ice.Message, prefix, chain, file string) { defer Lock(m, prefix, chain)() diff --git a/base/mdb/zone.go b/base/mdb/zone.go index 901e70bc..2ca40b6a 100644 --- a/base/mdb/zone.go +++ b/base/mdb/zone.go @@ -96,7 +96,7 @@ func _zone_export(m *ice.Message, prefix, chain, file string) { m.Logs(EXPORT, KEY, path.Join(prefix, chain), FILE, p, COUNT, count) m.Conf(prefix, kit.Keys(chain, HASH), "") - m.Echo(p) + m.Echo(p).StatusTime(LINK, "/share/local/"+p) } func _zone_import(m *ice.Message, prefix, chain, file string) { f, e := miss.OpenFile(kit.Keys(file, CSV)) @@ -226,11 +226,9 @@ func ZoneSelect(m *ice.Message, arg ...string) *ice.Message { return m } func ZoneExport(m *ice.Message, arg ...Any) { - m.Debug("what %v", m.OptionFields()) if m.OptionFields() == "" { - m.OptionFields(m.Config(SHORT), m.Config(FIELD)) + m.OptionFields(m.Config(SHORT), m.Config(FIELD)) } - m.Debug("what %v", m.OptionFields()) m.Cmdy(EXPORT, m.PrefixKey(), "", ZONE, arg) } func ZoneImport(m *ice.Message, arg ...Any) { diff --git a/base/web/serve.go b/base/web/serve.go index 2aebfc1d..2d48ac25 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -254,7 +254,6 @@ func _serve_handle(key string, cmd *ice.Command, msg *ice.Message, w http.Respon if sessid := msg.Option(CookieName(msg.Option(ice.MSG_USERWEB))); msg.Option(ice.MSG_SESSID) == "" { msg.Option(ice.MSG_SESSID, sessid) } - msg.Debug("what %v", msg.FormatMeta()) // 解析命令 if msg.Optionv(ice.MSG_CMDS) == nil { diff --git a/core/code/vimer.go b/core/code/vimer.go index 5631b4ee..3f00263f 100644 --- a/core/code/vimer.go +++ b/core/code/vimer.go @@ -85,7 +85,7 @@ func init() { m.Push(nfs.PATH, "_open:"+strings.ToLower(value[mdb.NAME])) }) case nfs.PATH: - m.Cmdy(nfs.DIR, arg[1:]) + m.Cmdy(nfs.DIR, arg[1:]).Cut("path,size,time") m.ProcessAgain() default: } @@ -95,8 +95,8 @@ func init() { if m.Option(nfs.CONTENT) == "" { m.Option(nfs.CONTENT, m.Cmdx("", TEMPLATE)) } - m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE))) - if m.Option(nfs.FILE) == "proto.js" { + switch m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE))); m.Option(nfs.FILE) { + case "proto.js", "page/index.css": m.Cmd("", DEVPACK) } }}, diff --git a/core/team/epic.go b/core/team/epic.go index 64be4227..e8461015 100644 --- a/core/team/epic.go +++ b/core/team/epic.go @@ -15,7 +15,7 @@ const EPIC = "epic" func init() { Index.MergeCommands(ice.Commands{ EPIC: {Name: "epic hash list", Help: "史记", Actions: ice.MergeActions(ice.Actions{ - mdb.CREATE: {Name: "create time@date zone name"}, mdb.MODIFY: {Name: "modify time@date zone name"}, + mdb.CREATE: {Name: "create time zone name"}, mdb.MODIFY: {Name: "modify time zone name"}, }, mdb.HashAction(mdb.FIELD, "time,hash,zone,name")), Hand: func(m *ice.Message, arg ...string) { if mdb.HashSelect(m, arg...).Tables(func(value ice.Maps) { if span := kit.Time(m.Time()) - kit.Time(value[mdb.TIME]); span > 0 { diff --git a/core/team/plan.go b/core/team/plan.go index dc117a25..541508dc 100644 --- a/core/team/plan.go +++ b/core/team/plan.go @@ -4,22 +4,15 @@ import ( "time" ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/web" - "shylinux.com/x/icebergs/base/aaa" kit "shylinux.com/x/toolkits" ) -func _plan_scope(m *ice.Message, tz int, arg ...string) (begin_time, end_time time.Time) { - if begin_time = time.Now(); len(arg) > 1 { - begin_time, _ = time.ParseInLocation(ice.MOD_TIME, arg[1], time.Local) - } - begin_time = begin_time.Add(time.Duration(tz) * time.Hour) - begin_time = begin_time.Add(-time.Duration(begin_time.UnixNano()) % (24 * time.Hour)) - begin_time = begin_time.Add(-time.Duration(tz) * time.Hour) - - switch end_time = begin_time; kit.Select(WEEK, arg, 0) { +func _plan_scope(m *ice.Message, arg ...string) (begin_time, end_time time.Time) { + switch begin_time = kit.DayBegin(kit.Select(m.Time(), arg, 1)); kit.Select(WEEK, arg, 0) { case DAY: end_time = begin_time.AddDate(0, 0, 1) case WEEK: @@ -32,17 +25,17 @@ func _plan_scope(m *ice.Message, tz int, arg ...string) (begin_time, end_time ti begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1) end_time = begin_time.AddDate(1, 0, 0) case LONG: - begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1) - begin_time = begin_time.AddDate(-30, 0, 0) - end_time = begin_time.AddDate(60, 0, 0) + begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1).AddDate(-5, 0, 0) + end_time = begin_time.AddDate(10, 0, 0) } + m.Logs(mdb.SELECT, "begin_time", begin_time.Format(ice.MOD_TIME), "end_time", end_time.Format(ice.MOD_TIME)) return begin_time, end_time } -func _plan_list(m *ice.Message, begin_time, end_time time.Time) { +func _plan_list(m *ice.Message, begin_time, end_time string) { m.Option(mdb.CACHE_LIMIT, "-1") m.OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra") m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, mdb.FOREACH, func(key string, fields []string, value, val ice.Map) { - if begin, _ := time.ParseInLocation(ice.MOD_TIME, kit.Format(value[BEGIN_TIME]), time.Local); begin.After(begin_time) && end_time.After(begin) { + if begin_time <= kit.Format(value[BEGIN_TIME]) && kit.Format(value[BEGIN_TIME]) < end_time { m.Push(key, value, fields, val).PushButton(_task_action(m, value[STATUS], mdb.PLUGIN)) } }) @@ -55,6 +48,9 @@ const ( YEAR = "year" LONG = "long" ) +const ( + TASK_POD = "task.pod" +) const PLAN = "plan" @@ -62,10 +58,9 @@ func init() { Index.MergeCommands(ice.Commands{ PLAN: {Name: "plan scale=week,day,week,month,year,long begin_time@date list", Help: "计划", Actions: ice.MergeActions(ice.Actions{ mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }}, - mdb.PLUGIN: {Name: "plugin extra.index extra.args", Help: "插件", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }}, + mdb.PLUGIN: {Name: "plugin extra.index extra.args", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }}, ice.RUN: {Hand: func(m *ice.Message, arg ...string) { - m.Option(ice.POD, m.Option("task.pod")) - if m.Option("task.pod", ""); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) { + if m.RenameOption(TASK_POD, ice.POD); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) { return } if cmd := m.CmdAppend(TASK, kit.Slice(arg, 0, 2), ctx.INDEX); cmd != "" { @@ -75,8 +70,8 @@ func init() { } }}, }, TASK, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) { - begin_time, end_time := _plan_scope(m, 8, kit.Slice(arg, 0, 2)...) - _plan_list(m, begin_time, end_time) + begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...) + _plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME)) web.PushPodCmd(m, "", arg...) ctx.Toolkit(m, TODO, TASK, EPIC) ctx.DisplayLocal(m, "") diff --git a/core/team/task.go b/core/team/task.go index 72225b3e..80476c30 100644 --- a/core/team/task.go +++ b/core/team/task.go @@ -74,9 +74,9 @@ func init() { mdb.ZoneInsert(m, arg[:2], BEGIN_TIME, m.Time(), STATUS, PREPARE, LEVEL, 3, SCORE, 3, arg[2:]) }}, mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, arg[0], arg[1], arg[2:]...) }}, - CANCEL: {Name: "cancal", Help: "取消", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }}, - BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }}, - END: {Name: "end", Help: "完成", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }}, + CANCEL: {Name: "cancal", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }}, + BEGIN: {Name: "begin", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }}, + END: {Name: "end", Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }}, }, mdb.ZoneAction(mdb.FIELD, "begin_time,close_time,id,status,level,score,type,name,text")), Hand: func(m *ice.Message, arg ...string) { if mdb.ZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" { status := map[string]int{} diff --git a/misc.go b/misc.go index 83201826..1dedfc5a 100644 --- a/misc.go +++ b/misc.go @@ -84,6 +84,11 @@ func (m *Message) ToLowerAppend(arg ...string) *Message { } return m } +func (m *Message) RenameOption(from, to string) *Message { + m.Option(to, m.Option(from)) + m.Option(from, "") + return m +} func (m *Message) RenameAppend(arg ...string) *Message { // [from to]... for i := 0; i < len(arg)-1; i += 2 { if arg[i] == arg[i+1] { @@ -414,6 +419,10 @@ func SplitCmd(name string, actions Actions) (list []Any) { item = kit.Dict(TYPE, TEXT, NAME, ls[i], ACTION, "img") list = append(list, item) + case "time": + item = kit.Dict(TYPE, TEXT, NAME, ls[i], ACTION, "date") + list = append(list, item) + case "*": item["need"] = "must" case DF: