首页图表可查看用户组下的在线数、网络吞吐量

This commit is contained in:
lanrenwo
2022-09-18 16:17:11 +08:00
parent 5586b27319
commit 48bebadc6b
7 changed files with 179 additions and 14 deletions

View File

@@ -32,6 +32,11 @@ type ValData struct {
Note string `json:"note"`
}
type GroupNameId struct {
Id int `json:"id"`
Name string `json:"name"`
}
// type Group struct {
// Id int `json:"id" xorm:"pk autoincr not null"`
// Name string `json:"name" xorm:"varchar(60) not null unique"`
@@ -64,6 +69,20 @@ func GetGroupNames() []string {
return names
}
func GetGroupNamesIds() []GroupNameId {
var datas []Group
err := Find(&datas, 0, 0)
if err != nil {
base.Error(err)
return nil
}
var names []GroupNameId
for _, v := range datas {
names = append(names, GroupNameId{Id: v.Id, Name: v.Name})
}
return names
}
func SetGroup(g *Group) error {
var err error
if g.Name == "" {