浏览代码

过滤下架产品

kobe6258 4 月之前
父节点
当前提交
4847dd8492
共有 1 个文件被更改,包括 25 次插入22 次删除
  1. 25 22
      domian/report/report_service.go

+ 25 - 22
domian/report/report_service.go

@@ -891,30 +891,33 @@ func GetTotalPageCountByPermissionIds(permissionIds []int) (total int64, latestI
 			disCardReportIds = append(disCardReportIds, product.SourceID)
 		}
 	}
-	wg.Add(2)
-	var permissionNames []string
-	var classifyIds []int
-	go func() {
-		defer wg.Done()
-		var permissionErr error
-		permissionNames, permissionErr = GetPermissionNamesByPermissionIds(ProductPermissionIds)
-		if permissionErr != nil {
-			logger.Error("获取ETA品种名称失败:%v", err)
-		}
-	}()
-	go func() {
-		defer wg.Done()
-		var classifyErr error
-		classifyIds, classifyErr = permissionDao.GetClassifyIdsByPermissionIds(ProductPermissionIds)
-		if classifyErr != nil {
-			logger.Error("获取ETA报告分类id失败:%v", err)
+	if len(ProductPermissionIds) > 0 {
+		wg.Add(2)
+		var permissionNames []string
+		var classifyIds []int
+		go func() {
+			defer wg.Done()
+			var permissionErr error
+			permissionNames, permissionErr = GetPermissionNamesByPermissionIds(ProductPermissionIds)
+			if permissionErr != nil {
+				logger.Error("获取ETA品种名称失败:%v", err)
+			}
+		}()
+		go func() {
+			defer wg.Done()
+			var classifyErr error
+			classifyIds, classifyErr = permissionDao.GetClassifyIdsByPermissionIds(ProductPermissionIds)
+			if classifyErr != nil {
+				logger.Error("获取ETA报告分类id失败:%v", err)
+			}
+		}()
+		wg.Wait()
+		disCardIds, _ := reportDao.GetHiddenReportIds(classifyIds, permissionNames)
+		if len(disCardIds) > 0 {
+			disCardReportIds = append(disCardReportIds, disCardIds...)
 		}
-	}()
-	wg.Wait()
-	disCardIds, _ := reportDao.GetHiddenReportIds(classifyIds, permissionNames)
-	if len(disCardIds) > 0 {
-		disCardReportIds = append(disCardReportIds, disCardIds...)
 	}
+
 	//对数据去重
 	disCardReportIds = uniqueArray(disCardReportIds)
 	//获取报告中还包含上架套餐的id