Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:增加swag的依赖和用户接口显示 #345

Merged
merged 23 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3d14d07
feat: 增加操作日志请求头查询和清空日志功能
nangongchengfeng May 15, 2024
3a60303
Merge branch 'main' of https://github.com/nangongchengfeng/go-ldap-admin
nangongchengfeng May 15, 2024
86f19c9
fix: r 变量未使用
nangongchengfeng May 15, 2024
14a43fb
增加数据库初始化数据
nangongchengfeng May 15, 2024
750cae6
fix: 移除r变量未使用
nangongchengfeng May 15, 2024
f08f994
Merge branch 'eryajf:main' into main
nangongchengfeng May 17, 2024
3f7e0a8
feat:增加swag的依赖和用户接口显示
nangongchengfeng May 17, 2024
6dbe290
fix:版本保持一致,增加swag的依赖
nangongchengfeng May 17, 2024
9485ef3
fix:恢复高版本
nangongchengfeng May 17, 2024
c9095a5
fix:修改依赖版本
nangongchengfeng May 17, 2024
9bd3f1a
fix:go.mod
nangongchengfeng May 18, 2024
5e1e9c9
fix:保持版本一致
nangongchengfeng May 18, 2024
b55272c
fix:保持版本一致
nangongchengfeng May 18, 2024
8da2d49
fix:修复tag标签为基础管理
nangongchengfeng May 19, 2024
28cbf07
feat:增加用户管理的12个接口显示
nangongchengfeng May 19, 2024
b5e8e49
feat:增加分组管理的14个接口显示
nangongchengfeng May 20, 2024
c2b760f
feat:增加角色管理的8个接口显示
nangongchengfeng May 20, 2024
70ec4c5
feat:增加菜单管理的5个接口显示
nangongchengfeng May 20, 2024
2fcdb56
feat:增加接口管理的5个接口显示
nangongchengfeng May 20, 2024
af77717
feat:增加操作日志管理的3个接口显示
nangongchengfeng May 20, 2024
73def36
feat:增加字段关系管理的4个接口显示
nangongchengfeng May 20, 2024
b8cf0f0
feat:增加登录接口注解
nangongchengfeng May 20, 2024
29612b6
feat:增加登录接口注解
nangongchengfeng May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions controller/a_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ func Run(c *gin.Context, req interface{}, fn func() (interface{}, interface{}))
tools.Success(c, data)
}

// Demo
// @Summary 健康检测
// @Tags 基础管理
// @Produce json
// @Description 健康检测
// @Success 200 {object} response.ResponseBody
// @router /base/ping [get]
func Demo(c *gin.Context) {
// 健康检测
CodeDebug()
c.JSON(http.StatusOK, tools.H{"code": 200, "msg": "ok", "data": "pong"})
}
Expand Down
43 changes: 43 additions & 0 deletions controller/api_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import (
type ApiController struct{}

// List 记录列表
// @Summary 获取API接口列表
// Description: 获取API接口列表
// @Tags 接口管理
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.ResponseBody
// @Router /api/list [get]
// @Security ApiKeyAuth
func (m *ApiController) List(c *gin.Context) {
req := new(request.ApiListReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -18,6 +26,14 @@ func (m *ApiController) List(c *gin.Context) {
}

// GetTree 接口树
// @Summary 获取API接口树
// Description: 获取API接口树
// @Tags 接口管理
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.ResponseBody
// @Router /api/tree [get]
// @Security ApiKeyAuth
func (m *ApiController) GetTree(c *gin.Context) {
req := new(request.ApiGetTreeReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -26,6 +42,15 @@ func (m *ApiController) GetTree(c *gin.Context) {
}

// Add 新建记录
// @Summary 新建API接口
// @Tags 接口管理
// Description: 新建API接口
// @Accept application/json
// @Produce application/json
// @Param data body request.ApiAddReq true "新建API"
// @Success 200 {object} response.ResponseBody
// @Router /api/add [post]
// @Security ApiKeyAuth
func (m *ApiController) Add(c *gin.Context) {
req := new(request.ApiAddReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -34,6 +59,15 @@ func (m *ApiController) Add(c *gin.Context) {
}

// Update 更新记录
// @Summary 更新API接口
// @Tags 接口管理
// Description: 更新API接口
// @Accept application/json
// @Produce application/json
// @Param data body request.ApiUpdateReq true "更新API"
// @Success 200 {object} response.ResponseBody
// @Router /api/update [post]
// @Security ApiKeyAuth
func (m *ApiController) Update(c *gin.Context) {
req := new(request.ApiUpdateReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -42,6 +76,15 @@ func (m *ApiController) Update(c *gin.Context) {
}

// Delete 删除记录
// @Summary 删除API接口
// @Tags 接口管理
// Description: 删除API接口
// @Accept application/json
// @Produce application/json
// @Param data body request.ApiDeleteReq true "删除API"
// @Success 200 {object} response.ResponseBody
// @Router /api/delete [post]
// @Security ApiKeyAuth
func (m *ApiController) Delete(c *gin.Context) {
req := new(request.ApiDeleteReq)
Run(c, req, func() (interface{}, interface{}) {
Expand Down
41 changes: 40 additions & 1 deletion controller/base_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import (
type BaseController struct{}

// SendCode 给用户邮箱发送验证码
// @Summary 发送验证码
// @Description 向指定邮箱发送验证码
// @Tags 基础管理
// @Accept application/json
// @Produce application/json
// @Param data body request.BaseSendCodeReq true "发送验证码请求数据"
// @Success 200 {object} response.ResponseBody
// @Router /base/sendcode [post]
func (m *BaseController) SendCode(c *gin.Context) {
req := new(request.BaseSendCodeReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -18,6 +26,14 @@ func (m *BaseController) SendCode(c *gin.Context) {
}

// ChangePwd 用户通过邮箱修改密码
// @Summary 用户通过邮箱修改密码
// @Description 使用邮箱验证码修改密码
// @Tags 基础管理
// @Accept application/json
// @Produce application/json
// @Param data body request.BaseChangePwdReq true "发送验证码请求数据"
// @Success 200 {object} response.ResponseBody
// @Router /base/changePwd [post]
func (m *BaseController) ChangePwd(c *gin.Context) {
req := new(request.BaseChangePwdReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -26,14 +42,29 @@ func (m *BaseController) ChangePwd(c *gin.Context) {
}

// Dashboard 系统首页展示数据
// @Summary 获取仪表盘数据
// @Description 获取系统仪表盘概览数据
// @Tags 基础管理
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.ResponseBody
// @Router /base/dashboard [get]
func (m *BaseController) Dashboard(c *gin.Context) {
req := new(request.BaseDashboardReq)
Run(c, req, func() (interface{}, interface{}) {
return logic.Base.Dashboard(c, req)
})
}

// EncryptPasswd 生成加密密码
// EncryptPasswd 密码加密
// @Summary 密码加密
// @Description 将明文密码加密
// @Tags 基础管理
// @Accept application/json
// @Produce application/json
// @Param passwd query string true "需要加密的明文密码"
// @Success 200 {object} response.ResponseBody
// @Router /base/encryptpwd [get]
func (m *BaseController) EncryptPasswd(c *gin.Context) {
req := new(request.EncryptPasswdReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -42,6 +73,14 @@ func (m *BaseController) EncryptPasswd(c *gin.Context) {
}

// DecryptPasswd 密码解密为明文
// @Summary 密码解密
// @Description 将加密后的密码解密为明文
// @Tags 基础管理
// @Accept application/json
// @Produce application/json
// @Param passwd query string true "需要解密的加密密码"
// @Success 200 {object} response.ResponseBody
// @Router /base/decryptpwd [get]
func (m *BaseController) DecryptPasswd(c *gin.Context) {
req := new(request.DecryptPasswdReq)
Run(c, req, func() (interface{}, interface{}) {
Expand Down
35 changes: 35 additions & 0 deletions controller/field_relation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import (
type FieldRelationController struct{}

// List 记录列表
// @Summary 获字段关系管理列表
// Description: 获字段关系管理列表
// @Tags 字段关系管理
// @Accept application/json
// @Produce application/json
// @Success 200 {object} response.ResponseBody
// @Router /fieldrelation/list [get]
// @Security ApiKeyAuth
func (m *FieldRelationController) List(c *gin.Context) {
req := new(request.FieldRelationListReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -18,6 +26,15 @@ func (m *FieldRelationController) List(c *gin.Context) {
}

// Add 新建记录
// @Summary 新建字段关系管理记录
// Description: 新建字段关系管理记录
// @Tags 字段关系管理
// @Accept application/json
// @Produce application/json
// @Param data body request.FieldRelationAddReq true "新建字段关系管理记录"
// @Success 200 {object} response.ResponseBody
// @Router /fieldrelation/add [post]
// @Security ApiKeyAuth
func (m *FieldRelationController) Add(c *gin.Context) {
req := new(request.FieldRelationAddReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -26,6 +43,15 @@ func (m *FieldRelationController) Add(c *gin.Context) {
}

// Update 更新记录
// @Summary 更新字段关系管理记录
// Description: 更新字段关系管理记录
// @Tags 字段关系管理
// @Accept application/json
// @Produce application/json
// @Param data body request.FieldRelationUpdateReq true "更新字段关系管理记录"
// @Success 200 {object} response.ResponseBody
// @Router /fieldrelation/update [post]
// @Security ApiKeyAuth
func (m *FieldRelationController) Update(c *gin.Context) {
req := new(request.FieldRelationUpdateReq)
Run(c, req, func() (interface{}, interface{}) {
Expand All @@ -34,6 +60,15 @@ func (m *FieldRelationController) Update(c *gin.Context) {
}

// Delete 删除记录
// @Summary 删除字段关系管理记录
// Description: 删除字段关系管理记录
// @Tags 字段关系管理
// @Accept application/json
// @Produce application/json
// @Param data body request.FieldRelationDeleteReq true "删除字段关系管理记录"
// @Success 200 {object} response.ResponseBody
// @Router /fieldrelation/delete [post]
// @Security ApiKeyAuth
func (m *FieldRelationController) Delete(c *gin.Context) {
req := new(request.FieldRelationDeleteReq)
Run(c, req, func() (interface{}, interface{}) {
Expand Down
Loading
Loading