2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 14:57:16 +08:00

feat: 规范部分控制器方法

This commit is contained in:
耗子
2023-11-08 02:01:28 +08:00
parent e032faeae0
commit d90423db4a
17 changed files with 939 additions and 221 deletions

View File

@@ -38,7 +38,7 @@ func (r *TaskController) List(ctx http.Context) http.Response {
var total int64
err := facades.Orm().Query().Order("id desc").Paginate(ctx.Request().QueryInt("page", 1), ctx.Request().QueryInt("limit", 10), &tasks, &total)
if err != nil {
facades.Log().With(map[string]any{
facades.Log().Request(ctx.Request()).With(map[string]any{
"error": err.Error(),
}).Error("[面板][TaskController] 查询任务列表失败")
return ErrorSystem(ctx)
@@ -55,7 +55,7 @@ func (r *TaskController) Log(ctx http.Context) http.Response {
var task models.Task
err := facades.Orm().Query().Where("id", ctx.Request().QueryInt("id")).FirstOrFail(&task)
if err != nil {
facades.Log().With(map[string]any{
facades.Log().Request(ctx.Request()).With(map[string]any{
"id": ctx.Request().QueryInt("id"),
"error": err.Error(),
}).Error("[面板][TaskController] 查询任务失败")