Files
mayfly-go/server/internal/redis/api/dashbord.go

32 lines
661 B
Go
Raw Normal View History

package api
import (
tagapp "mayfly-go/internal/tag/application"
2024-11-23 17:23:18 +08:00
tagentity "mayfly-go/internal/tag/domain/entity"
"mayfly-go/pkg/req"
"mayfly-go/pkg/utils/collx"
)
type Dashbord struct {
tagTreeApp tagapp.TagTree `inject:"T"`
}
func (d *Dashbord) ReqConfs() *req.Confs {
reqs := [...]*req.Conf{
req.NewGet("/redis/dashbord", d.Dashbord),
}
return req.NewConfs("", reqs[:]...)
}
func (d *Dashbord) Dashbord(rc *req.Ctx) {
accountId := rc.GetLoginAccount().Id
redisNum := len(d.tagTreeApp.GetAccountTags(accountId, &tagentity.TagTreeQuery{
2024-11-23 17:23:18 +08:00
Types: collx.AsArray(tagentity.TagTypeRedis),
}))
rc.ResData = collx.M{
"redisNum": redisNum,
}
}