docs📝: 修改接口文档

This commit is contained in:
zhangwenjian committed 2021-06-29 16:30:47 +08:00
1 parent 0607d462d0
commit 3fd34db3c1
16 files changed
+541 -289

No files matched your search

+1
View File
@@ -157,6 +157,7 @@ func (e SysDictType) Update(c *gin.Context) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/dict/type [delete]
// @Security Bearer
func (e SysDictType) Delete(c *gin.Context) {
s := service.SysDictType{}
req := dto.SysDictTypeById{}
+3 -2
View File
@@ -51,7 +51,7 @@ func (e SysLoginLog) GetPage(c *gin.Context) {
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
}
// GetSysLoginLog 登录日志通过id获取
// Get 登录日志通过id获取
// @Summary 登录日志通过id获取
// @Description 获取JSON
// @Tags 登录日志
@@ -81,13 +81,14 @@ func (e SysLoginLog) Get(c *gin.Context) {
e.OK(object, "查询成功")
}
// DeleteSysLoginLog 登录日志删除
// Delete 登录日志删除
// @Summary 登录日志删除
// @Description 登录日志删除
// @Tags 登录日志
// @Param data body dto.SysLoginLogById true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-login-log [delete]
// @Security Bearer
func (e SysLoginLog) Delete(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogById{}
+5 -6
View File
@@ -1,13 +1,11 @@
package apis
import (
"github.com/gin-gonic/gin/binding"
"go-admin/app/admin/models"
"net/http"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
"go-admin/app/admin/service/dto"
@@ -153,6 +151,7 @@ func (e SysMenu) Update(c *gin.Context) {
// @Param data body dto.SysMenuById true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/menu [delete]
// @Security Bearer
func (e SysMenu) Delete(c *gin.Context) {
control := new(dto.SysMenuById)
s := new(service.SysMenu)
@@ -169,7 +168,7 @@ func (e SysMenu) Delete(c *gin.Context) {
err = s.Remove(control).Error
if err != nil {
e.Logger.Errorf("RemoveSysMenu error, %s", err)
e.Error(http.StatusInternalServerError, err, "删除失败")
e.Error(500, err, "删除失败")
return
}
e.OK(control.GetId(), "删除成功")
@@ -197,7 +196,7 @@ func (e SysMenu) GetMenuRole(c *gin.Context) {
result, err := s.SetMenuRole(user.GetRoleName(c))
if err != nil {
e.Error(http.StatusInternalServerError, err, "查询失败")
e.Error(500, err, "查询失败")
return
}
+11 -5
View File
@@ -30,10 +30,10 @@ type SysUser struct {
// @Security Bearer
func (e SysUser) GetPage(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserSearch{}
req := dto.SysUserGetPageReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.Form).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -63,7 +63,7 @@ func (e SysUser) GetPage(c *gin.Context) {
// @Tags 用户
// @Param userId path int true "用户编码"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sysUser/{userId} [get]
// @Router /api/v1/sys-user/{userId} [get]
// @Security Bearer
func (e SysUser) Get(c *gin.Context) {
s := service.SysUser{}
@@ -97,7 +97,8 @@ func (e SysUser) Get(c *gin.Context) {
// @Product application/json
// @Param data body dto.SysUserControl true "用户数据"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sysUser [post]
// @Router /api/v1/sys-user [post]
// @Security Bearer
func (e SysUser) Insert(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
@@ -132,12 +133,13 @@ func (e SysUser) Insert(c *gin.Context) {
// @Param data body dto.SysUserControl true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-user/{userId} [put]
// @Security Bearer
func (e SysUser) Update(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -166,6 +168,7 @@ func (e SysUser) Update(c *gin.Context) {
// @Param userId path int true "userId"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys-user/{userId} [delete]
// @Security Bearer
func (e SysUser) Delete(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserById{}
@@ -202,6 +205,7 @@ func (e SysUser) Delete(c *gin.Context) {
// @Param file formData file true "file"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/avatar [post]
// @Security Bearer
func (e SysUser) InsetAvatar(c *gin.Context) {
s := service.SysUser{}
req := dto.SysUserControl{}
@@ -250,6 +254,7 @@ func (e SysUser) InsetAvatar(c *gin.Context) {
// @Param data body dto.UpdateSysUserStatusReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/status [put]
// @Security Bearer
func (e SysUser) UpdateStatus(c *gin.Context) {
s := service.SysUser{}
req := dto.UpdateSysUserStatusReq{}
@@ -286,6 +291,7 @@ func (e SysUser) UpdateStatus(c *gin.Context) {
// @Param data body dto.ResetSysUserPwdReq true "body"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/pwd/reset [put]
// @Security Bearer
func (e SysUser) ResetPwd(c *gin.Context) {
s := service.SysUser{}
req := dto.ResetSysUserPwdReq{}