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 // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce 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":"获取成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/getPolicyPathByAuthorityId [post] // @Router /casbin/getPolicyPathByAuthorityId [post]
func GetPolicyPathByAuthorityId(c *gin.Context) { func GetPolicyPathByAuthorityId(c *gin.Context) {
@ -46,7 +46,7 @@ func GetPolicyPathByAuthorityId(c *gin.Context) {
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @accept application/json // @accept application/json
// @Produce 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":"获取成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /casbin/CasbinTest [get] // @Router /casbin/CasbinTest [get]
func CasbinTest(c *gin.Context) { func CasbinTest(c *gin.Context) {

4
QMPlusServer/model/sysModel/sys_api.go

@ -37,6 +37,10 @@ func (a *SysApi) DeleteApi() (err error) {
//更新api //更新api
func (a *SysApi) UpdataApi() (err error) { func (a *SysApi) UpdataApi() (err error) {
var oldA SysApi 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 err = qmsql.DEFAULTDB.Where("id = ?", a.ID).First(&oldA).Error
if err != nil { if err != nil {
return err return err

2
QMPlusVuePage/src/utils/request.js

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

Loading…
Cancel
Save