mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-29 10:31:25 +08:00
说明
This commit is contained in:
@@ -25,10 +25,10 @@ type LogLoginApi struct {
|
||||
func (l LogLoginApi) GetLoginLogList(rc *ctx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
loginLocation := rc.GinCtx.Query("loginLocation")
|
||||
username := rc.GinCtx.Query("username")
|
||||
|
||||
list, total := l.LogLoginApp.FindListPage(pageNum, pageSize, entity.LogLogin{Status: status, Username: username})
|
||||
list, total := l.LogLoginApp.FindListPage(pageNum, pageSize, entity.LogLogin{LoginLocation: loginLocation, Username: username})
|
||||
rc.ResData = map[string]interface{}{
|
||||
"data": list,
|
||||
"total": total,
|
||||
@@ -49,22 +49,6 @@ func (l LogLoginApi) GetLoginLog(rc *ctx.ReqCtx) {
|
||||
rc.ResData = l.LogLoginApp.FindOne(int64(infoId))
|
||||
}
|
||||
|
||||
// @Summary 添加登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.LogLogin true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/log/logLogin [post]
|
||||
// @Security X-TOKEN
|
||||
func (l LogLoginApi) InsertLoginLog(rc *ctx.ReqCtx) {
|
||||
var log entity.LogLogin
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &log)
|
||||
l.LogLoginApp.Insert(log)
|
||||
}
|
||||
|
||||
// @Summary 修改登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
@@ -93,3 +77,13 @@ func (l LogLoginApi) DeleteLoginLog(rc *ctx.ReqCtx) {
|
||||
group := utils.IdsStrToIdsIntGroup(infoIds)
|
||||
l.LogLoginApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 清空登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 登录日志
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/log/logLogin/all [delete]
|
||||
func (l LogLoginApi) DeleteAll(rc *ctx.ReqCtx) {
|
||||
l.LogLoginApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"log"
|
||||
"pandax/base/ctx"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
@@ -25,11 +26,11 @@ type LogOperApi struct {
|
||||
func (l LogOperApi) GetOperLogList(rc *ctx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
status := rc.GinCtx.Query("status")
|
||||
|
||||
businessType := rc.GinCtx.Query("businessType")
|
||||
operName := rc.GinCtx.Query("operName")
|
||||
title := rc.GinCtx.Query("title")
|
||||
|
||||
list, total := l.LogOperApp.FindListPage(pageNum, pageSize, entity.LogOper{Status: status, OperName: operName, Title: title})
|
||||
list, total := l.LogOperApp.FindListPage(pageNum, pageSize, entity.LogOper{BusinessType: businessType, OperName: operName, Title: title})
|
||||
rc.ResData = map[string]interface{}{
|
||||
"data": list,
|
||||
"total": total,
|
||||
@@ -60,5 +61,16 @@ func (l LogOperApi) GetOperLog(rc *ctx.ReqCtx) {
|
||||
func (l LogOperApi) DeleteOperLog(rc *ctx.ReqCtx) {
|
||||
operIds := rc.GinCtx.Param("operId")
|
||||
group := utils.IdsStrToIdsIntGroup(operIds)
|
||||
log.Println("group", group)
|
||||
l.LogOperApp.Delete(group)
|
||||
}
|
||||
|
||||
// @Summary 清空操作日志
|
||||
// @Description 删除数据
|
||||
// @Tags 操作日志
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/log/logOper/all [delete]
|
||||
func (l LogOperApi) DeleteAll(rc *ctx.ReqCtx) {
|
||||
l.LogOperApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ func (u *UserApi) Login(rc *ctx.ReqCtx) {
|
||||
var loginLog entity.LogLogin
|
||||
ua := user_agent.New(rc.GinCtx.Request.UserAgent())
|
||||
loginLog.Ipaddr = rc.GinCtx.ClientIP()
|
||||
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.GinCtx.ClientIP())
|
||||
loginLog.LoginTime = time.Now()
|
||||
loginLog.Status = "0"
|
||||
loginLog.Remark = rc.GinCtx.Request.UserAgent()
|
||||
@@ -108,6 +109,7 @@ func (u *UserApi) Login(rc *ctx.ReqCtx) {
|
||||
loginLog.Platform = ua.Platform()
|
||||
loginLog.Username = login.Username
|
||||
loginLog.Msg = "登录成功"
|
||||
loginLog.CreateBy = login.Username
|
||||
u.LogLogin.Insert(loginLog)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user