perf: 配置文件调整
This commit is contained in:
@@ -166,7 +166,7 @@ func RunTime() time.Time {
|
||||
|
||||
// Get 获取配置信息
|
||||
//
|
||||
// Get("server.proxy")
|
||||
// Get("redis.defaultDataSourceName")
|
||||
func Get(key string) any {
|
||||
return conf.Get(key)
|
||||
}
|
||||
@@ -187,7 +187,7 @@ func IsSystemUser(userId int64) bool {
|
||||
return false
|
||||
}
|
||||
// 从配置中获取系统管理员ID列表
|
||||
arr := Get("user.system").([]any)
|
||||
arr := Get("systemUser").([]any)
|
||||
for _, v := range arr {
|
||||
if fmt.Sprint(v) == fmt.Sprint(userId) {
|
||||
return true
|
||||
|
||||
@@ -26,10 +26,7 @@ import (
|
||||
func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 登录认证,默认打开
|
||||
enable := true
|
||||
if v := config.Get("user.cryptoApi"); v != nil && enable {
|
||||
enable = v.(bool)
|
||||
}
|
||||
enable := parse.Boolean(config.Get("serverCryptoApi"))
|
||||
if !enable {
|
||||
c.Next()
|
||||
return
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"be.ems/src/framework/reqctx"
|
||||
"be.ems/src/framework/resp"
|
||||
"be.ems/src/framework/token"
|
||||
"be.ems/src/framework/utils/parse"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -38,10 +39,7 @@ var URL_WHITE_LIST = []string{
|
||||
func PreAuthorize(options map[string][]string) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 登录认证,默认打开
|
||||
enable := true
|
||||
if v := config.Get("user.loginAuth"); v != nil {
|
||||
enable = v.(bool)
|
||||
}
|
||||
enable := parse.Boolean(config.Get("serverLoginAuth"))
|
||||
if !enable {
|
||||
loginUser, _ := reqctx.LoginUser(c)
|
||||
loginUser.UserId = 2
|
||||
|
||||
Reference in New Issue
Block a user