Quellcode durchsuchen

feat:权限判断

wangshan vor 2 Jahren
Ursprung
Commit
ef2caf964b

+ 1 - 1
jyBXCore/rpc/internal/logic/participateshowlogic.go

@@ -36,7 +36,7 @@ func (l *ParticipateShowLogic) ParticipateShow(in *bxcore.ParticipateShowReq) (*
 	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回不展示
 	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
 	//不是超级订阅 也不是大会员
-	if userInfo.Vip.Status < 0 && userInfo.Member.Status < 0 {
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
 		result.ErrMsg = "没有权限"
 		return &result, nil
 	}

+ 36 - 17
jyBXCore/rpc/service/participate.go

@@ -18,8 +18,14 @@ import (
 func ParticipateList(in *bxcore.ParticipateListReq) (*bxcore.ParticipateListRes, error) {
 	defer MC.Catch()
 	res := &bxcore.ParticipateListRes{Data: &bxcore.ParticipateData{}}
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	//不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		res.ErrCode = -1
+		res.ErrMsg = "没有权限"
+		return res, nil
+	}
 	if in.PositionType > 0 {
-		userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
 		if userInfo.Ent.EntRoleId == 0 {
 			in.EntUserIds = ""
 		}
@@ -63,9 +69,14 @@ func ParticipateList(in *bxcore.ParticipateListReq) (*bxcore.ParticipateListRes,
 //参标动作:参标、终止参标、划转:in:参标;out:终止参标;transfer:划转
 func ParticipateDo(in *bxcore.ParticipateActionReq) error {
 	defer MC.Catch()
+	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回不展示
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	//不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		return fmt.Errorf("暂无权限")
+	}
 	//企业版 判断是否是管理员
 	//判断用户身份
-	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
 	switch in.ActionType {
 	case "in": //参标针对单个招标信息 或者 项目
 		if in.BidIds == "" && in.ProjectIds == "" {
@@ -147,21 +158,29 @@ func GetParticipateSetInfo(in *bxcore.ParticipateSetUpInfoReq) (*bxcore.Particip
 		BidType:    nil,
 		RemindRule: nil,
 	}}
-	switch in.SetAction {
-	case "U": //update 更新设置信息
-		res.Data = nil
-		if err := mysql.UpdateParticipateSetInfo(in); err != nil {
-			res.ErrCode = -1
-			res.ErrMsg = err.Error()
-		}
-	default: //默认查询对应设置信息
-		//查询对应用户设置信息
-		//未设置过 返回默认配置
-		if info, err := mysql.GetParticipateSetInfo(in); err == nil {
-			res.Data = info
-		} else {
-			res.ErrCode = -1
-			res.ErrMsg = err.Error()
+	// 1. 判断身份是否有权限 不是超级订阅也不是大会员  则直接返回
+	userInfo := IC.Middleground.PowerCheckCenter.Check(in.AppId, in.UserId, in.NewUserId, in.AccountId, in.EntId, in.PositionType, in.PositionId)
+	// 不是超级订阅 也不是大会员
+	if userInfo.Vip.Status <= 0 && userInfo.Member.Status <= 0 {
+		res.ErrCode = -1
+		res.ErrMsg = "暂无权限"
+	} else {
+		switch in.SetAction {
+		case "U": //update 更新设置信息
+			res.Data = nil
+			if err := mysql.UpdateParticipateSetInfo(in); err != nil {
+				res.ErrCode = -1
+				res.ErrMsg = err.Error()
+			}
+		default: //默认查询对应设置信息
+			//查询对应用户设置信息
+			//未设置过 返回默认配置
+			if info, err := mysql.GetParticipateSetInfo(in); err == nil {
+				res.Data = info
+			} else {
+				res.ErrCode = -1
+				res.ErrMsg = err.Error()
+			}
 		}
 	}
 	return res, nil