123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- package controllers
- import (
- "Cold_Api/conf"
- "Cold_Api/controllers/lib"
- "Cold_Api/models/Account"
- "Cold_Api/models/System"
- beego "github.com/beego/beego/v2/server/web"
- "math"
- "strings"
- )
- type LogsController struct {
- beego.Controller
- Admin_r Account.Admin // 登陆的用户
- }
- func (c *LogsController) Prepare() {
- GetCookie := c.Ctx.GetCookie("User_tokey")
- GetString := c.GetString("User_tokey")
- User_tokey := GetCookie
- if len(User_tokey) == 0 {
- User_tokey = GetString
- }
- c.Admin_r = *Account.Admin_r
- }
- // 列表 -
- func (c *LogsController) UserLogsClass() {
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: System.Read_UserLogs_Class()}
- c.ServeJSON()
- return
- }
- // 列表 -
- func (c *LogsController) UserLogsList() {
- type R_JSONS struct {
- //必须的大写开头
- Data []System.UserLogs
- Num int64
- Page int
- Page_size int
- }
- var r_jsons R_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("T_class")
- Class_1 = strings.Replace(Class_1, "\"", "", -1)
- r_jsons.Data, r_jsons.Num = System.Read_UserLogs_ALL(c.Admin_r.T_uuid, Class_1, page, page_z)
- r_jsons.Page = page
- r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
- c.ServeJSON()
- return
- }
- // 列表 -
- func (c *LogsController) LogsClass() {
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: System.Read_Logs_Class()}
- c.ServeJSON()
- return
- }
- // 列表 -
- func (c *LogsController) LogsList() {
- type R_JSONS struct {
- //必须的大写开头
- Data []System.Logs
- Num int64
- Page int
- Page_size int
- }
- var r_jsons R_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("T_class")
- Class_1 = strings.Replace(Class_1, "\"", "", -1)
- r_jsons.Data, r_jsons.Num = System.Read_Logs_ALL(Class_1, page, page_z)
- r_jsons.Page = page
- r_jsons.Page_size = int(math.Ceil(float64(r_jsons.Num) / float64(page_z)))
- c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons}
- c.ServeJSON()
- return
- }
|