🆕新增操作日志
This commit is contained in:
40
http/api/dashboard.go
Normal file
40
http/api/dashboard.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"wireguard-ui/http/param"
|
||||
"wireguard-ui/http/response"
|
||||
"wireguard-ui/http/vo"
|
||||
"wireguard-ui/service"
|
||||
)
|
||||
|
||||
type DashboardApi struct{}
|
||||
|
||||
func Dashboard() DashboardApi {
|
||||
return DashboardApi{}
|
||||
}
|
||||
|
||||
// List
|
||||
// @description: 操作日志
|
||||
// @receiver DashboardApi
|
||||
// @param c
|
||||
func (DashboardApi) List(c *gin.Context) {
|
||||
var p param.Page
|
||||
if err := c.ShouldBind(&p); err != nil {
|
||||
response.R(c).Validator(err)
|
||||
return
|
||||
}
|
||||
|
||||
var loginUser *vo.User
|
||||
if loginUser = GetCurrentLoginUser(c); c.IsAborted() {
|
||||
return
|
||||
}
|
||||
|
||||
data, total, err := service.Log().List(p, loginUser)
|
||||
if err != nil {
|
||||
response.R(c).FailedWithError(fmt.Errorf("获取操作日志失败: %v", err.Error()))
|
||||
return
|
||||
}
|
||||
response.R(c).Paginate(data, total, p.Current, p.Size)
|
||||
}
|
Reference in New Issue
Block a user