package controllers import ( "ERP_user/conf" "ERP_user/models/Account" "ERP_user/models/System" beego "github.com/beego/beego/v2/server/web" "gogs.baozhida.cn/zoie/ERP_libs/lib" "math" ) type UserLogsController struct { beego.Controller User Account.User } func (c *UserLogsController) Prepare() { c.User = *Account.User_r } // 列表 - func (c *UserLogsController) List() { // 分页参数 初始化 page, _ := c.GetInt("page") if page < 1 { page = 1 } page_z, _ := c.GetInt("page_z") if page_z < 1 { page_z = conf.Page_size } // 查询 T_class := c.GetString("T_class") T_title := c.GetString("T_title") R_List, R_cnt := System.Read_UserLogs_List(c.User.T_uuid, T_class, T_title, page, page_z) // 封装 返回数据 type R_JSONS struct { //必须的大写开头 Lite []System.UserLogs_R Num int64 Page int Page_size int } var r_jsons R_JSONS r_jsons.Num = R_cnt r_jsons.Lite = R_List r_jsons.Page = page r_jsons.Page_size = int(math.Ceil(float64(R_cnt) / float64(page_z))) c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: r_jsons} c.ServeJSON() return } // 列表 - func (c *UserLogsController) List_DISTINCT_Class() { c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!", Data: System.Read_UserLogs_Class()} c.ServeJSON() return }