27 lines
911 B
Go
27 lines
911 B
Go
package client
|
||
|
||
import (
|
||
"context"
|
||
|
||
"google.golang.org/grpc"
|
||
luckygiftv1 "hyapp.local/api/proto/luckygift/v1"
|
||
)
|
||
|
||
// LuckyGiftClient abstracts gateway access to lucky-gift-service eligibility checks.
|
||
// gateway-service 只做 App HTTP 协议转换;幸运礼物规则、RTP 和奖池仍由 lucky-gift-service 独占。
|
||
type LuckyGiftClient interface {
|
||
CheckLuckyGift(ctx context.Context, req *luckygiftv1.CheckLuckyGiftRequest) (*luckygiftv1.CheckLuckyGiftResponse, error)
|
||
}
|
||
|
||
type grpcLuckyGiftClient struct {
|
||
client luckygiftv1.LuckyGiftServiceClient
|
||
}
|
||
|
||
func NewGRPCLuckyGiftClient(conn *grpc.ClientConn) LuckyGiftClient {
|
||
return &grpcLuckyGiftClient{client: luckygiftv1.NewLuckyGiftServiceClient(conn)}
|
||
}
|
||
|
||
func (c *grpcLuckyGiftClient) CheckLuckyGift(ctx context.Context, req *luckygiftv1.CheckLuckyGiftRequest) (*luckygiftv1.CheckLuckyGiftResponse, error) {
|
||
return c.client.CheckLuckyGift(ctx, req)
|
||
}
|