package paygrpc import ( "context" "time" gatewaypb "chatappgateway/api/proto" ) // Client 封装支付服务 gRPC client,并统一超时控制。 type Client struct { timeout time.Duration client gatewaypb.ChatAppPayClient } // New 根据底层 gRPC client 构造支付服务调用器。 func New(client gatewaypb.ChatAppPayClient, timeout time.Duration) *Client { return &Client{ timeout: timeout, client: client, } } // QueryOrder 调用支付服务最小订单查询接口。 func (c *Client) QueryOrder(ctx context.Context, request *gatewaypb.QueryOrderRequest) (*gatewaypb.QueryOrderResponse, error) { callCtx, cancel := context.WithTimeout(ctx, c.timeout) defer cancel() return c.client.QueryOrder(callCtx, request) }