first commit
This commit is contained in:
43
internal/router/manage/system/sys_user_login_log.go
Normal file
43
internal/router/manage/system/sys_user_login_log.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"management/internal/db/model/dto"
|
||||
"management/internal/router/manage/util"
|
||||
systemservice "management/internal/service/system"
|
||||
"management/internal/tpl"
|
||||
)
|
||||
|
||||
type SysUserLoginLogHandler struct{}
|
||||
|
||||
func NewSysUserLoginLogHandler() *SysUserLoginLogHandler {
|
||||
return &SysUserLoginLogHandler{}
|
||||
}
|
||||
|
||||
func (h *SysUserLoginLogHandler) List(w http.ResponseWriter, r *http.Request) {
|
||||
tpl.HTML(w, r, "login_log/list.tmpl", nil)
|
||||
}
|
||||
|
||||
func (h *SysUserLoginLogHandler) PostList(w http.ResponseWriter, r *http.Request) {
|
||||
var q dto.SearchDto
|
||||
q.SearchTimeBegin, q.SearchTimeEnd = util.DefaultStartTimeAndEndTime(r.PostFormValue("SearchTimeBegin"), r.PostFormValue("SearchTimeEnd"))
|
||||
q.SearchName = r.PostFormValue("SearchName")
|
||||
q.SearchKey = r.PostFormValue("SearchKey")
|
||||
q.Page = util.ConvertInt(r.PostFormValue("page"), 1)
|
||||
q.Rows = util.ConvertInt(r.PostFormValue("rows"), 10)
|
||||
ctx := r.Context()
|
||||
res, count, err := systemservice.ListSysUserLoginLog(ctx, q)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
data := tpl.ResponseList{
|
||||
Code: 0,
|
||||
Message: "ok",
|
||||
Count: count,
|
||||
Data: res,
|
||||
}
|
||||
tpl.JSON(w, data)
|
||||
}
|
||||
Reference in New Issue
Block a user