fix 代码生成-api导入gtime问题、无需登录验证权限

This commit is contained in:
yxh 2023-02-03 22:08:41 +08:00
parent faa6fb448d
commit 1b72fce248
2 changed files with 15 additions and 2 deletions

View File

@ -96,6 +96,14 @@ func (s *sMiddleware) Auth(r *ghttp.Request) {
}
//只验证存在数据库中的规则
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") {
r.Middleware.Next()

View File

@ -11,6 +11,7 @@ package {{.table.ModuleName }}
////
{{$hasUpFile:=false}}
{{$hasArr:=false}}
{{$hasGtime:=false}}
{{range $index,$column :=.table.Columns}}
{{if eq $column.HtmlType "imagefile" "images" "file" "files" }}
{{$hasUpFile = true}}
@ -19,13 +20,17 @@ package {{.table.ModuleName }}
{{$hasArr = true}}
{{end}}
{{end}}
{{range $index,$column :=.table.EditColumns}}
{{if eq $column.GoType "Time"}}
{{$hasGtime = true}}
{{end}}
{{end}}
import (
{{if $hasArr}}
"github.com/gogf/gf/v2/container/garray"
{{end}}
"github.com/gogf/gf/v2/frame/g"
{{if .table.HasTimeColumn}}
{{if and .table.HasTimeColumn $hasGtime}}
"github.com/gogf/gf/v2/os/gtime"
{{end}}
commonApi "{{.goModName}}/api/v1/common"