67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package adm_controller
|
|
|
|
import (
|
|
"Blog/internal/model/result"
|
|
"Blog/internal/utils"
|
|
|
|
"github.com/kataras/iris/v12"
|
|
"github.com/kataras/iris/v12/mvc"
|
|
"github.com/kataras/iris/v12/sessions"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
/*
|
|
后台admin管理
|
|
*/
|
|
type AdminController struct {
|
|
Ctx iris.Context
|
|
Session *sessions.Session
|
|
}
|
|
|
|
func (ctrl *AdminController) Get() {
|
|
session := ctrl.Session
|
|
user := utils.SessionUtil.GetUser(session)
|
|
if user.Id != "" {
|
|
logrus.Info("[", user.Username, "]进入后台管理")
|
|
}
|
|
ctrl.Ctx.View("/admin/index.html")
|
|
}
|
|
|
|
func (ctrl *AdminController) GetUserInfo() {
|
|
|
|
}
|
|
|
|
// 当天的数据量
|
|
func (ctrl *AdminController) GetToday() {
|
|
ctrl.Ctx.JSON(result.OkMsg("当天的数据量", []any{}))
|
|
}
|
|
|
|
// 最近30天数据
|
|
func (ctrl *AdminController) GetLates30() {
|
|
ctrl.Ctx.JSON(result.OkMsg("最近30天数据", []any{}))
|
|
}
|
|
|
|
// 流量排行
|
|
func (ctrl *AdminController) GetRank() {
|
|
|
|
ctrl.Ctx.JSON(result.OkMsg("流量排行", []any{}))
|
|
}
|
|
|
|
func (ctrl *AdminController) BeforeActivation(activation mvc.BeforeActivation) {
|
|
// logrus.Info("before")
|
|
|
|
}
|
|
|
|
func (ctrl *AdminController) AfterActivation(activation mvc.AfterActivation) {
|
|
// logrus.Info("after")
|
|
}
|
|
|
|
func (ctrl *AdminController) BeginRequest(ctx iris.Context) {
|
|
// logrus.Info("ctx.FullRequestURI(): ", ctx.Request().URL)
|
|
// logrus.Info("Begin")
|
|
}
|
|
|
|
func (ctrl *AdminController) EndRequest(ctx iris.Context) {
|
|
// logrus.Info("End")
|
|
}
|