|
@@ -8,6 +8,7 @@ import (
|
|
|
"git.sxidc.com/go-tools/api_binding/http_binding/response"
|
|
|
"git.sxidc.com/go-tools/api_binding/utils"
|
|
|
"git.sxidc.com/service-supports/fserr"
|
|
|
+ "git.sxidc.com/service-supports/fslog"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
|
"reflect"
|
|
@@ -56,6 +57,14 @@ func (binding *Binding) AddHandler(method string, relativePath string, handleFun
|
|
|
return errors.New("没有传递处理函数")
|
|
|
}
|
|
|
|
|
|
+ routeInfos := routerInstance.Routes()
|
|
|
+ for _, routeInfo := range routeInfos {
|
|
|
+ if routeInfo.Method == method && strings.TrimPrefix(routeInfo.Path, binding.routerGroup.BasePath()+"/") == relativePath {
|
|
|
+ fslog.Error("添加的路径已存在: " + routeInfo.Path)
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
ginHandleFunctions := make([]gin.HandlerFunc, 0)
|
|
|
for _, handleFunction := range handleFunctions {
|