资源排行去掉内置租户 (#544)

Co-authored-by: alickliming <alickliming@didi.global.com>
This commit is contained in:
alick-liming 2021-01-25 10:28:40 +08:00 committed by GitHub
parent b7284ada94
commit 7bfd60be86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 2 deletions

View File

@ -602,7 +602,7 @@ func tenantResourcesCountRank(c *gin.Context) {
resMap := make(map[string]int, 50)
for _, res := range ress {
tenant := res.Tenant
if tenant != "" {
if tenant != "" && tenant != "inner" {
if _, ok := resMap[tenant]; !ok {
resMap[tenant] = 0
}
@ -650,9 +650,17 @@ func projectResourcesCountRank(c *gin.Context) {
}
// 获取全部project
projectNodes, err := models.NodeGets("cate=?", "project")
projectAllNodes, err := models.NodeGets("cate=?", "project")
dangerous(err)
var projectNodes []models.Node
for _, p := range projectAllNodes {
tenant := p.Tenant()
if tenant != "inner" {
projectNodes = append(projectNodes, p)
}
}
projectNodesLen := len(projectNodes)
workerNum := 50
if projectNodesLen < workerNum {