From ef5909898950fad9645d2f9339a99c89f48b41af Mon Sep 17 00:00:00 2001 From: John Date: Mon, 18 Dec 2017 11:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E7=AE=A1=E7=90=86=E5=B7=A5=E5=85=B7genv=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E5=96=84gmvc=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 2 +- README.MD | 2 +- g/encoding/gjson/json.go | 9 +++++++++ g/frame/gbase/gbase.go | 6 +----- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/LICENSE b/LICENSE index 74c8b0933..f9919b67b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 john@johng.cn +Copyright (c) 2017 john@johng.cn http://johng.cn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.MD b/README.MD index 57eb5f70a..3dfa4b61d 100644 --- a/README.MD +++ b/README.MD @@ -7,7 +7,7 @@ go get -u gitee.com/johng/gf ## 使用 ```go -import "gitee.com/johng/gf/g/xxx" +import "gitee.com/johng/gf/g/xxx/xxx" ``` ## 说明 diff --git a/g/encoding/gjson/json.go b/g/encoding/gjson/json.go index 9ef2c0090..dcb7d69fb 100644 --- a/g/encoding/gjson/json.go +++ b/g/encoding/gjson/json.go @@ -103,6 +103,15 @@ func (p *Json) GetMap(pattern string) map[string]interface{} { return nil } +// 将检索值转换为Json对象指针返回 +func (p *Json) GetJson(pattern string) *Json { + result := p.Get(pattern) + if result != nil { + return &Json{&result} + } + return nil +} + // 获得一个数组[]interface{},方便操作,不需要自己做类型转换 // 注意,如果获取的值不存在,或者类型与json类型不匹配,那么将会返回nil func (p *Json) GetArray(pattern string) []interface{} { diff --git a/g/frame/gbase/gbase.go b/g/frame/gbase/gbase.go index 3445aed1e..d468abc99 100644 --- a/g/frame/gbase/gbase.go +++ b/g/frame/gbase/gbase.go @@ -3,14 +3,10 @@ package gbase import ( "gitee.com/johng/gf/g/os/gfile" + "gitee.com/johng/gf/g/os/gconsole" "gitee.com/johng/gf/g/database/gdb" "gitee.com/johng/gf/g/frame/gconfig" "gitee.com/johng/gf/g/frame/ginstance" - "gitee.com/johng/gf/g/os/gconsole" -) - -const ( - gDEFAULT_CONFIG_FILE = "config.json" // 默认读取的配置文件名称 ) // 框架基类,所有的基于gf框架的类对象都继承于此,以便使用框架的一些封装的核心组件