Skip to content

Commit

Permalink
remove newuserCount
Browse files Browse the repository at this point in the history
Signed-off-by: hanzhixiao <[email protected]>
  • Loading branch information
hanzhixiao committed Aug 2, 2023
1 parent 296eb18 commit be2faff
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 447 deletions.
4 changes: 0 additions & 4 deletions internal/api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,6 @@ func (o *AdminApi) SearchApplet(c *gin.Context) {
a2r.Call(admin.AdminClient.SearchApplet, o.adminClient, c)
}

func (o *AdminApi) NewUserCount(c *gin.Context) {
a2r.Call(chat.ChatClient.NewUserCount, o.chatClient, c)
}

func (o *AdminApi) LoginUserCount(c *gin.Context) {
a2r.Call(chat.ChatClient.UserLoginCount, o.chatClient, c)
}
1 change: 0 additions & 1 deletion internal/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,5 @@ func NewAdminRoute(router gin.IRouter, discov discoveryregistry.SvcDiscoveryRegi
initGroup.POST("/del", admin.DelClientConfig) // 删除客户端初始化配置

statistic := router.Group("/statistic", mw.CheckAdmin)
statistic.POST("/new_user_count", admin.NewUserCount)
statistic.POST("/login_user_count", admin.LoginUserCount)
}
24 changes: 0 additions & 24 deletions internal/rpc/chat/statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@ import (
"time"
)

func (o *chatSvr) NewUserCount(ctx context.Context, req *chat.NewUserCountReq) (*chat.NewUserCountResp, error) {
resp := &chat.NewUserCountResp{}
if req.Start > req.End {
return nil, errs.ErrArgs.Wrap("start > end")
}
total, err := o.Database.NewUserCountTotal(ctx, nil)
if err != nil {
return nil, err
}
start := time.UnixMilli(req.Start)
before, err := o.Database.NewUserCountTotal(ctx, &start)
if err != nil {
return nil, err
}
end := time.UnixMilli(req.End)
count, err := o.Database.NewUserCountRangeEverydayTotal(ctx, &start, &end)
if err != nil {
return nil, err
}
resp.Total = total
resp.Before = before
resp.Count = count
return resp, nil
}
func (o *chatSvr) UserLoginCount(ctx context.Context, req *chat.UserLoginCountReq) (*chat.UserLoginCountResp, error) {
resp := &chat.UserLoginCountResp{}
if req.Start > req.End {
Expand Down
5 changes: 0 additions & 5 deletions pkg/common/db/database/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ type ChatDatabaseInterface interface {
UpdatePassword(ctx context.Context, userID string, password string) error
UpdatePasswordAndDeleteVerifyCode(ctx context.Context, userID string, password string, code uint) error
NewUserCountTotal(ctx context.Context, before *time.Time) (int64, error)
NewUserCountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, error)
UserLoginCountTotal(ctx context.Context, before *time.Time) (int64, error)
UserLoginCountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, int64, error)
}
Expand Down Expand Up @@ -226,10 +225,6 @@ func (o *ChatDatabase) NewUserCountTotal(ctx context.Context, before *time.Time)
return o.register.CountTotal(ctx, before)
}

func (o *ChatDatabase) NewUserCountRangeEverydayTotal(ctx context.Context, start *time.Time, end *time.Time) (map[string]int64, error) {
return o.register.CountRangeEverydayTotal(ctx, start, end)
}

func (o *ChatDatabase) UserLoginCountTotal(ctx context.Context, before *time.Time) (int64, error) {
return o.userLoginRecord.CountTotal(ctx, before)
}
Expand Down
Loading

0 comments on commit be2faff

Please sign in to comment.