You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.2 KiB
53 lines
1.2 KiB
package publicmethod
|
|
|
|
import (
|
|
"appPlatform/middleware/grocerystore"
|
|
"appPlatform/overall"
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2025-11-26 14:04:11
|
|
@ 功能: 设置权限Redis
|
|
*/
|
|
func SetupPowerInfo(userKey int64, powerInfo string) {
|
|
redisFileKey := fmt.Sprintf("SystemPower:AllPower_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey)
|
|
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4)
|
|
redisClient.SetRedisTime(86400)
|
|
redisClient.Set(redisFileKey, powerInfo)
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2025-11-26 14:08:15
|
|
@ 功能: 获取权限
|
|
*/
|
|
func GetSystemPowerInfo(userKey int64) (powerInfo SendAllPower) {
|
|
redisFileKey := fmt.Sprintf("SystemPower:AllPower_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey)
|
|
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS4)
|
|
isTrue, powerStr := redisClient.Get(redisFileKey)
|
|
if isTrue {
|
|
json.Unmarshal([]byte(powerStr), &powerInfo)
|
|
}
|
|
return
|
|
}
|
|
|
|
/*
|
|
*
|
|
@ 作者: 秦东
|
|
@ 时间: 2025-11-27 15:21:00
|
|
@ 功能: 获取我的菜单权限
|
|
*/
|
|
func GetMyMenuPower(userKey int64, menuId string) (menuPower SystemInfoPower) {
|
|
myPower := GetSystemPowerInfo(userKey)
|
|
for _, v := range myPower.SystemPower {
|
|
if v.AppId == menuId {
|
|
menuPower = v
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|