44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package system
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 
 | |
| 	"management/internal/db/model/dto"
 | |
| 	"management/internal/router/manage/util"
 | |
| 	systemservice "management/internal/service/system"
 | |
| 	"management/internal/tpl"
 | |
| )
 | |
| 
 | |
| type SysAuditLogHandler struct{}
 | |
| 
 | |
| func NewSysAuditLogHandler() *SysAuditLogHandler {
 | |
| 	return &SysAuditLogHandler{}
 | |
| }
 | |
| 
 | |
| func (h *SysAuditLogHandler) List(w http.ResponseWriter, r *http.Request) {
 | |
| 	tpl.HTML(w, r, "audit_log/list.tmpl", nil)
 | |
| }
 | |
| 
 | |
| func (h *SysAuditLogHandler) 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.ListSysAuditLog(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)
 | |
| }
 |