mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 10:35:59 +08:00
statistics
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user