Просмотр исходного кода

Merge branch 'dev1.0.0' of https://app.yhyue.com/moapp/jyInfo into dev1.0.0

duxin 3 лет назад
Родитель
Сommit
46027adc5c

+ 0 - 3
api/info.go

@@ -1,7 +1,6 @@
 package main
 
 import (
-	"flag"
 	"fmt"
 	c "jyInfo/api/common"
 	"jyInfo/api/internal/handler"
@@ -18,8 +17,6 @@ import (
 )
 
 func main() {
-	flag.Parse()
-
 	closeNotify, err := node.NewNode(c.C.Gateway.Etcd...).Register(c.C.Gateway.ServerCode, mc.InterfaceToStr(c.C.Port))
 	if err != nil {
 		panic(err)

+ 0 - 13
api/internal/logic/supplysearchlogic.go

@@ -3,7 +3,6 @@ package logic
 import (
 	"context"
 	"jyInfo/rpc/consumer/consumer"
-	"strings"
 
 	"app.yhyue.com/moapp/jybase/common"
 
@@ -28,18 +27,6 @@ func NewSupplySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Supp
 }
 
 func (l *SupplySearchLogic) SupplySearch(req *types.PubSupplyInfoReq) (resp *types.CommonRes, err error) {
-	//默认每页五十条
-	if req.PageSize == 0 {
-		req.PageSize = 50
-	}
-	//默认第一页
-	if req.PageIndex == 0 {
-		req.PageIndex = 1
-	}
-	//空格多个关键词
-	if strings.Contains(req.Keywords, "+") {
-		req.Keywords = strings.ReplaceAll(req.Keywords, " ", "+")
-	}
 	supplySearch, err0 := l.svcCtx.Consumer.SupplyInfoSearch(l.ctx, &consumer.SupplyInfoSearchReq{
 		Keywords:   req.Keywords,
 		SearchType: req.SearchType,

+ 3 - 2
rpc/common/common.go

@@ -1,12 +1,13 @@
 package main
 
 import (
-	mc "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/endless"
 	"fmt"
 	"jyInfo/rpc/util"
 	"log"
 
+	mc "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/endless"
+
 	IC "jyInfo/rpc/common/init"
 	"jyInfo/rpc/common/internal/server"
 	"jyInfo/rpc/common/internal/svc"

+ 17 - 2
rpc/consumer/internal/logic/supplyinfosearchlogic.go

@@ -1,10 +1,13 @@
 package logic
 
 import (
-	se "app.yhyue.com/moapp/jybase/encrypt"
 	"context"
 	"jyInfo/rpc/model/es"
 	"log"
+	"strconv"
+	"strings"
+
+	se "app.yhyue.com/moapp/jybase/encrypt"
 
 	"jyInfo/rpc/consumer/consumer"
 	"jyInfo/rpc/consumer/internal/svc"
@@ -29,6 +32,18 @@ func NewSupplyInfoSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 
 // 供应信息查询
 func (l *SupplyInfoSearchLogic) SupplyInfoSearch(in *consumer.SupplyInfoSearchReq) (*consumer.SupplyInfoSearchResp, error) {
+	//默认每页五十条
+	if in.PageSize == 0 {
+		in.PageSize = 50
+	}
+	//默认第一页
+	if in.PageIndex == 0 {
+		in.PageIndex = 1
+	}
+	//空格多个关键词
+	if strings.Contains(in.Keywords, "+") {
+		in.Keywords = strings.ReplaceAll(in.Keywords, " ", "+")
+	}
 	list, total := model.GetSupplyInfoList(in)
 	var infos []*consumer.SupplyList
 	if len(*list) > 0 {
@@ -46,7 +61,7 @@ func (l *SupplyInfoSearchLogic) SupplyInfoSearch(in *consumer.SupplyInfoSearchRe
 				Id:          se.SE.EncodeString(common.InterfaceToStr(v["_id"])),
 				Province:    common.InterfaceToStr(v["province"]),
 				City:        common.InterfaceToStr(v["city"]),
-				PublishTime: common.InterfaceToStr(v["publish_time"]),
+				PublishTime: strconv.FormatInt(common.Int64All(v["publish_time"]), 10),
 				Highlight:   detail,
 			}
 			infos = append(infos, &info)

+ 3 - 2
rpc/manager/manager.go

@@ -1,12 +1,13 @@
 package main
 
 import (
-	mc "app.yhyue.com/moapp/jybase/common"
-	"app.yhyue.com/moapp/jybase/endless"
 	"fmt"
 	"jyInfo/rpc/util"
 	"log"
 
+	mc "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/endless"
+
 	IC "jyInfo/rpc/manager/init"
 	"jyInfo/rpc/manager/internal/server"
 	"jyInfo/rpc/manager/internal/svc"

+ 3 - 0
rpc/util/customInterceptors.go

@@ -30,6 +30,9 @@ func CustomInterceptors(ctx context.Context, req interface{}, info *grpc.UnarySe
 	resp, err = handler(ctx, req)
 	fmt.Println("返回值", resp, err, appId)
 	respByte, err := json.Marshal(resp)
+	if len(respByte) > 200 {
+		respByte = respByte[:200]
+	}
 	if err != nil {
 		log.Println("---resp----:", err)
 	}