mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-03 16:00:25 +08:00
32 lines
831 B
Go
32 lines
831 B
Go
package api
|
|
|
|
import (
|
|
tagapp "mayfly-go/internal/tag/application"
|
|
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("/machines/dashbord", d.Dashbord),
|
|
}
|
|
|
|
return req.NewConfs("", reqs[:]...)
|
|
}
|
|
|
|
func (m *Dashbord) Dashbord(rc *req.Ctx) {
|
|
accountId := rc.GetLoginAccount().Id
|
|
|
|
tagCodePaths := m.tagTreeApp.GetAccountTags(accountId, &tagentity.TagTreeQuery{TypePaths: collx.AsArray(tagentity.NewTypePaths(tagentity.TagTypeMachine, tagentity.TagTypeAuthCert))}).GetCodePaths()
|
|
machineCodes := tagentity.GetCodesByCodePaths(tagentity.TagTypeMachine, tagCodePaths...)
|
|
|
|
rc.ResData = collx.M{
|
|
"machineNum": len(machineCodes),
|
|
}
|
|
}
|