瀏覽代碼

Merge branch 'master' into yb_pc2.0

ziwen 3 年之前
父節點
當前提交
d30c685fdc

+ 2 - 1
controller/user/user.go

@@ -254,7 +254,8 @@ func Apply(c *gin.Context) {
 // @Router /user/get_tab_bar [get]
 // @Router /user/get_tab_bar [get]
 func GetTabBar(c *gin.Context) {
 func GetTabBar(c *gin.Context) {
 	userInfo := userService.GetInfoByClaims(c)
 	userInfo := userService.GetInfoByClaims(c)
-	tabBarList, err := userLogic.GetUserTabBar(userInfo)
+	version := c.Request.Header.Get("version")
+	tabBarList, err := userLogic.GetUserTabBar(userInfo, version)
 
 
 	if err != nil {
 	if err != nil {
 		response.Fail("获取失败", c)
 		response.Fail("获取失败", c)

+ 14 - 13
logic/user/user.go

@@ -342,21 +342,22 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
 }
 }
 
 
 // GetUserTabBar 获取用户小程序TabBar
 // GetUserTabBar 获取用户小程序TabBar
-func GetUserTabBar(userInfo user.UserInfo) (list []string, err error) {
+func GetUserTabBar(userInfo user.UserInfo, version string) (list []string, err error) {
 	// user-我的; activity-活动; chart-图表; report-研报; buy-已购
 	// user-我的; activity-活动; chart-图表; report-研报; buy-已购
-	list = []string{"activity", "user", "chart", "report"}
-
-	companyProduct, err := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
-	if err != nil {
-		if err == utils.ErrNoRow {
-			err = nil
+	list = []string{"activity", "user", "chart"}
+	if version == "yb3.0" {
+		list = []string{"activity", "user", "chart", "report"}
+		companyProduct, tmpErr := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
+		if tmpErr != nil {
+			if tmpErr == utils.ErrNoRow {
+				err = nil
+			}
+			return
+		}
+		// 已购仅付费用户可见
+		if strings.Contains("永续,正式", companyProduct.Status) {
+			list = append(list, "buy")
 		}
 		}
-		return
-	}
-	// 已购仅付费用户可见
-	if strings.Contains("永续,正式", companyProduct.Status) {
-		list = append(list, "buy")
 	}
 	}
-
 	return
 	return
 }
 }

+ 1 - 1
services/company/permission.go

@@ -292,6 +292,7 @@ func GetCheckPermission(companyId int64, userId int, permissionIdList []int) (ok
 			}
 			}
 		}
 		}
 	}()
 	}()
+	permissionCheckInfo.HzPhone = utils.HZPHONE
 	//非潜在客户
 	//非潜在客户
 	permissionMap := make(map[int]bool)
 	permissionMap := make(map[int]bool)
 	if len(permissionIdList) > 0 {
 	if len(permissionIdList) > 0 {
@@ -391,7 +392,6 @@ func GetCheckPermission(companyId int64, userId int, permissionIdList []int) (ok
 	} else {
 	} else {
 		permissionCheckInfo.Type = "apply"
 		permissionCheckInfo.Type = "apply"
 	}
 	}
-	permissionCheckInfo.HzPhone = utils.HZPHONE
 	return
 	return
 }
 }
 
 

+ 15 - 10
services/report/classify.go

@@ -159,9 +159,14 @@ func GetClassifyReportList(user user.UserInfo, classifyIdSecond int, pageIndex,
 		err = errors.New("查询用户购买产品出错")
 		err = errors.New("查询用户购买产品出错")
 		return
 		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)
 	classifyInfo, err := classify.GetByClassifyId(classifyIdSecond)
 	if err != nil {
 	if err != nil {
@@ -367,13 +372,13 @@ func GetClassifyFirstList(user user.UserInfo) (list response.ClassifyFirstList,
 		temp.RedirectType = 2
 		temp.RedirectType = 2
 		if item.ShowType == 2 {
 		if item.ShowType == 2 {
 			temp.RedirectType = 1
 			temp.RedirectType = 1
-		}
-		classifyChild, _ := classify.GetChildByPid(item.Id)
-		if classifyChild != nil && len(classifyChild) == 1 {
-			// 存在二级分类且仅有一个时直接跳转专栏详情
-			temp.ClassifyIdSecond = classifyChild[0].Id
-			temp.ClassifyNameSecond = classifyChild[0].ClassifyName
-			temp.RedirectType = 3
+			classifyChild, _ := classify.GetChildByPid(item.Id)
+			if classifyChild != nil && len(classifyChild) == 1 {
+				// 存在二级分类且仅有一个时直接跳转专栏详情
+				temp.ClassifyIdSecond = classifyChild[0].Id
+				temp.ClassifyNameSecond = classifyChild[0].ClassifyName
+				temp.RedirectType = 3
+			}
 		}
 		}
 		list = append(list, temp)
 		list = append(list, temp)
 	}
 	}

+ 16 - 6
services/report/report.go

@@ -369,9 +369,14 @@ func GetReportDetail(userinfo user.UserInfo, reportId int) (reportDetail respons
 		err = errors.New("查询用户购买产品出错")
 		err = errors.New("查询用户购买产品出错")
 		return
 		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
+			}
+		}
 	}
 	}
 	reportInfo, err := report.GetByReportId(reportId)
 	reportInfo, err := report.GetByReportId(reportId)
 	if err != nil {
 	if err != nil {
@@ -485,9 +490,14 @@ func GetReportList(user user.UserInfo, keyWord string, classifyIdFirst, classify
 		err = errors.New("查询用户购买产品出错")
 		err = errors.New("查询用户购买产品出错")
 		return
 		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
 	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("查询用户购买产品出错")
 		err = errors.New("查询用户购买产品出错")
 		return
 		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()
 	typeIds, err := report_chapter_type_cache.GetEffectTypeID()