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" ) //Buffer列表 func Bufferlist(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.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.Buffer) result, count := logs.FindList(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) }