提交 8de8cbbd 编写于 作者: V v_anxiong

api/v1/sys_api.go api/v1/sys_menu.go api/v1/sys_user.go...

api/v1/sys_api.go api/v1/sys_menu.go api/v1/sys_user.go model/request/common.go 其中的参数校验代码Id改成ID,修复参数校验的bug
上级 2a8e09f2
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"gin-vue-admin/model/response" "gin-vue-admin/model/response"
"gin-vue-admin/service" "gin-vue-admin/service"
"gin-vue-admin/utils" "gin-vue-admin/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
) )
...@@ -100,7 +101,7 @@ func GetApiById(c *gin.Context) { ...@@ -100,7 +101,7 @@ func GetApiById(c *gin.Context) {
response.FailWithMessage(err.Error(), c) response.FailWithMessage(err.Error(), c)
return return
} }
err, api := service.GetApiById(idInfo.Id) err, api := service.GetApiById(idInfo.ID)
if err != nil { if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c) response.FailWithMessage("获取失败", c)
......
...@@ -7,6 +7,7 @@ import ( ...@@ -7,6 +7,7 @@ import (
"gin-vue-admin/model/response" "gin-vue-admin/model/response"
"gin-vue-admin/service" "gin-vue-admin/service"
"gin-vue-admin/utils" "gin-vue-admin/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
) )
...@@ -132,7 +133,7 @@ func DeleteBaseMenu(c *gin.Context) { ...@@ -132,7 +133,7 @@ func DeleteBaseMenu(c *gin.Context) {
response.FailWithMessage(err.Error(), c) response.FailWithMessage(err.Error(), c)
return return
} }
if err := service.DeleteBaseMenu(menu.Id); err != nil { if err := service.DeleteBaseMenu(menu.ID); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c) response.FailWithMessage("删除失败", c)
} else { } else {
...@@ -182,7 +183,7 @@ func GetBaseMenuById(c *gin.Context) { ...@@ -182,7 +183,7 @@ func GetBaseMenuById(c *gin.Context) {
response.FailWithMessage(err.Error(), c) response.FailWithMessage(err.Error(), c)
return return
} }
if err, menu := service.GetBaseMenuById(idInfo.Id); err != nil { if err, menu := service.GetBaseMenuById(idInfo.ID); err != nil {
global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
response.FailWithMessage("获取失败", c) response.FailWithMessage("获取失败", c)
} else { } else {
...@@ -214,6 +215,6 @@ func GetMenuList(c *gin.Context) { ...@@ -214,6 +215,6 @@ func GetMenuList(c *gin.Context) {
Total: total, Total: total,
Page: pageInfo.Page, Page: pageInfo.Page,
PageSize: pageInfo.PageSize, PageSize: pageInfo.PageSize,
},"获取成功", c) }, "获取成功", c)
} }
} }
\ No newline at end of file
...@@ -8,11 +8,12 @@ import ( ...@@ -8,11 +8,12 @@ import (
"gin-vue-admin/model/response" "gin-vue-admin/model/response"
"gin-vue-admin/service" "gin-vue-admin/service"
"gin-vue-admin/utils" "gin-vue-admin/utils"
"time"
"github.com/dgrijalva/jwt-go" "github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-redis/redis" "github.com/go-redis/redis"
"go.uber.org/zap" "go.uber.org/zap"
"time"
) )
// @Tags Base // @Tags Base
...@@ -217,11 +218,11 @@ func DeleteUser(c *gin.Context) { ...@@ -217,11 +218,11 @@ func DeleteUser(c *gin.Context) {
return return
} }
jwtId := getUserID(c) jwtId := getUserID(c)
if jwtId == uint(reqId.Id) { if jwtId == uint(reqId.ID) {
response.FailWithMessage("删除失败, 自杀失败", c) response.FailWithMessage("删除失败, 自杀失败", c)
return return
} }
if err := service.DeleteUser(reqId.Id); err != nil { if err := service.DeleteUser(reqId.ID); err != nil {
global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
response.FailWithMessage("删除失败", c) response.FailWithMessage("删除失败", c)
} else { } else {
......
...@@ -8,7 +8,7 @@ type PageInfo struct { ...@@ -8,7 +8,7 @@ type PageInfo struct {
// Find by id structure // Find by id structure
type GetById struct { type GetById struct {
Id float64 `json:"id" form:"id"` ID float64 `json:"id" form:"id"`
} }
type IdsReq struct { type IdsReq struct {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册