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

  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. //日志列表
  10. func Loglist(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.Userid = user.Userid
  19. search.Key = ctx.URLParam("searchKey")
  20. search.Val = ctx.URLParam("searchValue")
  21. var pageSize = 10
  22. var pageIndex = 1
  23. size := ctx.URLParam("pageSize")
  24. if size != "" {
  25. pageSize = utils.ValueToInt(size, 0)
  26. }
  27. index := ctx.URLParam("pageIndex")
  28. if index != "" {
  29. pageIndex = utils.ValueToInt(index, 0)
  30. }
  31. limit := int64(pageSize) * (int64(pageIndex)-1)
  32. offet := int64(pageSize) * int64(pageIndex)
  33. logs := new(models.LeitServerLog)
  34. result, count := logs.FindLog(search, limit, offet)
  35. res := make(map[string]interface{})
  36. res["data"] = result
  37. res["count"] = count
  38. res["pageIndex"] = pageIndex
  39. res["pageSize"] = pageSize
  40. supports.Ok(ctx, supports.OptionSuccess, res)
  41. }