UserLogs.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package controllers
  2. import (
  3. "ERP_user/conf"
  4. "ERP_user/models/Account"
  5. "ERP_user/models/System"
  6. beego "github.com/beego/beego/v2/server/web"
  7. "gogs.baozhida.cn/zoie/ERP_libs/lib"
  8. "math"
  9. )
  10. type UserLogsController struct {
  11. beego.Controller
  12. User Account.User
  13. }
  14. func (c *UserLogsController) Prepare() {
  15. c.User = *Account.User_r
  16. }
  17. // 列表 -
  18. func (c *UserLogsController) 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_UserLogs_List(c.User.T_uuid, T_class, T_title, page, page_z)
  32. // 封装 返回数据
  33. type R_JSONS struct {
  34. //必须的大写开头
  35. Lite []System.UserLogs_R
  36. Num int64
  37. Page int
  38. Page_size int
  39. }
  40. var r_jsons R_JSONS
  41. r_jsons.Num = R_cnt
  42. r_jsons.Lite = R_List
  43. r_jsons.Page = page
  44. r_jsons.Page_size = int(math.Ceil(float64(R_cnt) / float64(page_z)))
  45. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
  46. c.ServeJSON()
  47. return
  48. }
  49. // 列表 -
  50. func (c *UserLogsController) List_DISTINCT_Class() {
  51. c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: System.Read_UserLogs_Class()}
  52. c.ServeJSON()
  53. return
  54. }