Skip to content

Commit

Permalink
feat:增加操作日志管理的3个接口显示
Browse files Browse the repository at this point in the history
  • Loading branch information
nangongchengfeng committed May 20, 2024
1 parent 2fcdb56 commit af77717
Show file tree
Hide file tree
Showing 5 changed files with 426 additions and 1 deletion.
32 changes: 32 additions & 0 deletions controller/operation_log_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ import (
type OperationLogController struct{}

// List 记录列表
// @Summary 获取操作日志记录列表
// Description: 获取操作日志记录列表
// @Tags 操作日志管理
// @Accept application/json
// @Produce application/json
// @Param username query string false "用户名"
// @Param ip query string false "IP地址"
// @Param path query string false "路径"
// @Param method query string false "方法"
// @Param status query int false "状态码"
// @Param pageNum query int false "页码"
// @Param pageSize query int false "每页数量"
// @Success 200 {object} response.ResponseBody
// @Router /log/operation/list [get]
// @Security ApiKeyAuth
func (m *OperationLogController) List(c *gin.Context) {
req := new(request.OperationLogListReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -18,6 +33,15 @@ func (m *OperationLogController) List(c *gin.Context) {
}

// Delete 删除记录
// @Summary 删除操作日志记录
// Description: 删除操作日志记录
// @Tags 操作日志管理
// @Accept application/json
// @Produce application/json
// @Param data body request.OperationLogDeleteReq true "删除日志的ID"
// @Success 200 {object} response.ResponseBody
// @Router /log/operation/delete [post]
// @Security ApiKeyAuth
func (m *OperationLogController) Delete(c *gin.Context) {
req := new(request.OperationLogDeleteReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -26,6 +50,14 @@ func (m *OperationLogController) Delete(c *gin.Context) {
}

// Clean 清空记录
// @Summary 清空操作日志记录
// Description: 清空操作日志记录
// @Tags 操作日志管理
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.ResponseBody
// @Router /log/operation/clean [delete]
// @Security ApiKeyAuth
func (m *OperationLogController) Clean(c *gin.Context) {
req := new(request.OperationLogListReq)
Run(c, req, func() (interface{}, interface{}) {
Expand Down
150 changes: 150 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,142 @@ const docTemplate = `{
}
}
},
"/log/operation/clean": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "清空操作日志记录",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/log/operation/delete": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "删除操作日志记录",
"parameters": [
{
"description": "删除日志的ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.OperationLogDeleteReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/log/operation/list": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "获取操作日志记录列表",
"parameters": [
{
"type": "string",
"description": "用户名",
"name": "username",
"in": "query"
},
{
"type": "string",
"description": "IP地址",
"name": "ip",
"in": "query"
},
{
"type": "string",
"description": "路径",
"name": "path",
"in": "query"
},
{
"type": "string",
"description": "方法",
"name": "method",
"in": "query"
},
{
"type": "integer",
"description": "状态码",
"name": "status",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "pageNum",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "pageSize",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/menu/access/tree": {
"get": {
"security": [
Expand Down Expand Up @@ -2255,6 +2391,20 @@ const docTemplate = `{
}
}
},
"request.OperationLogDeleteReq": {
"type": "object",
"required": [
"operationLogIds"
],
"properties": {
"operationLogIds": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"request.RegisterAndLoginReq": {
"type": "object",
"required": [
Expand Down
150 changes: 150 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,142 @@
}
}
},
"/log/operation/clean": {
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "清空操作日志记录",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/log/operation/delete": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "删除操作日志记录",
"parameters": [
{
"description": "删除日志的ID",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.OperationLogDeleteReq"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/log/operation/list": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"操作日志管理"
],
"summary": "获取操作日志记录列表",
"parameters": [
{
"type": "string",
"description": "用户名",
"name": "username",
"in": "query"
},
{
"type": "string",
"description": "IP地址",
"name": "ip",
"in": "query"
},
{
"type": "string",
"description": "路径",
"name": "path",
"in": "query"
},
{
"type": "string",
"description": "方法",
"name": "method",
"in": "query"
},
{
"type": "integer",
"description": "状态码",
"name": "status",
"in": "query"
},
{
"type": "integer",
"description": "页码",
"name": "pageNum",
"in": "query"
},
{
"type": "integer",
"description": "每页数量",
"name": "pageSize",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.ResponseBody"
}
}
}
}
},
"/menu/access/tree": {
"get": {
"security": [
Expand Down Expand Up @@ -2249,6 +2385,20 @@
}
}
},
"request.OperationLogDeleteReq": {
"type": "object",
"required": [
"operationLogIds"
],
"properties": {
"operationLogIds": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"request.RegisterAndLoginReq": {
"type": "object",
"required": [
Expand Down
Loading

0 comments on commit af77717

Please sign in to comment.