-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.go
50 lines (39 loc) · 992 Bytes
/
index.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package index
import (
//"log"
"opms/controllers"
. "opms/models/index"
"github.com/astaxie/beego"
"github.com/astaxie/beego/utils/pagination"
)
//主页
type MainController struct {
controllers.BaseController
}
func (this *MainController) Get() {
//权限检测
// if !strings.Contains(this.GetSession("userPermission").(string), "alarm-manage") {
// this.Abort("401")
// }
page, err := this.GetInt("p")
if err != nil {
page = 1
}
offset, err1 := beego.AppConfig.Int("pageoffset")
if err1 != nil {
offset = 15
}
alias := this.GetString("alias")
host := this.GetString("host")
condArr := make(map[string]string)
condArr["alias"] = alias
condArr["host"] = host
countDb := CountDb(condArr)
paginator := pagination.SetPaginator(this.Ctx, offset, countDb)
_, _, db := ListDbStatus(condArr, page, offset)
this.Data["paginator"] = paginator
this.Data["condArr"] = condArr
this.Data["db"] = db
this.Data["countDb"] = countDb
this.TplName = "index.tpl"
}