statistics

This commit is contained in:
withchao
2023-06-20 17:03:20 +08:00
parent fe08e8b6c9
commit a1fc6e4e65
17 changed files with 502 additions and 108 deletions
+30
View File
@@ -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)
}