修改登录日志无法清空的bug.

This commit is contained in:
Mr. Lan 2020-08-26 22:03:33 +08:00
parent b528f1e147
commit ac159d7b18
2 changed files with 13 additions and 0 deletions

View File

@ -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, "", "已清空")
}

View File

@ -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)
}
}