From 48c28788855b32c1d5f21608dd1b26a4e2496977 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 4 Jan 2018 11:59:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E9=85=8D=E7=BD=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 149 ++++++++++++------------ g/frame/gcfg/gcfg.go | 6 +- geg/frame/mvc/controller/demo/config.go | 9 ++ 3 files changed, 90 insertions(+), 74 deletions(-) create mode 100644 geg/frame/mvc/controller/demo/config.go diff --git a/README.MD b/README.MD index dceca6c62..0c02af84c 100644 --- a/README.MD +++ b/README.MD @@ -117,85 +117,88 @@ gf框架基于模块化设计,实现了通用的HTTP/TCP/UDP Server,并实 - - - - - - - - - - - - +} +``` + diff --git a/g/frame/gcfg/gcfg.go b/g/frame/gcfg/gcfg.go index ba8d82671..01a3891a7 100644 --- a/g/frame/gcfg/gcfg.go +++ b/g/frame/gcfg/gcfg.go @@ -12,6 +12,7 @@ import ( "gitee.com/johng/gf/g/container/gmap" "gitee.com/johng/gf/g/encoding/gjson" "sync" + "strings" ) const ( @@ -48,7 +49,10 @@ func (c *Config) filePath(files []string) string { // 设置配置管理器的配置文件存放目录绝对路径 func (c *Config) SetPath(path string) { c.mu.Lock() - c.path = path + if strings.Compare(c.path, path) != 0 { + c.path = path + c.jsons = gmap.NewStringInterfaceMap() + } c.mu.Unlock() } diff --git a/geg/frame/mvc/controller/demo/config.go b/geg/frame/mvc/controller/demo/config.go new file mode 100644 index 000000000..078d49dd8 --- /dev/null +++ b/geg/frame/mvc/controller/demo/config.go @@ -0,0 +1,9 @@ +package demo + +import "gitee.com/johng/gf/g/net/ghttp" + +func init() { + ghttp.GetServer().BindHandler("/config", func (r *ghttp.Request) { + r.Response.WriteString("Apple") + }) +}