Эх сурвалжийг харах

Merge branch 'yb11.1' into debug

ziwen 2 жил өмнө
parent
commit
07ebdca14a

+ 6 - 4
services/company/permission.go

@@ -1090,12 +1090,14 @@ LOOP:
 			temp.List = item.List
 			//大宗商品分类内合并PTA&MEG
 			if temp.ClassifyName == "化工" {
+				count := 0
 				for i, secondItem := range temp.List {
-					if secondItem.ChartPermissionName == "PTA"{
+					if secondItem.ChartPermissionName == "PTA" || secondItem.ChartPermissionName == "MEG"{
+						count++
 						secondItem.ChartPermissionName = "PTA&MEG"
-					}
-					if secondItem.ChartPermissionName == "MEG" {
-						temp.List = append(temp.List[:i], temp.List[i+1:]...)
+						if count > 1 {
+							temp.List = append(temp.List[:i], temp.List[i+1:]...)
+						}
 					}
 				}
 			}

+ 10 - 5
services/pc/classify.go

@@ -14,7 +14,7 @@ import (
 )
 
 // GetClassifyFirstList 获取一级分类列表
-func GetClassifyFirstList(user user.UserInfo) (list pc.ClassifyFirstList, err error) {
+func GetClassifyFirstList(user user.UserInfo) (resp pc.ClassifyFirstList, err error) {
 	var errMsg string
 	defer func() {
 		if err != nil {
@@ -48,6 +48,7 @@ func GetClassifyFirstList(user user.UserInfo) (list pc.ClassifyFirstList, err er
 		err = errors.New("报告查询出错")
 		return
 	}
+	var list pc.ClassifyFirstList
 	for _, item := range classifyParents {
 		temp := new(pc.ClassifyFirstListItem)
 		temp.ClassifyIdFirst = item.Id
@@ -95,20 +96,24 @@ func GetClassifyFirstList(user user.UserInfo) (list pc.ClassifyFirstList, err er
 		}
 	}
 
-	for i, item := range list {
+	for _, item := range list {
 		//无权限用户关闭品种类别入口
 		if item.RedirectType == 4 && !productAuthOk{
-			list = append(list[:i], list[i+1:]...)
+			continue
 		}
+
 		for _, report := range reportList {
 			if report.ClassifyNameFirst == item.ClassifyNameFirst {
 				item.Latest = report.Stage
 			}
 		}
+		resp = append(resp, item)
 	}
-	if len(list) > 0 {
-		sort.Sort(list)
+
+	if len(resp) > 0 {
+		sort.Sort(resp)
 	}
 
+
 	return
 }

+ 7 - 5
services/report/classify.go

@@ -305,7 +305,7 @@ func GetClassifySecondSimpleList(user user.UserInfo, classifyIdFirst int) (list
 }
 
 // GetClassifyFirstList 获取一级分类列表
-func GetClassifyFirstList(user user.UserInfo) (list response.ClassifyFirstList, err error) {
+func GetClassifyFirstList(user user.UserInfo) (resp response.ClassifyFirstList, err error) {
 	var errMsg string
 	defer func() {
 		if err != nil {
@@ -329,6 +329,7 @@ func GetClassifyFirstList(user user.UserInfo) (list response.ClassifyFirstList,
 		classifyIconMap[v.ClassifyName] = v.YbFiccIcon
 		classifySortMap[v.ClassifyName] = v.YbFiccSort
 	}
+	var list response.ClassifyFirstList
 	for _, item := range classifyParents {
 		temp := new(response.ClassifyFirstListItem)
 		temp.ClassifyIdFirst = item.Id
@@ -375,15 +376,16 @@ func GetClassifyFirstList(user user.UserInfo) (list response.ClassifyFirstList,
 		}
 	}
 
-	for i, item := range list {
+	for _, item := range list {
 		//无权限用户关闭品种类别入口
 		if item.RedirectType == 4 && !productAuthOk{
-			list = append(list[:i], list[i+1:]...)
+			continue
 		}
+		resp = append(resp, item)
 	}
 
-	if len(list) > 0 {
-		sort.Sort(list)
+	if len(resp) > 0 {
+		sort.Sort(resp)
 	}
 
 	return