From 981681b3cc96d3f8e90ce5e358e1540d02f9f5d9 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 19 十二月 2023 16:49:12 +0800
Subject: [PATCH] 错误判断

---
 api/v1/salesDetails.go |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/api/v1/salesDetails.go b/api/v1/salesDetails.go
index abd1dd6..3f6698b 100644
--- a/api/v1/salesDetails.go
+++ b/api/v1/salesDetails.go
@@ -19,6 +19,7 @@
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/credentials/insecure"
 	"strconv"
+	"strings"
 )
 
 type SalesDetailsApi struct{}
@@ -276,6 +277,10 @@
 	client := product_inventory.NewProductInventoryServiceClient(ProductInventoryServiceConn)
 	info, err := client.GetInventoryProductInfo(ctx.GetCtx(), &product_inventory.GetInventoryProductInfoRequest{Number: number})
 	if err != nil {
+		if strings.Contains(err.Error(), "record not found") {
+			ctx.Ok()
+			return
+		}
 		logx.Errorf("GetProductInfo err: %v", err.Error())
 		ctx.FailWithMsg(ecode.UnknownErr, "grpc璋冪敤閿欒")
 		return

--
Gitblit v1.8.0