From 0c069d3e972a40c641231f724ebb247ef996001d Mon Sep 17 00:00:00 2001 From: shaoying Date: Mon, 16 Apr 2018 21:57:18 +0800 Subject: [PATCH] =?UTF-8?q?tce=20mod=20web.list=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E9=A1=BA=E5=BA=8F=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contexts/web/web.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/contexts/web/web.go b/src/contexts/web/web.go index 936cf16c..d2b6f856 100644 --- a/src/contexts/web/web.go +++ b/src/contexts/web/web.go @@ -32,7 +32,8 @@ type WEB struct { *http.ServeMux *http.Server - list map[string]string + list map[string]string + list_key []string *ctx.Message *ctx.Context @@ -391,8 +392,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", switch len(arg) { case 0: - for k, v := range web.list { - m.Echo("%s: %s\n", k, v) + for _, k := range web.list_key { + if v, ok := web.list[k]; ok { + m.Echo("%s: %s\n", k, v) + } } case 1: msg := m.Spawn(m.Target()).Cmd("get", web.list[arg[0]]) @@ -402,6 +405,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心", case "add": m.Capi("count", 1) web.list[m.Cap("count")] = arg[1] + web.list_key = append(web.list_key, m.Cap("count")) case "del": delete(web.list, arg[1]) default: