瀏覽代碼

feat:重新授权

wangchuanjin 1 年之前
父節點
當前提交
2ca0be218b
共有 1 個文件被更改,包括 10 次插入12 次删除
  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,