Browse Source

feat:重新授权

wangchuanjin 1 year ago
parent
commit
2ca0be218b
1 changed files with 10 additions and 12 deletions
  1. 10 12
      api/internal/logic/resempowerlogic.go

+ 10 - 12
api/internal/logic/resempowerlogic.go

@@ -33,20 +33,18 @@ func (l *ResEmpowerLogic) ResEmpower(req *types.ResEmpowerReq) (resp *types.BiRe
 		entUserIds = append(entUserIds, Int64All(v))
 	}
 	var r *pb.Resp
+	pdReq := &pb.EmpowerReq{
+		Appid:        "10000",
+		FunctionCode: req.FunctionCode,
+		EntId:        req.EntId,
+		EntUserId:    entUserIds,
+	}
 	if req.ReqType == 1 {
-		r, err = l.svcCtx.ResourceCenterRpc.Empower(context.Background(), &pb.EmpowerReq{
-			Appid:        "10000",
-			FunctionCode: req.FunctionCode,
-			EntId:        req.EntId,
-			EntUserId:    entUserIds,
-		})
+		r, err = l.svcCtx.ResourceCenterRpc.Empower(context.Background(), pdReq)
+	} else if req.ReqType == 2 {
+		r, err = l.svcCtx.ResourceCenterRpc.ReEmpower(context.Background(), pdReq)
 	} else if req.ReqType == -1 {
-		r, err = l.svcCtx.ResourceCenterRpc.CancelEmpower(context.Background(), &pb.EmpowerReq{
-			Appid:        "10000",
-			FunctionCode: req.FunctionCode,
-			EntId:        req.EntId,
-			EntUserId:    entUserIds,
-		})
+		r, err = l.svcCtx.ResourceCenterRpc.CancelEmpower(context.Background(), pdReq)
 	}
 	l.svcCtx.UserCenterRpc.WorkDesktopClearUserInfo(context.Background(), &pcpd.WorkDesktopClearUserInfoReq{
 		PositionId: req.PositionId,