29 lines
911 B
Go
29 lines
911 B
Go
package handler
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
"strconv"
|
||
|
|
|
||
|
|
"bj_power_wms/internal/svc"
|
||
|
|
)
|
||
|
|
|
||
|
|
// eventLogListHandler GET /api/event/logs 操作日志分页查询
|
||
|
|
// 筛选:eventType(事件类型) operator(操作人) entityType(对象类型) from/to(unix 秒)
|
||
|
|
func eventLogListHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||
|
|
return requirePerm(ctx, "eventlog:manage", func(w http.ResponseWriter, r *http.Request) {
|
||
|
|
q := r.URL.Query()
|
||
|
|
page, _ := strconv.Atoi(q.Get("page"))
|
||
|
|
pageSize, _ := strconv.Atoi(q.Get("pageSize"))
|
||
|
|
from, _ := strconv.ParseInt(q.Get("from"), 10, 64)
|
||
|
|
to, _ := strconv.ParseInt(q.Get("to"), 10, 64)
|
||
|
|
list, total, err := ctx.EventLog.Query(ctx0(),
|
||
|
|
q.Get("eventType"), q.Get("operator"), q.Get("entityType"),
|
||
|
|
from, to, page, pageSize)
|
||
|
|
if err != nil {
|
||
|
|
fail(w, http.StatusInternalServerError, err.Error())
|
||
|
|
return
|
||
|
|
}
|
||
|
|
ok(w, map[string]any{"list": list, "total": total})
|
||
|
|
})
|
||
|
|
}
|