diff --git a/base/web/web.go b/base/web/web.go index da89e59a..1fbdbca6 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -760,11 +760,21 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", } }) }}, - ice.WEB_SERVE: {Name: "serve", Help: "服务器", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - // 启动服务 + ice.WEB_SERVE: {Name: "serve [random] [ups...]", Help: "服务器", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Conf(ice.CLI_RUNTIME, "node.name", m.Conf(ice.CLI_RUNTIME, "boot.hostname")) m.Conf(ice.CLI_RUNTIME, "node.type", ice.WEB_SERVER) + + if len(arg) > 0 && arg[0] == "random" { + // 随机端口 + m.Conf(ice.CLI_RUNTIME, "node.name", m.Conf(ice.CLI_RUNTIME, "boot.pathname")) + m.Cmd(ice.WEB_SPIDE, "add", "self", "http://random") + arg = arg[1:] + } + + // 启动服务 m.Target().Start(m, "self") + m.Sleep("1s") + // 连接服务 m.Cmd(ice.WEB_SPACE, "connect", "self") for _, k := range arg { @@ -780,7 +790,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", // 空间列表 m.Richs(ice.WEB_SPACE, nil, "*", func(key string, value map[string]interface{}) { m.Push(key, value, []string{"time", "type", "name", "text"}) - if m.W != nil { + if m.Option(ice.MSG_USERUA) != "" { m.Push("link", fmt.Sprintf(`%s`, m.Conf(ice.WEB_SHARE, "meta.domain"), value["name"], value["name"])) } }) diff --git a/core/code/code.go b/core/code/code.go index 347873a6..e87bf6aa 100644 --- a/core/code/code.go +++ b/core/code/code.go @@ -198,6 +198,9 @@ var Index = &ice.Context{Name: "code", Help: "编程中心", } }}, + "test": {Name: "test src", Help: "功能测试", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Cmdy(ice.CLI_SYSTEM, "go", "test", kit.Select("./", arg, 0)) + }}, "pprof": {Name: "pprof run name time", Help: "性能分析", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if m.Show(cmd, arg...) { return