GAAS GFrame项目web后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB

package controllers
import (
"LAPP_GAAS_GFrame_BACKEND/utils"
"LAPP_GAAS_GFrame_BACKEND/web/middleware/jwts"
"LAPP_GAAS_GFrame_BACKEND/web/models"
"LAPP_GAAS_GFrame_BACKEND/web/supports"
"github.com/kataras/iris/v12"
)
//日志列表
func Loglist(ctx iris.Context) {
user, ok := jwts.ParseToken(ctx)
utils.TrimStruct(user, *user)
if !ok {
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
return
}
search := models.SerchData{}
search.Userid = user.Userid
search.Key = ctx.URLParam("searchKey")
search.Val = ctx.URLParam("searchValue")
var pageSize = 10
var pageIndex = 1
size := ctx.URLParam("pageSize")
if size != "" {
pageSize = utils.ValueToInt(size, 0)
}
index := ctx.URLParam("pageIndex")
if index != "" {
pageIndex = utils.ValueToInt(index, 0)
}
limit := int64(pageSize) * (int64(pageIndex)-1)
offet := int64(pageSize) * int64(pageIndex)
logs := new(models.LeitServerLog)
result, count := logs.FindLog(search, limit, offet)
res := make(map[string]interface{})
res["data"] = result
res["count"] = count
res["pageIndex"] = pageIndex
res["pageSize"] = pageSize
supports.Ok(ctx, supports.OptionSuccess, res)
}