xuzhiheng 1 an în urmă
părinte
comite
d5e0ab2777
1 a modificat fișierele cu 28 adăugiri și 14 ștergeri
  1. 28 14
      service/company.go

+ 28 - 14
service/company.go

@@ -142,25 +142,39 @@ func DistributeClueShow(this *biservice.DistributeClueShowReq) *biservice.Distri
 				cluename := common.ObjToString(v["cluename"])
 				minCount, minIndex := int64(0), 0
 				for k, r := range rdata {
-					if k == 0 {
-						minCount = r.CompanyCounts
+					if this.DataType == 1 {
+						if k == 0 {
+							minCount = r.CompanyCounts
+						}
+					} else {
+						if r.CompanyCounts < r.CompanyCount {
+							minCount = r.CompanyCounts
+						}
 					}
-					if r.CompanyCounts < minCount {
-						minCount = r.CompanyCounts
+				}
+				for _, r := range rdata {
+					if this.DataType == 1 {
+						if r.CompanyCounts < minCount {
+							minCount = r.CompanyCounts
+						}
+					} else {
+						if r.CompanyCounts < minCount && r.CompanyCounts < r.CompanyCount {
+							minCount = r.CompanyCounts
+						}
 					}
 				}
 				for k, r := range rdata {
-					// if this.DataType == 1 {
-					if r.CompanyCounts <= minCount {
-						minCount = r.CompanyCounts
-						minIndex = k
+					if this.DataType == 1 {
+						if r.CompanyCounts <= minCount {
+							minCount = r.CompanyCounts
+							minIndex = k
+						}
+					} else {
+						if r.CompanyCounts <= minCount && r.CompanyCounts < r.CompanyCount {
+							minCount = r.CompanyCounts
+							minIndex = k
+						}
 					}
-					// } else {
-					// 	if r.CompanyCounts <= minCount && r.CompanyCounts < r.CompanyCount {
-					// 		minCount = r.CompanyCounts
-					// 		minIndex = k
-					// 	}
-					// }
 				}
 				if this.DataType == 1 {
 					rdata[minIndex].CompanyCount++