package controllers import ( "SSW_WebPlatform/utils" "SSW_WebPlatform/web/middleware/jwts" "SSW_WebPlatform/web/models" "SSW_WebPlatform/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) }