Browse Source

feat:xiugai

wangchuanjin 1 năm trước cách đây
mục cha
commit
96995bc764
2 tập tin đã thay đổi với 10 bổ sung13 xóa
  1. 5 8
      api/internal/service/network.go
  2. 5 5
      api/internal/service/network_test.go

+ 5 - 8
api/internal/service/network.go

@@ -4,7 +4,6 @@ import (
 	"context"
 	"database/sql"
 	"fmt"
-	"log"
 	"math"
 	"sort"
 	"strings"
@@ -483,10 +482,6 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	}
 	sqlAppendArgs := []interface{}{}
 	sqlAppend1 := ""
-	if in.Type != "" {
-		sqlAppend1 += ` and a.itype=?`
-		sqlAppendArgs = append(sqlAppendArgs, n.TypeStrConvert(in.Type))
-	}
 	if in.Starttime != "" {
 		sqlAppend1 += ` and a.create_time>=?`
 		sqlAppendArgs = append(sqlAppendArgs, in.Starttime+" 00:00:00")
@@ -507,7 +502,7 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	var count int64
 	start := (in.Current_page - 1) * in.Page_size
 	end := start + in.Page_size
-	dbPaging := in.Buyercount_start == 0 && in.Buyercount_end == 0 && in.Monitor == 0 && in.Monitorcount_start == 0 && in.Monitorcount_end == 0 && in.Project_matchme == 0 && in.Order_amount == 0
+	dbPaging := in.Buyercount_start == 0 && in.Buyercount_end == 0 && in.Monitor == 0 && in.Monitorcount_start == 0 && in.Monitorcount_end == 0 && in.Project_matchme == 0 && in.Order_amount == 0 && in.Type == ""
 	args := []interface{}{in.PositionId, in.PositionId, in.PositionId}
 	args = append(args, sqlAppendArgs...)
 	sqlAppend2 := ""
@@ -531,7 +526,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 := ""
@@ -640,6 +634,9 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 			case 5:
 				agency_count++
 			}
+			if in.Type != "" && v.Itype != n.TypeStrConvert(in.Type) {
+				continue
+			}
 			export_url := ""
 			if len(export_id) > 0 {
 				exportIdRepeat := map[string]bool{}
@@ -971,7 +968,7 @@ func (n *network) Introduce_Middleman(values []string, entMonitor map[string]boo
 }
 
 //
-func (n *network) TypeStrConvert(itype string) int {
+func (n *network) TypeStrConvert(itype string) int64 {
 	//firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
 	switch itype {
 	case "firstparty":

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

@@ -110,7 +110,7 @@ func TestNetWorkList(t *testing.T) {
 		PositionId: 1205591997,
 		//PositionId:   935,
 		Current_page: 1,
-		Page_size:    100,
+		Page_size:    10,
 		//PositionId: 935,
 		//PositionId: 1205591998,
 		//Order_amount: -1,
@@ -120,8 +120,8 @@ func TestNetWorkList(t *testing.T) {
 		//Project_matchme: 1,
 		//Starttime: "2024-04-23",
 		//Endtime:   "2024-04-23",
-		//Type: "firstparty",
-		//Name: "三亚市",
+		Type: "supplier",
+		Name: "四川",
 	})
 	for k, v := range res.Data.(map[string]interface{}) {
 		if k == "list" {
@@ -140,8 +140,8 @@ func TestAllProject(t *testing.T) {
 		//PositionId:   935,
 		PositionId: 1205591997, //刘苗
 		//PositionId: 1205592003,//刘亚丽
-		//Id:         "b57d8f87b1d748dab5b200a6f1da0d37",
-		//Type:       "firstparty",
+		Id:   "87028422487e44e68c5531bc2c6f9528",
+		Type: "firstparty",
 	})
 	b, _ := json.Marshal(res.Data)
 	log.Println(string(b))