From ac159d7b1855b12525fcc8167e47eb5bda0d04e4 Mon Sep 17 00:00:00 2001 From: "Mr. Lan" Date: Wed, 26 Aug 2020 22:03:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=99=BB=E5=BD=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=97=A0=E6=B3=95=E6=B8=85=E7=A9=BA=E7=9A=84bug.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/log/loginLog.go | 12 ++++++++++++ router/system/sys_router.go | 1 + 2 files changed, 13 insertions(+) diff --git a/apis/log/loginLog.go b/apis/log/loginLog.go index 6a2ea00..e1499df 100644 --- a/apis/log/loginLog.go +++ b/apis/log/loginLog.go @@ -1,6 +1,7 @@ package log import ( + "ferry/global/orm" "ferry/models/system" "ferry/tools" "ferry/tools/app" @@ -160,3 +161,14 @@ func DeleteLoginLog(c *gin.Context) { res.Msg = "删除成功" c.JSON(http.StatusOK, res.ReturnOK()) } + +func CleanLoginLog(c *gin.Context) { + + err := orm.Eloquent.Delete(&system.LoginLog{}).Error + if err != nil { + app.Error(c, -1, err, "") + return + } + + app.OK(c, "", "已清空") +} diff --git a/router/system/sys_router.go b/router/system/sys_router.go index 9d66a5c..e466364 100644 --- a/router/system/sys_router.go +++ b/router/system/sys_router.go @@ -71,6 +71,7 @@ func RegisterLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddl loginlog.POST("", log2.InsertLoginLog) loginlog.PUT("", log2.UpdateLoginLog) loginlog.DELETE("/:infoId", log2.DeleteLoginLog) + loginlog.DELETE("", log2.CleanLoginLog) } }