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.

48 lines
1.1 KiB

  1. package controllers
  2. import (
  3. "LAPP_GAAS_GFrame_BACKEND/utils"
  4. "LAPP_GAAS_GFrame_BACKEND/web/middleware/jwts"
  5. "LAPP_GAAS_GFrame_BACKEND/web/models"
  6. "LAPP_GAAS_GFrame_BACKEND/web/supports"
  7. "github.com/kataras/iris/v12"
  8. )
  9. //Buffer列表
  10. func Bufferlist(ctx iris.Context) {
  11. user, ok := jwts.ParseToken(ctx)
  12. utils.TrimStruct(user, *user)
  13. if !ok {
  14. supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
  15. return
  16. }
  17. search := models.SerchData{}
  18. search.Key = ctx.URLParam("searchKey")
  19. search.Val = ctx.URLParam("searchValue")
  20. var pageSize = 10
  21. var pageIndex = 1
  22. size := ctx.URLParam("pageSize")
  23. if size != "" {
  24. pageSize = utils.ValueToInt(size, 0)
  25. }
  26. index := ctx.URLParam("pageIndex")
  27. if index != "" {
  28. pageIndex = utils.ValueToInt(index, 0)
  29. }
  30. limit := int64(pageSize) * (int64(pageIndex)-1)
  31. offet := int64(pageSize) * int64(pageIndex)
  32. logs := new(models.Buffer)
  33. result, count := logs.FindList(search, limit, offet)
  34. res := make(map[string]interface{})
  35. res["data"] = result
  36. res["count"] = count
  37. res["pageIndex"] = pageIndex
  38. res["pageSize"] = pageSize
  39. supports.Ok(ctx, supports.OptionSuccess, res)
  40. }