From d399c588ae758d4eae1370739fb770fbc21b3241 Mon Sep 17 00:00:00 2001 From: pixel <303176530@qq.com> Date: Thu, 2 Apr 2020 18:10:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86api=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=97=B6=E5=80=99=E5=8F=AF=E4=BB=A5=E9=87=8D=E5=A4=8D?= =?UTF-8?q?path=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QMPlusServer/controller/api/sys_casbin.go | 4 ++-- QMPlusServer/model/sysModel/sys_api.go | 4 ++++ QMPlusVuePage/src/utils/request.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/QMPlusServer/controller/api/sys_casbin.go b/QMPlusServer/controller/api/sys_casbin.go index dd80984d..b7d8d0c1 100644 --- a/QMPlusServer/controller/api/sys_casbin.go +++ b/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) { diff --git a/QMPlusServer/model/sysModel/sys_api.go b/QMPlusServer/model/sysModel/sys_api.go index ac6eb4a2..78867151 100644 --- a/QMPlusServer/model/sysModel/sys_api.go +++ b/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 diff --git a/QMPlusVuePage/src/utils/request.js b/QMPlusVuePage/src/utils/request.js index 01b66710..d75425f0 100644 --- a/QMPlusVuePage/src/utils/request.js +++ b/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({