mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-05-06 12:01:27 +08:00
[优化]base模块提出
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/apps/log/services"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
)
|
||||
|
||||
type LogJobApi struct {
|
||||
@@ -22,9 +22,9 @@ type LogJobApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logJob/list [get]
|
||||
// @Security
|
||||
func (l *LogJobApi) GetJobLogList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (l *LogJobApi) GetJobLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
name := rc.GinCtx.Query("name")
|
||||
jobGroup := rc.GinCtx.Query("jobGroup")
|
||||
status := rc.GinCtx.Query("status")
|
||||
@@ -45,7 +45,7 @@ func (l *LogJobApi) GetJobLogList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logJob/{logId} [delete]
|
||||
func (l *LogJobApi) DeleteJobLog(rc *ginx.ReqCtx) {
|
||||
func (l *LogJobApi) DeleteJobLog(rc *restfulx.ReqCtx) {
|
||||
logIds := rc.GinCtx.Param("logId")
|
||||
group := utils.IdsStrToIdsIntGroup(logIds)
|
||||
l.LogJobApp.Delete(group)
|
||||
@@ -57,6 +57,6 @@ func (l *LogJobApi) DeleteJobLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logJob/all [delete]
|
||||
func (l *LogJobApi) DeleteAll(rc *ginx.ReqCtx) {
|
||||
func (l *LogJobApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogJobApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/apps/log/services"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
)
|
||||
|
||||
type LogLoginApi struct {
|
||||
@@ -21,9 +21,9 @@ type LogLoginApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logLogin/list [get]
|
||||
// @Security
|
||||
func (l *LogLoginApi) GetLoginLogList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (l *LogLoginApi) GetLoginLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
loginLocation := rc.GinCtx.Query("loginLocation")
|
||||
username := rc.GinCtx.Query("username")
|
||||
list, total := l.LogLoginApp.FindListPage(pageNum, pageSize, entity.LogLogin{LoginLocation: loginLocation, Username: username})
|
||||
@@ -42,8 +42,8 @@ func (l *LogLoginApi) GetLoginLogList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logLogin/{infoId} [get]
|
||||
// @Security
|
||||
func (l *LogLoginApi) GetLoginLog(rc *ginx.ReqCtx) {
|
||||
infoId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("infoId"))
|
||||
func (l *LogLoginApi) GetLoginLog(rc *restfulx.ReqCtx) {
|
||||
infoId := restfulx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("infoId"))
|
||||
rc.ResData = l.LogLoginApp.FindOne(int64(infoId))
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ func (l *LogLoginApi) GetLoginLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /log/logLogin [put]
|
||||
// @Security X-TOKEN
|
||||
func (l *LogLoginApi) UpdateLoginLog(rc *ginx.ReqCtx) {
|
||||
func (l *LogLoginApi) UpdateLoginLog(rc *restfulx.ReqCtx) {
|
||||
var log entity.LogLogin
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &log)
|
||||
restfulx.BindJsonAndValid(rc.GinCtx, &log)
|
||||
l.LogLoginApp.Update(log)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (l *LogLoginApi) UpdateLoginLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logLogin/{infoId} [delete]
|
||||
func (l *LogLoginApi) DeleteLoginLog(rc *ginx.ReqCtx) {
|
||||
func (l *LogLoginApi) DeleteLoginLog(rc *restfulx.ReqCtx) {
|
||||
infoIds := rc.GinCtx.Param("infoId")
|
||||
group := utils.IdsStrToIdsIntGroup(infoIds)
|
||||
l.LogLoginApp.Delete(group)
|
||||
@@ -82,6 +82,6 @@ func (l *LogLoginApi) DeleteLoginLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logLogin/all [delete]
|
||||
func (l *LogLoginApi) DeleteAll(rc *ginx.ReqCtx) {
|
||||
func (l *LogLoginApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogLoginApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/XM-GO/PandaKit/utils"
|
||||
"log"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/apps/log/services"
|
||||
"pandax/base/ginx"
|
||||
"pandax/base/utils"
|
||||
)
|
||||
|
||||
type LogOperApi struct {
|
||||
@@ -22,9 +22,9 @@ type LogOperApi struct {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logOper/list [get]
|
||||
// @Security
|
||||
func (l *LogOperApi) GetOperLogList(rc *ginx.ReqCtx) {
|
||||
pageNum := ginx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := ginx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
func (l *LogOperApi) GetOperLogList(rc *restfulx.ReqCtx) {
|
||||
pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
|
||||
businessType := rc.GinCtx.Query("businessType")
|
||||
operName := rc.GinCtx.Query("operName")
|
||||
@@ -45,8 +45,8 @@ func (l *LogOperApi) GetOperLogList(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /log/logOper/{operId} [get]
|
||||
// @Security
|
||||
func (l *LogOperApi) GetOperLog(rc *ginx.ReqCtx) {
|
||||
operId := ginx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("operId"))
|
||||
func (l *LogOperApi) GetOperLog(rc *restfulx.ReqCtx) {
|
||||
operId := restfulx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("operId"))
|
||||
rc.ResData = l.LogOperApp.FindOne(int64(operId))
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ func (l *LogOperApi) GetOperLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logOper/{operId} [delete]
|
||||
func (l *LogOperApi) DeleteOperLog(rc *ginx.ReqCtx) {
|
||||
func (l *LogOperApi) DeleteOperLog(rc *restfulx.ReqCtx) {
|
||||
operIds := rc.GinCtx.Param("operId")
|
||||
group := utils.IdsStrToIdsIntGroup(operIds)
|
||||
log.Println("group", group)
|
||||
@@ -70,6 +70,6 @@ func (l *LogOperApi) DeleteOperLog(rc *ginx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /log/logOper/all [delete]
|
||||
func (l *LogOperApi) DeleteAll(rc *ginx.ReqCtx) {
|
||||
func (l *LogOperApi) DeleteAll(rc *restfulx.ReqCtx) {
|
||||
l.LogOperApp.DeleteAll()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"pandax/base/model"
|
||||
"github.com/XM-GO/PandaKit/model"
|
||||
)
|
||||
|
||||
type LogJob struct {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"pandax/base/model"
|
||||
"github.com/XM-GO/PandaKit/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"pandax/base/model"
|
||||
"github.com/XM-GO/PandaKit/model"
|
||||
)
|
||||
|
||||
type LogOper struct {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/restfulx"
|
||||
"github.com/gin-gonic/gin"
|
||||
"pandax/apps/log/api"
|
||||
"pandax/apps/log/services"
|
||||
"pandax/base/ginx"
|
||||
)
|
||||
|
||||
func InitLogRouter(router *gin.RouterGroup) {
|
||||
@@ -15,23 +15,23 @@ func InitLogRouter(router *gin.RouterGroup) {
|
||||
logLogin := router.Group("logLogin")
|
||||
|
||||
logLogin.GET("list", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("获取登录日志列表").Handle(login.GetLoginLogList)
|
||||
restfulx.NewReqCtx(c).WithLog("获取登录日志列表").Handle(login.GetLoginLogList)
|
||||
})
|
||||
|
||||
logLogin.GET(":infoId", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("获取登录日志信息").Handle(login.GetLoginLog)
|
||||
restfulx.NewReqCtx(c).WithLog("获取登录日志信息").Handle(login.GetLoginLog)
|
||||
})
|
||||
|
||||
logLogin.PUT("", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("修改登录日志信息").Handle(login.UpdateLoginLog)
|
||||
restfulx.NewReqCtx(c).WithLog("修改登录日志信息").Handle(login.UpdateLoginLog)
|
||||
})
|
||||
|
||||
logLogin.DELETE("all", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("清空登录日志信息").Handle(login.DeleteAll)
|
||||
restfulx.NewReqCtx(c).WithLog("清空登录日志信息").Handle(login.DeleteAll)
|
||||
})
|
||||
|
||||
logLogin.DELETE(":infoId", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("删除登录日志信息").Handle(login.DeleteLoginLog)
|
||||
restfulx.NewReqCtx(c).WithLog("删除登录日志信息").Handle(login.DeleteLoginLog)
|
||||
})
|
||||
|
||||
// 操作日志
|
||||
@@ -41,19 +41,19 @@ func InitLogRouter(router *gin.RouterGroup) {
|
||||
logOper := router.Group("logOper")
|
||||
|
||||
logOper.GET("list", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("获取操作日志列表").Handle(oper.GetOperLogList)
|
||||
restfulx.NewReqCtx(c).WithLog("获取操作日志列表").Handle(oper.GetOperLogList)
|
||||
})
|
||||
|
||||
logOper.GET(":operId", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("获取操作日志信息").Handle(oper.GetOperLog)
|
||||
restfulx.NewReqCtx(c).WithLog("获取操作日志信息").Handle(oper.GetOperLog)
|
||||
})
|
||||
|
||||
logOper.DELETE("all", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("清空操作日志信息").Handle(oper.DeleteAll)
|
||||
restfulx.NewReqCtx(c).WithLog("清空操作日志信息").Handle(oper.DeleteAll)
|
||||
})
|
||||
|
||||
logOper.DELETE(":operId", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("删除操作日志信息").Handle(oper.DeleteOperLog)
|
||||
restfulx.NewReqCtx(c).WithLog("删除操作日志信息").Handle(oper.DeleteOperLog)
|
||||
})
|
||||
|
||||
// Job日志
|
||||
@@ -63,14 +63,14 @@ func InitLogRouter(router *gin.RouterGroup) {
|
||||
logJob := router.Group("logJob")
|
||||
|
||||
logJob.GET("list", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("获取操作日志列表").Handle(job.GetJobLogList)
|
||||
restfulx.NewReqCtx(c).WithLog("获取操作日志列表").Handle(job.GetJobLogList)
|
||||
})
|
||||
|
||||
logJob.DELETE("all", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("清空操作日志信息").Handle(job.DeleteAll)
|
||||
restfulx.NewReqCtx(c).WithLog("清空操作日志信息").Handle(job.DeleteAll)
|
||||
})
|
||||
|
||||
logJob.DELETE(":logId", func(c *gin.Context) {
|
||||
ginx.NewReqCtx(c).WithLog("删除操作日志信息").Handle(job.DeleteJobLog)
|
||||
restfulx.NewReqCtx(c).WithLog("删除操作日志信息").Handle(job.DeleteJobLog)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/base/biz"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/base/biz"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"github.com/XM-GO/PandaKit/biz"
|
||||
"pandax/apps/log/entity"
|
||||
"pandax/base/biz"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user