浏览代码

feat:xiugai

wangchuanjin 1 年之前
父节点
当前提交
47767c3ad3
共有 2 个文件被更改,包括 10 次插入6 次删除
  1. 6 3
      api/internal/service/network.go
  2. 4 3
      api/internal/service/network_test.go

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

@@ -480,9 +480,10 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 	if in.Current_page <= 0 {
 		in.Current_page = 1
 	}
+	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
 	sqlAppendArgs := []interface{}{}
 	sqlAppend1 := ""
-	if in.Type != "" {
+	if dbPaging && in.Type != "" {
 		sqlAppend1 += ` and a.itype=?`
 		sqlAppendArgs = append(sqlAppendArgs, n.TypeStrConvert(in.Type))
 	}
@@ -510,7 +511,6 @@ 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
 	args := []interface{}{in.PositionId, in.PositionId, in.PositionId}
 	args = append(args, sqlAppendArgs...)
 	sqlAppend2 := ""
@@ -662,6 +662,9 @@ func (n *network) List(in *types.NetWorkListReq) *types.Reply {
 				case 5:
 					agency_count++
 				}
+				if in.Type != "" && n.TypeStrConvert(in.Type) != v.Itype {
+					continue
+				}
 			}
 			export_url := ""
 			if len(export_id) > 0 {
@@ -994,7 +997,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":

+ 4 - 3
api/internal/service/network_test.go

@@ -106,7 +106,8 @@ func TestNetWorkList(t *testing.T) {
 	initDb()
 	//类型;firstparty:甲方 supplier:供应商 adiffb:同甲异业 middleman:中间人 agency:招标代理机构
 	res := Network.List(&types.NetWorkListReq{
-		UserId: "1205591997",
+		EntAccountId: 64,
+		UserId:       "1205591997",
 		//PositionId: 1205591997,
 		PositionId: 1205592003,
 		//PositionId:   935,
@@ -117,10 +118,10 @@ func TestNetWorkList(t *testing.T) {
 		// Monitorcount_start: 1,
 		// Monitorcount_end:   1,
 		//Monitor:      0,
-		//Project_matchme: 1,
+		Project_matchme: 1,
 		//Starttime: "2024-04-23",
 		//Endtime:   "2024-04-23",
-		//Type: "supplier",
+		Type: "supplier",
 		//Name: "四川",
 	})
 	for k, v := range res.Data.(map[string]interface{}) {