Logs.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package controllers
  2. import (
  3. "bzd_server/conf"
  4. "bzd_server/lib"
  5. "bzd_server/models/System"
  6. beego "github.com/beego/beego/v2/server/web"
  7. "math"
  8. )
  9. type LogsController struct {
  10. beego.Controller
  11. }
  12. // 列表 -
  13. func (c *LogsController) List() {
  14. page, _ := c.GetInt("page")
  15. println(page)
  16. if page < 1 {
  17. page = 1
  18. }
  19. Class_1 := c.GetString("Class_1")
  20. c.Data["Class_1"] = Class_1
  21. c.Data["Class_List"] = System.Read_Logs_Class()
  22. var cnt int64
  23. c.Data["List"], cnt = System.Read_Logs_ALL(page, Class_1)
  24. page_size := math.Ceil(float64(cnt) / float64(conf.Page_size))
  25. c.Data["Page"] = page
  26. c.Data["Page_size"] = page_size
  27. c.Data["Pages"] = lib.Func_page(int64(page), int64(page_size))
  28. c.Data["cnt"] = cnt
  29. c.TplName = "System/Logs.html"
  30. }
  31. // 列表 -
  32. func (c *LogsController) UserLogs() {
  33. page, _ := c.GetInt("page")
  34. println(page)
  35. if page < 1 {
  36. page = 1
  37. }
  38. Class_1 := c.GetString("Class_1")
  39. c.Data["Class_1"] = Class_1
  40. c.Data["Class_List"] = System.Read_UserLogs_Class()
  41. var cnt int64
  42. c.Data["List"], cnt = System.Read_UserLogs_ALL(page, Class_1)
  43. page_size := math.Ceil(float64(cnt) / float64(conf.Page_size))
  44. c.Data["Page"] = page
  45. c.Data["Page_size"] = page_size
  46. c.Data["Pages"] = lib.Func_page(int64(page), int64(page_size))
  47. c.Data["cnt"] = cnt
  48. c.TplName = "User/UserLogs.html"
  49. }