Files
easygoadmin/app/controller/oper_log.go
yaoyilin dbd3c3c247 feat: 封装为包
封装为包
2022-10-31 23:55:00 +08:00

50 lines
911 B
Go

/**
* 操作日志-控制器
* @author
* @since 2021/11/12
* @File : OperLog
*/
package controller
import (
"github.com/gin-gonic/gin"
"gitlab.52pay.top/go/easygoadmin/app/dto"
"gitlab.52pay.top/go/easygoadmin/app/service"
"gitlab.52pay.top/go/easygoadmin/utils/common"
"net/http"
)
var OperLog = new(operLogCtl)
type operLogCtl struct{}
func (c *operLogCtl) List(ctx *gin.Context) {
// 参数
var req *dto.OperLogPageReq
if err := ctx.ShouldBind(&req); err != nil {
ctx.JSON(http.StatusOK, common.JsonResult{
Code: -1,
Msg: err.Error(),
})
return
}
// 调用分页查询方法
list, count, err := service.OperLog.GetList(req)
if err != nil {
ctx.JSON(http.StatusOK, common.JsonResult{
Code: -1,
Msg: err.Error(),
})
return
}
// 返回结果
ctx.JSON(http.StatusOK, common.JsonResult{
Code: 0,
Msg: "查询成功",
Data: list,
Count: count,
})
}