wangchuanjin 1 éve
szülő
commit
487f4b90f6

+ 7 - 3
api/internal/service/network.go

@@ -438,6 +438,9 @@ func (n *network) AllProject(in *types.AllprojectReq) (reply *types.Reply) {
 
 //人脉库-列表
 func (n *network) List(in *types.NetWorkListReq) *types.Reply {
+	if in.Page_size <= 0 {
+		in.Page_size = 10
+	}
 	q := `select a.id,a.company_id,a.company_name,a.qyxy_id,a.itype,a.contact_person as person,a.contact_phone as phone,count(DISTINCT if(b.itype=1,b.relate_id,null)) as buyer_count,count(DISTINCT if(b.itype=2,b.relate_id,null)) as project_count,GROUP_CONCAT(IF(b.itype=1,b.relate_id,NULL)) AS relate_buyer_id,GROUP_CONCAT(IF(b.itype=2,b.relate_id,NULL)) AS relate_project_id,a.create_time from crm.connection a 
 		left join crm.connection_introduce b on (a.id=b.connection_id) where a.position_id=?`
 	args := []interface{}{in.PositionId}
@@ -463,6 +466,10 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 		args = append(args, "%"+in.Name+"%")
 	}
 	q += ` GROUP BY a.id order by a.create_time desc`
+	if in.Buyercount_start == 0 && in.Buyercount_end == 0 && in.Monitor == 0 && in.Monitorcount_start == 0 && in.Monitorcount_end == 0 && in.Project_matchme == 0 {
+		q += ` limit ?`
+		args = append(args, in.Page_size)
+	}
 	listTemp := CrmMysql.SelectBySql(q, args...)
 	firstparty_array, supplier_array, adiffb_array, agency_array, middleman_project_array := []string{}, []string{}, []string{}, []string{}, []string{}
 	for _, v := range *listTemp {
@@ -650,9 +657,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 		sort.Sort(csList)
 	}
 	length := int64(len(csList.List))
-	if in.Page_size <= 0 {
-		in.Page_size = 10
-	}
 	total_page := int64(math.Ceil(float64(length) / float64(in.Page_size)))
 	finalList := []*map[string]interface{}{}
 	if length > 0 {

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

@@ -133,8 +133,8 @@ func TestAllProject(t *testing.T) {
 	res := Network.AllProject(&types.AllprojectReq{
 		EntAccountId: 64,
 		PositionId:   935,
-		//Id:           "wcj_11111111a",
-		//Type:         1,
+		Id:           "wcj_11111111a",
+		Type:         "firstparty",
 	})
 	b, _ := json.Marshal(res.Data)
 	log.Println(string(b))