Browse Source

fix: 无ficc权限用户v2

hsun 2 years ago
parent
commit
5639ad546a
3 changed files with 24 additions and 9 deletions
  1. 8 3
      services/report/classify.go
  2. 8 3
      services/report/report.go
  3. 8 3
      services/report/report_chapter.go

+ 8 - 3
services/report/classify.go

@@ -159,9 +159,14 @@ func GetClassifyReportList(user user.UserInfo, classifyIdSecond int, pageIndex,
 		err = errors.New("查询用户购买产品出错")
 		return
 	}
-	// 已购或者试用用户可见
-	if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
-		productAuthOk = true
+	if companyProduct != nil {
+		// 无FICC权限的客户不可见
+		if companyProduct.CompanyProductID > 0 {
+			// 已购或者试用用户可见
+			if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
+				productAuthOk = true
+			}
+		}
 	}
 	classifyInfo, err := classify.GetByClassifyId(classifyIdSecond)
 	if err != nil {

+ 8 - 3
services/report/report.go

@@ -490,9 +490,14 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 		err = errors.New("查询用户购买产品出错")
 		return
 	}
-	// 已购或者试用用户可见
-	if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
-		productAuthOk = true
+	if companyProduct != nil {
+		// 无FICC权限的客户不可见
+		if companyProduct.CompanyProductID > 0 {
+			// 已购或者试用用户可见
+			if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
+				productAuthOk = true
+			}
+		}
 	}
 
 	var condition string

+ 8 - 3
services/report/report_chapter.go

@@ -163,9 +163,14 @@ func GetChapterDetail(user user.UserInfo, reportChapterId int) (reportChapterDet
 		err = errors.New("查询用户购买产品出错")
 		return
 	}
-	// 已购或者正常试用用户可见
-	if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
-		productAuthOk = true
+	if companyProduct != nil {
+		// 无FICC权限的客户不可见
+		if companyProduct.CompanyProductID > 0 {
+			// 已购或者试用用户可见
+			if strings.Contains("永续,正式", companyProduct.Status) || (companyProduct.Status == "试用" && companyProduct.IsSuspend != 1) {
+				productAuthOk = true
+			}
+		}
 	}
 
 	typeIds, err := report_chapter_type_cache.GetEffectTypeID()