添加审计日志界面

This commit is contained in:
bjdgyc
2021-08-17 13:14:13 +08:00
parent 6dcdc9766a
commit d9a3b0152b
7 changed files with 187 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
package admin
import (
"net/http"
"strconv"
"github.com/bjdgyc/anylink/dbdata"
)
func SetAuditList(w http.ResponseWriter, r *http.Request) {
_ = r.ParseForm()
pageS := r.FormValue("page")
page, _ := strconv.Atoi(pageS)
if page < 1 {
page = 1
}
var datas []dbdata.AccessAudit
count := dbdata.CountAll(&dbdata.AccessAudit{})
err := dbdata.Find(&datas, dbdata.PageSize, page)
if err != nil && !dbdata.CheckErrNotFound(err) {
RespError(w, RespInternalErr, err)
return
}
data := map[string]interface{}{
"count": count,
"page_size": dbdata.PageSize,
"datas": datas,
}
RespSucess(w, data)
}

View File

@@ -32,6 +32,7 @@ func StartAdmin() {
r.HandleFunc("/set/other/edit", SetOtherEdit)
r.HandleFunc("/set/other/smtp", SetOtherSmtp)
r.HandleFunc("/set/other/smtp/edit", SetOtherSmtpEdit)
r.HandleFunc("/set/audit/list", SetAuditList)
r.HandleFunc("/user/list", UserList)
r.HandleFunc("/user/detail", UserDetail)