wangchuanjin 1 жил өмнө
parent
commit
bc8e2719a2

+ 11 - 9
api/internal/service/network.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"database/sql"
 	"fmt"
-	"log"
 	"math"
 	"sort"
 	"strings"
@@ -487,23 +486,27 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 		sqlAppend1 += ` and a.itype=?`
 		sqlAppendArgs = append(sqlAppendArgs, n.TypeStrConvert(in.Type))
 	}
+	comSqlAppend := ""
+	comSqlArgs := []interface{}{}
 	if in.Starttime != "" {
-		sqlAppend1 += ` and a.create_time>=?`
-		sqlAppendArgs = append(sqlAppendArgs, in.Starttime+" 00:00:00")
+		comSqlAppend += ` and a.create_time>=?`
+		comSqlArgs = append(comSqlArgs, in.Starttime+" 00:00:00")
 	}
 	if in.Endtime != "" {
-		sqlAppend1 += ` and a.create_time<=?`
+		comSqlAppend += ` and a.create_time<=?`
 		if in.Starttime == in.Endtime {
 			in.Endtime += " 23:59:59"
 		} else {
 			in.Endtime += " 00:00:00"
 		}
-		sqlAppendArgs = append(sqlAppendArgs, in.Endtime)
+		comSqlArgs = append(comSqlArgs, in.Endtime)
 	}
 	if in.Name != "" {
-		sqlAppend1 += ` and a.company_name like ?`
-		sqlAppendArgs = append(sqlAppendArgs, "%"+in.Name+"%")
+		comSqlAppend += ` and a.company_name like ?`
+		comSqlArgs = append(comSqlArgs, "%"+in.Name+"%")
 	}
+	sqlAppend1 += comSqlAppend
+	sqlAppendArgs = append(sqlAppendArgs, comSqlArgs...)
 	var count int64
 	start := (in.Current_page - 1) * in.Page_size
 	end := start + in.Page_size
@@ -518,7 +521,7 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 		count = CrmMysql.CountBySql(`select count(1) as count from crm.connection a where a.position_id=?`+sqlAppend1, newArgs...)
 		sqlAppend2 = ` limit ?,?`
 		args = append(args, start, end)
-		items := CrmMysql.SelectBySql(`SELECT itype,SUM(1) AS sum FROM crm.connection WHERE position_id=?`+sqlAppend1+` GROUP BY itype`, newArgs...)
+		items := CrmMysql.SelectBySql(`SELECT itype,SUM(1) AS sum FROM crm.connection WHERE position_id=?`+comSqlAppend+` GROUP BY itype`, comSqlArgs...)
 		if items != nil {
 			for _, v := range *items {
 				switch Int64All(v["itype"]) {
@@ -548,7 +551,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	}
 	if isTjProject {
 		entMonitor := NetworkCom.EntMonitor(in.UserId)
-		log.Println(entMonitor)
 		aio := n.AllIntroduceOwner(sqlAppend1, sqlAppend2, args, isTjProject, probusfors, entMonitor)
 		for _, v := range aio.Networks {
 			itype := ""