29 lines
943 B
Go
29 lines
943 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
walletv1 "hyapp.local/api/proto/wallet/v1"
|
|
"hyapp/pkg/appcode"
|
|
"hyapp/pkg/xerr"
|
|
"hyapp/services/wallet-service/internal/domain/ledger"
|
|
)
|
|
|
|
// GetHostRevenueStats 返回钱包账本内的 POINT 收益、兑换和去重送礼用户。
|
|
func (s *Server) GetHostRevenueStats(ctx context.Context, req *walletv1.GetHostRevenueStatsRequest) (*walletv1.GetHostRevenueStatsResponse, error) {
|
|
ctx = appcode.WithContext(ctx, req.GetAppCode())
|
|
stats, err := s.svc.GetHostRevenueStats(ctx, req.GetAppCode(), ledger.HostRevenueStatsQuery{
|
|
HostUserID: req.GetHostUserId(),
|
|
StartAtMS: req.GetStartAtMs(),
|
|
EndAtMS: req.GetEndAtMs(),
|
|
})
|
|
if err != nil {
|
|
return nil, xerr.ToGRPCError(err)
|
|
}
|
|
return &walletv1.GetHostRevenueStatsResponse{Stats: &walletv1.HostRevenueStats{
|
|
DiamondEarnings: stats.DiamondEarnings,
|
|
DiamondExchanged: stats.DiamondExchanged,
|
|
GiftSenders: stats.GiftSenders,
|
|
}}, nil
|
|
}
|