Documentation
¶
Index ¶
- type ConsoleRepo
- type ConsoleUsecase
- func (uc *ConsoleUsecase) QueryRevenueStatistics(ctx context.Context) (*RevenueStatisticsResponse, error)
- func (uc *ConsoleUsecase) QueryServerTotalData(ctx context.Context) (*ServerTotalDataResponse, error)
- func (uc *ConsoleUsecase) QueryTicketWaitReply(ctx context.Context) (*TicketWaitReplyResponse, error)
- func (uc *ConsoleUsecase) QueryUserStatistics(ctx context.Context) (*UserStatisticsResponse, error)
- type OrdersTotal
- type OrdersTotalWithDate
- type RevenueStatisticsResponse
- type ServerTotalDataResponse
- type ServerTrafficData
- type TicketWaitReplyResponse
- type UserStatistics
- type UserStatisticsResponse
- type UserTrafficData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsoleRepo ¶
type ConsoleRepo interface {
// Revenue Statistics
QueryDateOrders(ctx context.Context, date time.Time) (*OrdersTotal, error)
QueryMonthlyOrders(ctx context.Context, date time.Time) (*OrdersTotal, error)
QueryTotalOrders(ctx context.Context) (*OrdersTotal, error)
QueryDailyOrdersList(ctx context.Context, date time.Time) ([]*OrdersTotalWithDate, error)
QueryMonthlyOrdersList(ctx context.Context, date time.Time) ([]*OrdersTotalWithDate, error)
// User Statistics
QueryRegisterUserTotalByDate(ctx context.Context, date time.Time) (int, error)
QueryRegisterUserTotalByMonthly(ctx context.Context, date time.Time) (int, error)
QueryRegisterUserTotal(ctx context.Context) (int, error)
QueryDateUserCounts(ctx context.Context, date time.Time) (newUsers int64, renewalUsers int64, err error)
QueryMonthlyUserCounts(ctx context.Context, date time.Time) (newUsers int64, renewalUsers int64, err error)
QueryTotalUserCounts(ctx context.Context) (newUsers int64, renewalUsers int64, err error)
QueryDailyUserStatisticsList(ctx context.Context, date time.Time) ([]*UserStatistics, error)
QueryMonthlyUserStatisticsList(ctx context.Context, date time.Time) ([]*UserStatistics, error)
// Ticket Statistics
QueryWaitReplyTotal(ctx context.Context) (int, error)
// Server Statistics
QueryOnlineServers(ctx context.Context) (int, error)
QueryOfflineServers(ctx context.Context) (int, error)
QueryOnlineUsers(ctx context.Context) (int, error)
QueryTodayTraffic(ctx context.Context, date time.Time) (upload int64, download int64, err error)
QueryMonthlyTraffic(ctx context.Context, date time.Time) (upload int64, download int64, err error)
QueryTodayUserTrafficRanking(ctx context.Context, date time.Time) ([]*UserTrafficData, error)
QueryYesterdayUserTrafficRanking(ctx context.Context, date time.Time) ([]*UserTrafficData, error)
QueryTodayServerTrafficRanking(ctx context.Context, date time.Time) ([]*ServerTrafficData, error)
QueryYesterdayServerTrafficRanking(ctx context.Context, date time.Time) ([]*ServerTrafficData, error)
}
ConsoleRepo defines the repository interface for console operations
type ConsoleUsecase ¶
type ConsoleUsecase struct {
// contains filtered or unexported fields
}
ConsoleUsecase handles console business logic
func NewConsoleUsecase ¶
func NewConsoleUsecase(repo ConsoleRepo, logger log.Logger) *ConsoleUsecase
NewConsoleUsecase creates a new console usecase
func (*ConsoleUsecase) QueryRevenueStatistics ¶
func (uc *ConsoleUsecase) QueryRevenueStatistics(ctx context.Context) (*RevenueStatisticsResponse, error)
QueryRevenueStatistics queries revenue statistics
func (*ConsoleUsecase) QueryServerTotalData ¶
func (uc *ConsoleUsecase) QueryServerTotalData(ctx context.Context) (*ServerTotalDataResponse, error)
QueryServerTotalData queries server total data
func (*ConsoleUsecase) QueryTicketWaitReply ¶
func (uc *ConsoleUsecase) QueryTicketWaitReply(ctx context.Context) (*TicketWaitReplyResponse, error)
QueryTicketWaitReply queries waiting reply ticket count
func (*ConsoleUsecase) QueryUserStatistics ¶
func (uc *ConsoleUsecase) QueryUserStatistics(ctx context.Context) (*UserStatisticsResponse, error)
QueryUserStatistics queries user statistics
type OrdersTotal ¶
type OrdersTotal struct {
AmountTotal int `json:"amount_total"`
NewOrderAmount int `json:"new_order_amount"`
RenewalOrderAmount int `json:"renewal_order_amount"`
List []*OrdersTotalWithDate `json:"list,omitempty"`
}
OrdersTotal represents order statistics totals
type OrdersTotalWithDate ¶
type OrdersTotalWithDate struct {
Date string `json:"date"`
AmountTotal int `json:"amount_total"`
NewOrderAmount int `json:"new_order_amount"`
RenewalOrderAmount int `json:"renewal_order_amount"`
}
OrdersTotalWithDate represents order statistics with date
type RevenueStatisticsResponse ¶
type RevenueStatisticsResponse struct {
Today *OrdersTotal `json:"today"`
Monthly *OrdersTotal `json:"monthly"`
All *OrdersTotal `json:"all"`
}
type ServerTotalDataResponse ¶
type ServerTotalDataResponse struct {
OnlineUsers int `json:"online_users"`
OnlineServers int `json:"online_servers"`
OfflineServers int `json:"offline_servers"`
TodayUpload int `json:"today_upload"`
TodayDownload int `json:"today_download"`
MonthlyUpload int `json:"monthly_upload"`
MonthlyDownload int `json:"monthly_download"`
UpdatedAt int64 `json:"updated_at"`
ServerTrafficRankingToday []*ServerTrafficData `json:"server_traffic_ranking_today,omitempty"`
ServerTrafficRankingYesterday []*ServerTrafficData `json:"server_traffic_ranking_yesterday,omitempty"`
UserTrafficRankingToday []*UserTrafficData `json:"user_traffic_ranking_today,omitempty"`
UserTrafficRankingYesterday []*UserTrafficData `json:"user_traffic_ranking_yesterday,omitempty"`
}
type ServerTrafficData ¶
type ServerTrafficData struct {
ServerID int `json:"server_id"`
Name string `json:"name"`
Upload int `json:"upload"`
Download int `json:"download"`
}
ServerTrafficData represents server traffic ranking data
type TicketWaitReplyResponse ¶
type TicketWaitReplyResponse struct {
Count int `json:"count"`
}
type UserStatistics ¶
type UserStatistics struct {
Date string `json:"date,omitempty"`
Register int `json:"register"`
NewOrderUsers int `json:"new_order_users"`
RenewalOrderUsers int `json:"renewal_order_users"`
List []*UserStatistics `json:"list,omitempty"`
}
UserStatistics represents user statistics
type UserStatisticsResponse ¶
type UserStatisticsResponse struct {
Today *UserStatistics `json:"today"`
Monthly *UserStatistics `json:"monthly"`
All *UserStatistics `json:"all"`
}
type UserTrafficData ¶
type UserTrafficData struct {
SID int `json:"sid"`
Upload int `json:"upload"`
Download int `json:"download"`
}
UserTrafficData represents user traffic ranking data
Click to show internal directories.
Click to hide internal directories.