liujiandao
2023-12-19 981681b3cc96d3f8e90ce5e358e1540d02f9f5d9
api/v1/product.go
@@ -62,6 +62,16 @@
      ProductNumber: params.ProductNumber,
      ProductName:   params.ProductName,
   })
   if err != nil {
      logx.Errorf("grpc GetProductList err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
   if getProductListResponse.Code != 0 {
      logx.Errorf("grpc GetProductList err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
   rawProductList := getProductListResponse.List
   productList := make([]model.Product, len(rawProductList))
@@ -74,16 +84,6 @@
      productList[k].Unit = v.Unit
   }
   if err != nil {
      logx.Errorf("GetProductList err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
   if getProductListResponse.Code != 0 {
      logx.Errorf("GetProductList err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
   ctx.OkWithDetailed(response.ListResponse{
      Data:  productList,
      Count: getProductListResponse.Total,
@@ -109,12 +109,12 @@
   getProductInfoResponse, err := cli.GetProductInfo(ctx.GetCtx(), &product.GetProductInfoRequest{ProductId: productId})
   if err != nil {
      logx.Errorf("GetProductInfo err: %v", err.Error())
      logx.Errorf(" grpc GetProductInfo err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
   if getProductInfoResponse.Code != 0 {
      logx.Errorf("GetProductInfo err: %v", err.Error())
      logx.Errorf("grpc GetProductInfo err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }
@@ -143,7 +143,7 @@
   client := product.NewProductServiceClient(grpc_init.CrmApsGrpcServiceConn)
   info, err := client.GetProductOrder(ctx.GetCtx(), &product.GetProductOrderRequest{SalesDetailsNumber: number})
   if err != nil {
      logx.Errorf("GetProductOrder err: %v", err.Error())
      logx.Errorf("grpc GetProductOrder err: %v", err.Error())
      ctx.FailWithMsg(ecode.UnknownErr, "内部错误")
      return
   }