mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
31 lines
834 B
Go
31 lines
834 B
Go
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)
|
|
}
|