2024-01-23 19:30:28 +08:00
|
|
|
package api
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"mayfly-go/internal/machine/application"
|
|
|
|
|
tagapp "mayfly-go/internal/tag/application"
|
2024-04-09 12:55:51 +08:00
|
|
|
tagentity "mayfly-go/internal/tag/domain/entity"
|
2024-01-23 19:30:28 +08:00
|
|
|
"mayfly-go/pkg/req"
|
|
|
|
|
"mayfly-go/pkg/utils/collx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Dashbord struct {
|
2024-04-17 21:28:28 +08:00
|
|
|
TagTreeApp tagapp.TagTree `inject:""`
|
|
|
|
|
MachineApp application.Machine `inject:""`
|
2024-01-23 19:30:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Dashbord) Dashbord(rc *req.Ctx) {
|
|
|
|
|
accountId := rc.GetLoginAccount().Id
|
2024-04-09 12:55:51 +08:00
|
|
|
|
2024-04-17 21:28:28 +08:00
|
|
|
tagCodePaths := m.TagTreeApp.GetAccountTagCodePaths(accountId, tagentity.TagTypeMachineAuthCert, "")
|
|
|
|
|
machineCodes := tagentity.GetCodeByPath(tagentity.TagTypeMachine, tagCodePaths...)
|
2024-01-23 19:30:28 +08:00
|
|
|
|
|
|
|
|
rc.ResData = collx.M{
|
2024-04-17 21:28:28 +08:00
|
|
|
"machineNum": len(machineCodes),
|
2024-01-23 19:30:28 +08:00
|
|
|
}
|
|
|
|
|
}
|