瀏覽代碼

分享可见权限校验

xingzai 3 年之前
父節點
當前提交
2256c96a6d
共有 1 個文件被更改,包括 25 次插入0 次删除
  1. 25 0
      controllers/activity.go

+ 25 - 0
controllers/activity.go

@@ -467,6 +467,31 @@ func (this *ActivityCoAntroller) Detail() {
 			}
 		}
 	}
+	if activityInfo.IsLimitPeople > 0 {
+		var noPower bool
+		if (userType == 1 || userType == 4 || userType == 5) && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(userType)) {
+			noPower = true
+		}
+		//带有专家权限的 2、大套餐客户(4个行业全开通的正式客户)  3、分行业套餐客户(开通对应行业的正式客户)
+		if userType == 2 && strings.Contains(permissionStr, "专家") && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(2)) && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(4)) {
+			noPower = true
+		}
+		if userType == 2 && !strings.Contains(permissionStr, "专家") && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(2)) && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) {
+			noPower = true
+		}
+		if userType == 3 && strings.Contains(permissionStr, "专家") && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(4)) {
+			noPower = true
+		}
+		if userType == 3 && !strings.Contains(permissionStr, "专家") && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) {
+			noPower = true
+		}
+		if noPower {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "被分享客户不可见,获取信息失败,Err:"
+			return
+		}
+	}
+	fmt.Println("权限可见校验")
 	detail, errDetail := models.GetActivityTypeDetailById(activityInfo.ActivityTypeId)
 	if errDetail != nil {
 		br.Msg = "获取信息失败"