fix 代码生成-api导入gtime问题、无需登录验证权限
This commit is contained in:
parent
faa6fb448d
commit
1b72fce248
@ -96,6 +96,14 @@ func (s *sMiddleware) Auth(r *ghttp.Request) {
|
|||||||
}
|
}
|
||||||
//只验证存在数据库中的规则
|
//只验证存在数据库中的规则
|
||||||
if menu != nil {
|
if menu != nil {
|
||||||
|
//若是不登录能访问的接口则不判断权限
|
||||||
|
excludePaths := g.Cfg().MustGet(ctx, "gfToken.excludePaths").Strings()
|
||||||
|
for _, p := range excludePaths {
|
||||||
|
if gstr.Equal(menu.Name, gstr.TrimLeft(p, "/")) {
|
||||||
|
r.Middleware.Next()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
//若存在不需要验证的条件则跳过
|
//若存在不需要验证的条件则跳过
|
||||||
if gstr.Equal(menu.Condition, "nocheck") {
|
if gstr.Equal(menu.Condition, "nocheck") {
|
||||||
r.Middleware.Next()
|
r.Middleware.Next()
|
||||||
|
@ -11,6 +11,7 @@ package {{.table.ModuleName }}
|
|||||||
////
|
////
|
||||||
{{$hasUpFile:=false}}
|
{{$hasUpFile:=false}}
|
||||||
{{$hasArr:=false}}
|
{{$hasArr:=false}}
|
||||||
|
{{$hasGtime:=false}}
|
||||||
{{range $index,$column :=.table.Columns}}
|
{{range $index,$column :=.table.Columns}}
|
||||||
{{if eq $column.HtmlType "imagefile" "images" "file" "files" }}
|
{{if eq $column.HtmlType "imagefile" "images" "file" "files" }}
|
||||||
{{$hasUpFile = true}}
|
{{$hasUpFile = true}}
|
||||||
@ -19,13 +20,17 @@ package {{.table.ModuleName }}
|
|||||||
{{$hasArr = true}}
|
{{$hasArr = true}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{range $index,$column :=.table.EditColumns}}
|
||||||
|
{{if eq $column.GoType "Time"}}
|
||||||
|
{{$hasGtime = true}}
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
import (
|
import (
|
||||||
{{if $hasArr}}
|
{{if $hasArr}}
|
||||||
"github.com/gogf/gf/v2/container/garray"
|
"github.com/gogf/gf/v2/container/garray"
|
||||||
{{end}}
|
{{end}}
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
"github.com/gogf/gf/v2/frame/g"
|
||||||
{{if .table.HasTimeColumn}}
|
{{if and .table.HasTimeColumn $hasGtime}}
|
||||||
"github.com/gogf/gf/v2/os/gtime"
|
"github.com/gogf/gf/v2/os/gtime"
|
||||||
{{end}}
|
{{end}}
|
||||||
commonApi "{{.goModName}}/api/v1/common"
|
commonApi "{{.goModName}}/api/v1/common"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user