SysLogs.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package controllers
  2. import (
  3. "ERP_user/conf"
  4. "ERP_user/models/Account"
  5. "ERP_user/models/System"
  6. "git.baozhida.cn/ERP_libs/lib"
  7. beego "github.com/beego/beego/v2/server/web"
  8. "math"
  9. )
  10. type SysLogsController struct {
  11. beego.Controller
  12. User Account.User
  13. }
  14. func (c *SysLogsController) Prepare() {
  15. c.User = *Account.User_r
  16. }
  17. // 列表 -
  18. func (c *SysLogsController) List() {
  19. // 分页参数 初始化
  20. page, _ := c.GetInt("page")
  21. if page < 1 {
  22. page = 1
  23. }
  24. page_z, _ := c.GetInt("page_z")
  25. if page_z < 1 {
  26. page_z = conf.Page_size
  27. }
  28. // 查询
  29. T_class := c.GetString("T_class")
  30. T_title := c.GetString("T_title")
  31. R_List, R_cnt := System.Read_SysLogs_List(T_class, T_title, page, page_z)
  32. var r_jsons lib.R_JSONS
  33. r_jsons.Num = R_cnt
  34. r_jsons.Data = R_List
  35. r_jsons.Page = page
  36. r_jsons.Page_size = int(math.Ceil(float64(R_cnt) / float64(page_z)))
  37. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
  38. c.ServeJSON()
  39. return
  40. }
  41. // 列表 -
  42. func (c *SysLogsController) List_DISTINCT_Class() {
  43. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: System.Read_SysLogs_Class()}
  44. c.ServeJSON()
  45. return
  46. }