Browse Source

修复了api设置时候可以重复path的bug

main
pixel 5 years ago
parent
commit
d399c588ae
  1. 4
      QMPlusServer/controller/api/sys_casbin.go
  2. 4
      QMPlusServer/model/sysModel/sys_api.go
  3. 2
      QMPlusVuePage/src/utils/request.js

4
QMPlusServer/controller/api/sys_casbin.go

@ -31,7 +31,7 @@ func CasbinPUpdata(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityParams true "获取权限列表"
// @Param data body sysModel.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/getPolicyPathByAuthorityId [post]
func GetPolicyPathByAuthorityId(c *gin.Context) {
@ -46,7 +46,7 @@ func GetPolicyPathByAuthorityId(c *gin.Context) {
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.CreateAuthorityParams true "获取权限列表"
// @Param data body sysModel.CasbinInReceive true "获取权限列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/CasbinTest [get]
func CasbinTest(c *gin.Context) {

4
QMPlusServer/model/sysModel/sys_api.go

@ -37,6 +37,10 @@ func (a *SysApi) DeleteApi() (err error) {
//更新api
func (a *SysApi) UpdataApi() (err error) {
var oldA SysApi
flag := qmsql.DEFAULTDB.Where("path = ?", a.Path).RecordNotFound()
if !flag {
return errors.New("存在相同api路径")
}
err = qmsql.DEFAULTDB.Where("id = ?", a.ID).First(&oldA).Error
if err != nil {
return err

2
QMPlusVuePage/src/utils/request.js

@ -55,7 +55,7 @@ service.interceptors.request.use(
service.interceptors.response.use(
response => {
closeLoading()
if (response.data.success || response.headers.success==="true") {
if (response.data.success || response.headers.success === "true") {
return response.data
} else {
Message({

Loading…
Cancel
Save