【更新】更新restful

This commit is contained in:
PandaGoAdmin
2022-08-03 16:00:32 +08:00
parent 2cb23c0ecf
commit 6945277fdb
48 changed files with 1234 additions and 836 deletions

View File

@@ -23,11 +23,11 @@ type LogJobApi struct {
// @Router /log/logJob/list [get]
// @Security
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")
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
name := restfulx.QueryParam(rc, "name")
jobGroup := restfulx.QueryParam(rc, "jobGroup")
status := restfulx.QueryParam(rc, "status")
list, total := l.LogJobApp.FindListPage(pageNum, pageSize, entity.LogJob{Name: name, JobGroup: jobGroup, Status: status})
rc.ResData = map[string]any{
@@ -46,7 +46,7 @@ func (l *LogJobApi) GetJobLogList(rc *restfulx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /log/logJob/{logId} [delete]
func (l *LogJobApi) DeleteJobLog(rc *restfulx.ReqCtx) {
logIds := rc.GinCtx.Param("logId")
logIds := restfulx.QueryParam(rc, "logId")
group := utils.IdsStrToIdsIntGroup(logIds)
l.LogJobApp.Delete(group)
}

View File

@@ -22,10 +22,10 @@ type LogLoginApi struct {
// @Router /log/logLogin/list [get]
// @Security
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")
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
loginLocation := restfulx.QueryParam(rc, "loginLocation")
username := restfulx.QueryParam(rc, "username")
list, total := l.LogLoginApp.FindListPage(pageNum, pageSize, entity.LogLogin{LoginLocation: loginLocation, Username: username})
rc.ResData = map[string]any{
"data": list,
@@ -43,7 +43,7 @@ func (l *LogLoginApi) GetLoginLogList(rc *restfulx.ReqCtx) {
// @Router /log/logLogin/{infoId} [get]
// @Security
func (l *LogLoginApi) GetLoginLog(rc *restfulx.ReqCtx) {
infoId := restfulx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("infoId"))
infoId := restfulx.PathParamInt(rc, "infoId")
rc.ResData = l.LogLoginApp.FindOne(int64(infoId))
}
@@ -59,7 +59,7 @@ func (l *LogLoginApi) GetLoginLog(rc *restfulx.ReqCtx) {
// @Security X-TOKEN
func (l *LogLoginApi) UpdateLoginLog(rc *restfulx.ReqCtx) {
var log entity.LogLogin
restfulx.BindJsonAndValid(rc.GinCtx, &log)
restfulx.BindQuery(rc, &log)
l.LogLoginApp.Update(log)
}
@@ -71,7 +71,7 @@ func (l *LogLoginApi) UpdateLoginLog(rc *restfulx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /log/logLogin/{infoId} [delete]
func (l *LogLoginApi) DeleteLoginLog(rc *restfulx.ReqCtx) {
infoIds := rc.GinCtx.Param("infoId")
infoIds := restfulx.PathParam(rc, "infoId")
group := utils.IdsStrToIdsIntGroup(infoIds)
l.LogLoginApp.Delete(group)
}

View File

@@ -23,12 +23,11 @@ type LogOperApi struct {
// @Router /log/logOper/list [get]
// @Security
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")
title := rc.GinCtx.Query("title")
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
businessType := restfulx.QueryParam(rc, "businessType")
operName := restfulx.QueryParam(rc, "operName")
title := restfulx.QueryParam(rc, "title")
list, total := l.LogOperApp.FindListPage(pageNum, pageSize, entity.LogOper{BusinessType: businessType, OperName: operName, Title: title})
rc.ResData = map[string]any{
"data": list,
@@ -46,7 +45,7 @@ func (l *LogOperApi) GetOperLogList(rc *restfulx.ReqCtx) {
// @Router /log/logOper/{operId} [get]
// @Security
func (l *LogOperApi) GetOperLog(rc *restfulx.ReqCtx) {
operId := restfulx.PathParamInt(rc.GinCtx, rc.GinCtx.Param("operId"))
operId := restfulx.PathParamInt(rc, "operId")
rc.ResData = l.LogOperApp.FindOne(int64(operId))
}
@@ -58,7 +57,7 @@ func (l *LogOperApi) GetOperLog(rc *restfulx.ReqCtx) {
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
// @Router /log/logOper/{operId} [delete]
func (l *LogOperApi) DeleteOperLog(rc *restfulx.ReqCtx) {
operIds := rc.GinCtx.Param("operId")
operIds := restfulx.PathParam(rc, "operId")
group := utils.IdsStrToIdsIntGroup(operIds)
log.Println("group", group)
l.LogOperApp.Delete(group)

View File

@@ -1,14 +1,11 @@
package router
import (
"github.com/XM-GO/PandaKit/restfulx"
"github.com/gin-gonic/gin"
"pandax/apps/log/api"
"pandax/apps/log/services"
"github.com/emicklei/go-restful/v3"
)
func InitLogRouter(router *gin.RouterGroup) {
// 登录日志
func InitLogRouter(container *restful.Container) {
/*// 登录日志
login := &api.LogLoginApi{
LogLoginApp: services.LogLoginModelDao,
}
@@ -72,5 +69,5 @@ func InitLogRouter(router *gin.RouterGroup) {
logJob.DELETE(":logId", func(c *gin.Context) {
restfulx.NewReqCtx(c).WithLog("删除操作日志信息").Handle(job.DeleteJobLog)
})
})*/
}