Skip to content

Commit 0b96d1c

Browse files
authored
Merge pull request glennliao#18 from glennliao/dev
## 0.2.0-beta2
2 parents c11c6b3 + e8d753e commit 0b96d1c

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

drivers/framework_goframe/gf.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ func (gf *GF) Bind(group *ghttp.RouterGroup, mode ...Mode) {
4545
if len(mode) == 0 {
4646
mode = []Mode{InDataMode}
4747
}
48-
group.POST("/get", gf.commonResponse(gf.Get, mode[0]))
49-
group.POST("/post", gf.commonResponse(gf.Post, mode[0]))
50-
group.POST("/head", gf.commonResponse(gf.Head, mode[0]))
51-
group.POST("/put", gf.commonResponse(gf.Put, mode[0]))
52-
group.POST("/delete", gf.commonResponse(gf.Delete, mode[0]))
48+
group.POST("/get", gf.CommonResponse(gf.Get, mode[0]))
49+
group.POST("/post", gf.CommonResponse(gf.Post, mode[0]))
50+
group.POST("/head", gf.CommonResponse(gf.Head, mode[0]))
51+
group.POST("/put", gf.CommonResponse(gf.Put, mode[0]))
52+
group.POST("/delete", gf.CommonResponse(gf.Delete, mode[0]))
5353
}
5454

5555
func (gf *GF) Get(ctx context.Context, req model.Map) (res model.Map, err error) {
@@ -76,7 +76,7 @@ func (gf *GF) Delete(ctx context.Context, req model.Map) (res model.Map, err err
7676
return act.Result()
7777
}
7878

79-
func (gf *GF) commonResponse(handler func(ctx context.Context, req model.Map) (res model.Map, err error), mode Mode) func(req *ghttp.Request) {
79+
func (gf *GF) CommonResponse(handler func(ctx context.Context, req model.Map) (res model.Map, err error), mode Mode) func(req *ghttp.Request) {
8080
return func(req *ghttp.Request) {
8181
metaRes := &gmap.ListMap{}
8282
code := 200

query/node_query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (q *queryNode) parse() {
9494
return
9595
}
9696

97-
n.primaryTableKey = n.Key
97+
n.primaryTableKey = filepath.Base(n.Path)
9898

9999
if len(refKeyMap) > 0 { // 需要引用别处
100100
n.refKeyMap = make(map[string]NodeRef)

query/node_struct.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/glennliao/apijson-go/consts"
55
"github.com/glennliao/apijson-go/model"
66
"github.com/gogf/gf/v2/errors/gerror"
7+
"path/filepath"
78
"strings"
89
)
910

@@ -18,6 +19,10 @@ func newStructNode(n *Node) *structNode {
1819
func (h *structNode) parse() {
1920
n := h.node
2021

22+
for _, childNode := range n.children {
23+
childNode.parse()
24+
}
25+
2126
if n.isList { // []节点
2227

2328
hasPrimary := false // 是否存在主查询表
@@ -35,7 +40,7 @@ func (h *structNode) parse() {
3540
}
3641

3742
hasPrimary = true
38-
n.primaryTableKey = child.Key
43+
n.primaryTableKey = filepath.Base(child.Key)
3944
child.page = n.page
4045

4146
}
@@ -46,9 +51,6 @@ func (h *structNode) parse() {
4651
}
4752
}
4853

49-
for _, childNode := range n.children {
50-
childNode.parse()
51-
}
5254
}
5355

5456
func (h *structNode) fetch() {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy