You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/internal/api/statistics.go

31 lines
834 B

package api
import (
"context"
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user"
"github.com/gin-gonic/gin"
)
func NewStatistics(discov discoveryregistry.SvcDiscoveryRegistry) *Statistics {
return &Statistics{discov: discov}
}
type Statistics struct {
discov discoveryregistry.SvcDiscoveryRegistry
}
func (s *Statistics) userClient(ctx context.Context) (user.UserClient, error) {
conn, err := s.discov.GetConn(ctx, config.Config.RpcRegisterName.OpenImUserName)
if err != nil {
return nil, err
}
return user.NewUserClient(conn), nil
}
func (s *Statistics) UserRegister(c *gin.Context) {
a2r.Call(user.UserClient.UserRegisterCount, s.userClient, c)
}