فهرست منبع

Merge branch 'cygx_9.3.1_0' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 سال پیش
والد
کامیت
2c1598458f
2فایلهای تغییر یافته به همراه23 افزوده شده و 10 حذف شده
  1. 22 9
      services/activity.go
  2. 1 1
      services/activity_button.go

+ 22 - 9
services/activity.go

@@ -474,14 +474,22 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 	}
 
 	if activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 6 || activityInfo.ActivityTypeId == 7 {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") && strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) {
+		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(主观)") {
 			havePower = true
+		} else {
+			havePower = false
 		}
 	} else {
-		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") && strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) {
+		if strings.Contains(permissionStr, activityInfo.ChartPermissionName+"(客观)") {
 			havePower = true
+		} else {
+			havePower = false
 		}
 	}
+	//如果主客观校验不通过,那么直接返回
+	if !havePower {
+		return
+	}
 	if (strings.Contains(activityInfo.ChartPermissionName, "研选") || activityInfo.ChartPermissionName == "策略") && strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
 		havePower = true
 	}
@@ -495,16 +503,20 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		err = errs
 		return
 	}
-	if strings.Contains(permissionShengji, activityInfo.ChartPermissionName) && strings.Contains(activityInfo.CustomerTypeIds, "8") {
-		havePower = true
-	}
-	fmt.Println("主客观2", havePower)
+
+	//fmt.Println("主客观2", havePower)
 	//if strings.Contains(permissionStr, activityInfo.ChartPermissionName) && strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) {
 	//	havePower = true
 	//}
-	fmt.Println("主客观3", havePower)
-	if !strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) && userTypeStr != "8" {
-		havePower = false
+	//fmt.Println("主客观3", havePower)
+	//处理升级权限以及用户身份的 双重判断
+	if activityInfo.CustomerTypeIds != "" {
+		if !strings.Contains(activityInfo.CustomerTypeIds, userTypeStr) && userTypeStr != "8" {
+			havePower = false
+			if strings.Contains(permissionShengji, activityInfo.ChartPermissionName) && strings.Contains(activityInfo.CustomerTypeIds, "8") {
+				havePower = true
+			}
+		}
 	}
 	if havePower && activityInfo.LimitPeopleNum > 0 {
 		//对于一些特殊的活动,即使权限满足也不给产看
@@ -543,6 +555,7 @@ func GetShareNoPowe(activityInfo *models.ActivityDetail, permissionStr string, u
 	//if userType == 3 && !strings.Contains(permissionStr, "专家") && !strings.Contains(activityInfo.CustomerTypeIds, strconv.Itoa(3)) {
 	//	noPower = true
 	//}
+	fmt.Println(userType)
 	if userType == 8 {
 		permissionShengji, errs := models.GetCompanyPermissionByUserZhengShiTrip(user.CompanyId)
 		if errs != nil {

+ 1 - 1
services/activity_button.go

@@ -225,7 +225,7 @@ func HandleActivityListButton(list []*models.ActivityDetail, user *models.WxUser
 			list[k].ActivityTypeName = "买方研选电话会"
 			list[k].ImgUrlText = utils.YAN_XUAN_IMG
 		}
-		if v.ActivityType == 0 {
+		if v.ActivityType != 0 {
 			if mapAddress[v.City] != "" {
 				list[k].ImgUrl = mapAddress[v.City]
 			} else {