12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package controllers
- import (
- "ColdVerify_local/conf"
- "ColdVerify_local/lib"
- "ColdVerify_local/models/System"
- beego "github.com/beego/beego/v2/server/web"
- "math"
- )
- type LogsController struct {
- beego.Controller
- }
- // 列表 -
- func (c *LogsController) List() {
- var log_jsons lib.LOG_JSONS
- page, _ := c.GetInt("page")
- if page < 1 {
- page = 1
- }
- page_z, _ := c.GetInt("page_z")
- if page_z < 1 {
- page_z = conf.Page_size
- }
- Class_1 := c.GetString("Class_1")
- var cnt int64
- List, cnt := System.Read_Logs_ALL(page, page_z, Class_1)
- page_size := math.Ceil(float64(cnt) / float64(page_z))
- log_jsons.Class_1 = Class_1
- log_jsons.Class_List = System.Read_Logs_Class()
- log_jsons.List = List
- log_jsons.Page = page
- log_jsons.Page_size = int(page_size)
- log_jsons.Pages = lib.Func_page(int64(page), int64(page_size))
- log_jsons.Num = int(cnt)
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: log_jsons}
- c.ServeJSON()
- return
- }
- // 列表 -
- func (c *LogsController) UserLogs() {
- var log_jsons lib.LOG_JSONS
- page, _ := c.GetInt("page")
- if page < 1 {
- page = 1
- }
- page_z, _ := c.GetInt("page_z")
- if page_z < 1 {
- page_z = conf.Page_size
- }
- Class_1 := c.GetString("Class_1")
- var cnt int64
- List, cnt := System.Read_UserLogs_ALL(page, page_z, Class_1)
- page_size := math.Ceil(float64(cnt) / float64(page_z))
- log_jsons.Class_1 = Class_1
- log_jsons.Class_List = System.Read_UserLogs_Class()
- log_jsons.List = List
- log_jsons.Page = page
- log_jsons.Page_size = int(page_size)
- log_jsons.Pages = lib.Func_page(int64(page), int64(page_size))
- log_jsons.Num = int(cnt)
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: log_jsons}
- c.ServeJSON()
- return
- }
- func (c *LogsController) Ping() {
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
- c.ServeJSON()
- return
- }
|