| | |
| | | } |
| | | } |
| | | |
| | | func CloseProductServiceConn() { |
| | | if productServiceConn != nil { |
| | | productServiceConn.Close() |
| | | } |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags 产品 |
| | |
| | | } |
| | | |
| | | cli := product.NewProductServiceClient(productServiceConn) |
| | | |
| | | getProductListResponse, err := cli.GetProductList(ctx.GetCtx(), &product.GetProductListRequest{ |
| | | Page: cast.ToInt32(params.Page), |
| | | PageSize: cast.ToInt32(params.PageSize), |
| | |
| | | productId := c.Query("productNumber") |
| | | cli := product.NewProductServiceClient(productServiceConn) |
| | | |
| | | getProductInfoResponse, err := cli.GetProductInfo(ctx.GetCtx(), &product.GetProductInfoRequest{ProductId: productId}, nil) |
| | | getProductInfoResponse, err := cli.GetProductInfo(ctx.GetCtx(), &product.GetProductInfoRequest{ProductId: productId}) |
| | | if err != nil { |
| | | logx.Errorf("GetProductInfo err: %v", err.Error()) |
| | | ctx.FailWithMsg(ecode.UnknownErr, "内部错误") |
| | |
| | | ctx.FailWithMsg(ecode.UnknownErr, "内部错误") |
| | | return |
| | | } |
| | | ctx.OkWithDetailed(contextx.Response{ |
| | | Data: getProductInfoResponse.Data, |
| | | }) |
| | | ctx.OkWithDetailed(getProductInfoResponse.Data) |
| | | } |