Skip to content
Snippets Groups Projects
Commit a48b9edc authored by william feng's avatar william feng
Browse files

reduce cognitive in base_directory.go

parent 248314af
Branches
Tags
No related merge requests found
...@@ -116,15 +116,12 @@ func (dir *BaseDirectory) isProperRouter(url *common.URL) bool { ...@@ -116,15 +116,12 @@ func (dir *BaseDirectory) isProperRouter(url *common.URL) bool {
if serviceKey == "" { if serviceKey == "" {
serviceKey = dir.GetUrl().SubURL.ServiceKey() serviceKey = dir.GetUrl().SubURL.ServiceKey()
} }
if len(app) > 0 { if len(app) > 0 && app != dir.GetUrl().GetParam(constant.APPLICATION_KEY, "") {
if app != dir.GetUrl().GetParam(constant.APPLICATION_KEY, "") {
return false return false
} }
} else {
if url.ServiceKey() != serviceKey { if url.ServiceKey() != serviceKey {
return false return false
} }
}
return true return true
} }
......
...@@ -117,13 +117,11 @@ func NewConditionRouter(url *common.URL) (*ConditionRouter, error) { ...@@ -117,13 +117,11 @@ func NewConditionRouter(url *common.URL) (*ConditionRouter, error) {
} }
router.url = url router.url = url
var defaultPriority int64 var defaultPriority int64 = 0
if url.GetParam(constant.APPLICATION_KEY, "") != "" { if url.GetParam(constant.APPLICATION_KEY, "") != "" {
defaultPriority = 150 defaultPriority = 150
} else if url.GetParam(constant.INTERFACE_KEY, "") != "" { } else if url.GetParam(constant.INTERFACE_KEY, "") != "" {
defaultPriority = 140 defaultPriority = 140
} else {
defaultPriority = 0
} }
router.priority = url.GetParamInt(constant.RouterPriority, defaultPriority) router.priority = url.GetParamInt(constant.RouterPriority, defaultPriority)
router.Force = url.GetParamBool(constant.RouterForce, false) router.Force = url.GetParamBool(constant.RouterForce, false)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment