调整xorm层级
This commit is contained in:
Vendored
+6
-6
@@ -1,7 +1,7 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"cutego/modules/core/dao"
|
||||
"cutego/modules"
|
||||
"cutego/pkg/common"
|
||||
"cutego/pkg/constant"
|
||||
)
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
// RemoveList 批量根据Key删除数据
|
||||
// @Param list []string 键合集
|
||||
func RemoveList(list []string) {
|
||||
dao.RedisDB.DELALL(list)
|
||||
modules.RedisDB.DELALL(list)
|
||||
}
|
||||
|
||||
// RemoveKey 根据key删除
|
||||
// @Param key 键
|
||||
// @Return int 删除的数量
|
||||
func RemoveCache(key string) int {
|
||||
del, err := dao.RedisDB.DEL(key)
|
||||
del, err := modules.RedisDB.DEL(key)
|
||||
if err != nil {
|
||||
common.ErrorLog(err)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func RemoveCache(key string) int {
|
||||
// @Param key 键
|
||||
// @Return string 值
|
||||
func GetCache(key string) string {
|
||||
val, err := dao.RedisDB.GET(key)
|
||||
val, err := modules.RedisDB.GET(key)
|
||||
if err != nil {
|
||||
common.ErrorLog(constant.RedisConst{}.GetRedisError(), err.Error())
|
||||
return ""
|
||||
@@ -40,7 +40,7 @@ func GetCache(key string) string {
|
||||
// @Param value 值
|
||||
// @Return 新增的行数
|
||||
func SetCache(key string, value interface{}) int {
|
||||
n, err := dao.RedisDB.SET(key, common.StructToJson(value))
|
||||
n, err := modules.RedisDB.SET(key, common.StructToJson(value))
|
||||
if err != nil {
|
||||
common.ErrorLog(constant.RedisConst{}.GetRedisError(), err.Error())
|
||||
return 0
|
||||
@@ -54,5 +54,5 @@ func SetCache(key string, value interface{}) int {
|
||||
// @Param sec 过期时间(单位: 秒)
|
||||
// @Return 新增的行数
|
||||
func SetCacheTTL(key string, value interface{}, sec int) {
|
||||
dao.RedisDB.SETEX(key, sec, common.StructToJson(value))
|
||||
modules.RedisDB.SETEX(key, sec, common.StructToJson(value))
|
||||
}
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ func StructToJson(v interface{}) string {
|
||||
// 切片(interface{}.(期望类型))
|
||||
// s := make([]interface {}, 0)
|
||||
// target := common.JsonToStruct(get, s)
|
||||
// target.([]entity.SysDictData)
|
||||
// target.([]dataobject.SysDictData)
|
||||
//
|
||||
// @Param data Json字符串
|
||||
// @Param s 容器(结构体、Map等)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
"cutego/modules"
|
||||
"cutego/modules/core/api/v1/response"
|
||||
"cutego/modules/core/dao"
|
||||
"cutego/pkg/cache"
|
||||
"cutego/pkg/config"
|
||||
"errors"
|
||||
@@ -52,7 +52,7 @@ func JWTAuth() gin.HandlerFunc {
|
||||
}
|
||||
singleTag := config.AppEnvConfig.Login.Single
|
||||
if singleTag {
|
||||
token, err := dao.RedisDB.GET(claims.UserInfo.UserName)
|
||||
token, err := modules.RedisDB.GET(claims.UserInfo.UserName)
|
||||
if err == nil {
|
||||
if !(token == currentTokenStr) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tree_dept
|
||||
|
||||
import (
|
||||
"cutego/modules/core/entity"
|
||||
"cutego/modules/core/dataobject"
|
||||
"sort"
|
||||
)
|
||||
|
||||
@@ -201,10 +201,10 @@ func nodePartialSelected(trees []Tree) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type DeptList []entity.SysDept
|
||||
type DeptList []dataobject.SysDept
|
||||
|
||||
// ConvertToINodeArray 将当前数组转换成父类 INode 接口 数组
|
||||
func (s DeptList) ConvertToINodeArray(*[]entity.SysDept) (nodes []INode) {
|
||||
func (s DeptList) ConvertToINodeArray(*[]dataobject.SysDept) (nodes []INode) {
|
||||
for _, v := range s {
|
||||
nodes = append(nodes, v)
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func (s DeptList) ConvertToINodeArray(*[]entity.SysDept) (nodes []INode) {
|
||||
}
|
||||
|
||||
// GetTree 获取树结构
|
||||
func (s DeptList) GetTree(treeSelect *[]entity.SysDept) []Tree {
|
||||
func (s DeptList) GetTree(treeSelect *[]dataobject.SysDept) []Tree {
|
||||
s = *treeSelect
|
||||
array := s.ConvertToINodeArray(treeSelect)
|
||||
return GenerateTree(array, nil)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package tree_menu
|
||||
|
||||
import (
|
||||
"cutego/modules/core/entity"
|
||||
"cutego/modules/core/dataobject"
|
||||
"github.com/druidcaesa/gotool"
|
||||
"sort"
|
||||
)
|
||||
@@ -74,7 +74,7 @@ func GenerateTree(nodes, selectedNodes []INode) (trees []Tree) {
|
||||
var component = "Layout"
|
||||
m := make(map[string]interface{})
|
||||
if v.GetData() != nil {
|
||||
menu := v.GetData().(entity.SysMenu)
|
||||
menu := v.GetData().(dataobject.SysMenu)
|
||||
m["title"] = menu.MenuName
|
||||
m["icon"] = menu.Icon
|
||||
m["noCache"] = menu.IsCache == 1
|
||||
@@ -133,7 +133,7 @@ func recursiveTree(tree *Tree, nodes, selectedNodes []INode) {
|
||||
var component = "Layout"
|
||||
m := make(map[string]interface{})
|
||||
if v.GetData() != nil {
|
||||
menu := v.GetData().(entity.SysMenu)
|
||||
menu := v.GetData().(dataobject.SysMenu)
|
||||
flag = menu.Visible == "1"
|
||||
m["title"] = menu.MenuName
|
||||
m["icon"] = menu.Icon
|
||||
@@ -265,10 +265,10 @@ func nodePartialSelected(trees []Tree) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
type SystemMenus []entity.SysMenu
|
||||
type SystemMenus []dataobject.SysMenu
|
||||
|
||||
// ConvertToINodeArray 将当前数组转换成父类 INode 接口 数组
|
||||
func (s SystemMenus) ConvertToINodeArray(*[]entity.SysMenu) (nodes []INode) {
|
||||
func (s SystemMenus) ConvertToINodeArray(*[]dataobject.SysMenu) (nodes []INode) {
|
||||
for _, v := range s {
|
||||
nodes = append(nodes, v)
|
||||
}
|
||||
@@ -276,7 +276,7 @@ func (s SystemMenus) ConvertToINodeArray(*[]entity.SysMenu) (nodes []INode) {
|
||||
}
|
||||
|
||||
// GetTree 获取树结构数据
|
||||
func (s SystemMenus) GetTree(m *[]entity.SysMenu) []Tree {
|
||||
func (s SystemMenus) GetTree(m *[]dataobject.SysMenu) []Tree {
|
||||
s = *m
|
||||
array := s.ConvertToINodeArray(m)
|
||||
return GenerateTree(array, nil)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"cutego/modules"
|
||||
"cutego/modules/core/api/v1/response"
|
||||
"cutego/modules/core/dao"
|
||||
"cutego/modules/core/entity"
|
||||
"cutego/modules/core/dataobject"
|
||||
"cutego/pkg/common"
|
||||
"cutego/pkg/config"
|
||||
"cutego/pkg/jwt"
|
||||
@@ -32,7 +32,7 @@ func CheckLockToken(c *gin.Context) bool {
|
||||
if config.AppEnvConfig.Login.Single {
|
||||
// 获取redis中的token数据
|
||||
info := GetUserInfo(c)
|
||||
get, err := dao.RedisDB.GET(info.UserName)
|
||||
get, err := modules.RedisDB.GET(info.UserName)
|
||||
if err != nil {
|
||||
common.ErrorLog(err)
|
||||
return false
|
||||
@@ -49,7 +49,7 @@ func CheckLockToken(c *gin.Context) bool {
|
||||
}
|
||||
|
||||
// CheckIsAdmin 判断是否是超级管理员
|
||||
func CheckIsAdmin(user *entity.SysUser) bool {
|
||||
func CheckIsAdmin(user *dataobject.SysUser) bool {
|
||||
if user.UserId == 1 {
|
||||
return true
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user