Browse Source

feat:添加方法

wangchuanjin 1 year ago
parent
commit
8d8af2dcd3
2 changed files with 18 additions and 7 deletions
  1. 17 6
      api/internal/service/network.go
  2. 1 1
      api/internal/service/network_test.go

+ 17 - 6
api/internal/service/network.go

@@ -413,31 +413,42 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 			if vv.Type == "middleman" {
 				tempId = fmt.Sprint(vv.Id)
 			}
-			myChildIds := ""
+			myChildIds, myChildTypes := "", ""
 			if in.Id == "" && v.Name == "甲方" {
 				for _, vvv := range firstpartyChild[vv.CompanyId] {
 					if id != "" {
 						id += ","
 					}
 					id += vvv.CompanyId
+					if pType != "" {
+						pType += ","
+					}
+					pType += vv.Type
 					if myChildIds != "" {
 						myChildIds += ","
 					}
 					myChildIds += vvv.CompanyId
+					if myChildTypes != "" {
+						myChildTypes += ","
+					}
+					myChildTypes += vv.Type
 				}
 			} else {
 				if id != "" {
 					id += ","
 				}
 				id += tempId
+				if pType != "" {
+					pType += ","
+				}
+				pType += vv.Type
 			}
-			if pType != "" {
-				pType += ","
-			}
-			pType += vv.Type
 			if myChildIds == "" {
 				myChildIds = tempId
 			}
+			if myChildTypes == "" {
+				myChildTypes = vv.Type
+			}
 			cm := map[string]interface{}{
 				"NAME":      vv.CompanyName,
 				"ID":        myChildIds,
@@ -448,7 +459,7 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 				"DATACOUNT": vv.Count,
 				"SZ_LEVEL":  1,
 				"SZ_LEAF":   1,
-				"TYPE":      vv.Type,
+				"TYPE":      myChildTypes,
 				"MYID":      tempId,
 			}
 			convList = append(convList, cm)

+ 1 - 1
api/internal/service/network_test.go

@@ -16,7 +16,7 @@ import (
 
 func initDb() {
 	CrmMysql = &mysql.Mysql{
-		Address:      "192.168.3.14:4000",
+		Address:      "192.168.3.217:4000",
 		UserName:     "root",
 		PassWord:     "=PDT49#80Z!RVv52_z",
 		DBName:       "crm",