mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 07:56:50 +08:00
Standardization
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"slices"
|
||||
|
||||
"github.com/lzh-1625/go_process_manager/internal/app/constants"
|
||||
@@ -15,8 +16,7 @@ type logApi struct{}
|
||||
|
||||
var LogApi = new(logApi)
|
||||
|
||||
func (a *logApi) GetLog(ctx *gin.Context) {
|
||||
req := bind[model.GetLogReq](ctx)
|
||||
func (a *logApi) GetLog(ctx *gin.Context, req model.GetLogReq) (err error) {
|
||||
if isAdmin(ctx) {
|
||||
rOk(ctx, "Query successful!", logic.LogLogicImpl.Search(req, req.FilterName...))
|
||||
} else {
|
||||
@@ -27,11 +27,15 @@ func (a *logApi) GetLog(ctx *gin.Context) {
|
||||
if len(filterName) == 0 {
|
||||
filterName = processNameList
|
||||
}
|
||||
errCheck(ctx, len(filterName) == 0, "No information found!")
|
||||
if len(filterName) == 0 {
|
||||
return errors.New("no information found")
|
||||
}
|
||||
rOk(ctx, "Query successful!", logic.LogLogicImpl.Search(req, filterName...))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (a *logApi) GetRunningLog(ctx *gin.Context) {
|
||||
func (a *logApi) GetRunningLog(ctx *gin.Context, _ any) error {
|
||||
rOk(ctx, "Query successful!", logic.Loghandler.GetRunning())
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user