wangshan hace 9 meses
padre
commit
ae3e759e72
Se han modificado 3 ficheros con 7 adiciones y 7 borrados
  1. 2 2
      entity/user.go
  2. 1 1
      service/workDesktop.go
  3. 4 4
      service/workDesktop_test.go

+ 2 - 2
entity/user.go

@@ -16,7 +16,7 @@ import (
 
 const (
 	RedisCode         = "newother"
-	RedisMenuKey      = "jy_workdesktopmenu_%s_%s_%s_%s"
+	RedisMenuKey      = "jy_workdesktopmenu_%s_%s_%s"
 	UserPowerRedisKey = "jy_userpowerredis_%s_%d_%s"
 	UserRegisterTime  = "jy_userregistertime_%s"
 	UserPowerEndTime  = "jy_user_power_end_time_%s"
@@ -283,7 +283,7 @@ func ClearUserPowerFunc(positionId, appId string) bool {
 	for _, v := range strings.Split(positionId, ",") {
 		for _, vv := range []string{"PC", "APP", "WX"} {
 			//用户菜单缓存
-			redis.Del(RedisCode, fmt.Sprintf(RedisMenuKey, appId, vv, ConfigJson.MenuCacheKey, v))
+			redis.Del(RedisCode, fmt.Sprintf(RedisMenuKey, appId, vv, v))
 		}
 		//用户权限缓存
 		redis.Del(RedisCode, fmt.Sprintf(UserPowerRedisKey, appId, time.Now().Day(), v))

+ 1 - 1
service/workDesktop.go

@@ -345,7 +345,7 @@ func GetWordDesktopMenuTree(in *WorkDesktopMenuInfoReq) ([]*pb.MenuList, error)
 	var (
 		menuList []*pb.MenuList
 	)
-	RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, entity.ConfigJson.MenuCacheKey, in.UserId)
+	RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
 	logx.Info("RedisMenuKey:", RedisMenuKey)
 	menuBytes, err := redis.GetBytes(entity.RedisCode, RedisMenuKey)
 	if in.WorkStatus == 0 && err == nil && len(*menuBytes) > 0 {

+ 4 - 4
service/workDesktop_test.go

@@ -17,8 +17,8 @@ var (
 	ctx, _ = context.WithTimeout(context.Background(), 2*time.Second)
 )
 
-//工作桌面菜单树 无缓存
-//go test -run=Test_WorkDesktopMenuTree
+// 工作桌面菜单树 无缓存
+// go test -run=Test_WorkDesktopMenuTree
 func Test_WorkDesktopMenuTree(t *testing.T) {
 	tests := []struct {
 		name string                     //备注(表名)
@@ -65,7 +65,7 @@ func Test_WorkDesktopMenuTree(t *testing.T) {
 	}
 	for _, in := range tests {
 		t.Run(in.name, func(t *testing.T) {
-			RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.args.AppId, in.args.Platform, entity.ConfigJson.MenuCacheKey, MC.If(in.args.PositionId != "", in.args.PositionId, in.args.UserId).(string))
+			RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.args.AppId, in.args.Platform, MC.If(in.args.PositionId != "", in.args.PositionId, in.args.UserId).(string))
 			redis.Del(entity.RedisCode, RedisMenuKey)
 			res, err := GetWordDesktopMenuTree(in.args)
 			if len(res) == 0 || err != nil {
@@ -128,7 +128,7 @@ func Test_MenuMode(t *testing.T) {
 	}
 }
 
-//当前工作桌面菜单模式
+// 当前工作桌面菜单模式
 // go test -v -run Test_WorkMenuMode
 func Test_WorkMenuMode(t *testing.T) {
 	var tests = []struct {