45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package sysin
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
type ImDashboardOverviewInp struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
}
|
|
|
|
type ImDashboardOverviewModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantName string `json:"tenantName" dc:"租户名称"`
|
|
TotalUsers int64 `json:"totalUsers" dc:"总用户数"`
|
|
ActiveUsers int64 `json:"activeUsers" dc:"活跃用户数"`
|
|
TotalGroups int64 `json:"totalGroups" dc:"总群组数"`
|
|
TotalConversations int64 `json:"totalConversations" dc:"总会话数"`
|
|
TotalMessages int64 `json:"totalMessages" dc:"总消息数"`
|
|
TodayMessages int64 `json:"todayMessages" dc:"今日消息数"`
|
|
}
|
|
|
|
type ImDashboardTrendsInp struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
Days int `json:"days" dc:"统计天数"`
|
|
}
|
|
|
|
func (in *ImDashboardTrendsInp) Filter(ctx context.Context) error {
|
|
if in.Days == 0 {
|
|
in.Days = 7
|
|
}
|
|
if in.Days < 1 || in.Days > 31 {
|
|
return gerror.New("统计天数必须在1到31天之间")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type ImDashboardTrendModel struct {
|
|
Date *gtime.Time `json:"date" dc:"日期"`
|
|
UserCount int64 `json:"userCount" dc:"新增用户数"`
|
|
MessageCount int64 `json:"messageCount" dc:"新增消息数"`
|
|
}
|