1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-07 17:45:11 +08:00
parent df88fbf2b8
commit dc9dd86bba
5 changed files with 17 additions and 16 deletions

View File

@ -40,7 +40,7 @@ func DisplayStoryForm(m *ice.Message, arg ...ice.Any) *ice.Message {
} }
} }
} }
kit.For(args, func(v string) { m.Push("", v, kit.Split("type,name,value,values,need,action")) }) kit.For(args, func(v ice.Map) { m.Push("", v, kit.Split("type,name,value,values,need,action")) })
return DisplayStory(m, "form") return DisplayStory(m, "form")
} }
func DisplayStoryJSON(m *ice.Message, arg ...ice.Any) *ice.Message { func DisplayStoryJSON(m *ice.Message, arg ...ice.Any) *ice.Message {

View File

@ -44,7 +44,8 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
if file == "" { if file == "" {
return return
} }
bio := m.Confv(FILE, kit.Keys(file, FILE)).(*bufio.Writer) conf := m.Confv(FILE, file)
bio := kit.Value(conf, FILE).(*bufio.Writer)
if bio == nil { if bio == nil {
return return
} }
@ -59,10 +60,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
} }
} }
} }
func (f *Frame) Close(m *ice.Message, arg ...string) { func (f *Frame) Close(m *ice.Message, arg ...string) { ice.Info.Log = nil; close(f.p) }
ice.Info.Log = nil
close(f.p)
}
const ( const (
PREFIX = "prefix" PREFIX = "prefix"
@ -112,10 +110,7 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
func init() { ice.Index.Register(Index, &Frame{}, TAIL) } func init() { ice.Index.Register(Index, &Frame{}, TAIL) }
func init() { func init() { ice.Info.Traceid = "short"; ice.Pulse.Option(ice.LOG_TRACEID, Traceid()) }
ice.Info.Traceid = "short"
ice.Pulse.Option(ice.LOG_TRACEID, Traceid())
}
var _trace_count int64 var _trace_count int64
@ -133,8 +128,6 @@ func Traceid() (traceid string) {
ls = ls[:0] ls = ls[:0]
} }
}) })
kit.If(len(ls) > 0, func() { kit.If(len(ls) > 0, func() { ls = append(ls, kit.Format(atomic.AddInt64(&_trace_count, 1))) })
ls = append(ls, kit.Format(atomic.AddInt64(&_trace_count, 1)))
})
return strings.Join(ls, "-") return strings.Join(ls, "-")
} }

View File

@ -285,12 +285,16 @@ func init() {
if p := path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) { if p := path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) {
return p + kit.Select("", nfs.PS, len(arg) == 0) return p + kit.Select("", nfs.PS, len(arg) == 0)
} else { } else {
return m.FileURI(path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...))) m.Debug("what %v", p)
what := kit.MergeURL2(UserHost(m)+ctx.GetCmdFile(m, m.PrefixKey()), path.Join(arg...))
m.Debug("what %v", what)
return what
// return path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)) + kit.Select("", nfs.PS, len(arg) == 0) // return path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)) + kit.Select("", nfs.PS, len(arg) == 0)
} }
} }
nfs.TemplateText = func(m *ice.Message, p string) string { nfs.TemplateText = func(m *ice.Message, p string) string {
if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, "/require/", ice.HTTP) { if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, "/require/", ice.HTTP) {
m.Debug("what %v", p)
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p) return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p)
} else { } else {
return m.Cmdx(nfs.CAT, p) return m.Cmdx(nfs.CAT, p)

View File

@ -318,9 +318,13 @@ func (m *Message) FileURI(dir string) string {
} else if kit.HasPrefix(dir, PS, HTTP) { } else if kit.HasPrefix(dir, PS, HTTP) {
return dir return dir
} }
m.Debug("what %v", m.Option(MSG_USERPOD))
if strings.HasPrefix(dir, USR_VOLCANOS) { if strings.HasPrefix(dir, USR_VOLCANOS) {
return strings.TrimPrefix(dir, USR) return strings.TrimPrefix(dir, USR)
} else { } else {
return kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD)) m.Debug("what %v", m.Option(MSG_USERPOD))
what := kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
m.Debug("what %v", what)
return what
} }
} }

View File

@ -248,7 +248,7 @@ func (m *Message) EchoDownload(arg ...string) *Message {
} }
func (m *Message) Display(file string, arg ...Any) *Message { func (m *Message) Display(file string, arg ...Any) *Message {
file = m.resource(file) file = m.resource(file)
m.Option(MSG_DISPLAY, m.MergeLink(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...)) m.Option(MSG_DISPLAY, kit.MergeURL(kit.ExtChange(file, JS), arg...))
return m return m
} }
func (m *Message) Resource(file string) string { return m.resource(file) } func (m *Message) Resource(file string) string { return m.resource(file) }