Skip to content

Commit 16e0e98

Browse files
committed
修正路由绑定的参数丢失问题
1 parent a1958bf commit 16e0e98

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

library/think/route/Domain.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
class Domain extends RuleGroup
2222
{
23-
protected $bind;
2423

2524
/**
2625
* 架构函数
@@ -86,9 +85,7 @@ public function check($request, $url, $completeMatch = false)
8685
*/
8786
public function bind($bind)
8887
{
89-
$this->bind = $bind;
9088
$this->router->bind($bind, $this->domain);
91-
9289
return $this;
9390
}
9491

@@ -117,8 +114,9 @@ private function checkRouteAlias($request, $url)
117114
*/
118115
private function checkUrlBind($request, $url)
119116
{
120-
if (!empty($this->bind)) {
121-
$bind = $this->bind;
117+
$bind = $this->router->getBind($this->domain);
118+
119+
if (!empty($bind)) {
122120
$this->parseBindAppendParam($bind);
123121

124122
// 记录绑定信息
@@ -165,10 +163,10 @@ protected function bindToClass($request, $url, $class)
165163
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
166164

167165
if (!empty($array[1])) {
168-
$this->parseUrlParams($request, $array[1]);
166+
$this->parseUrlParams($request, $array[1], $param);
169167
}
170168

171-
return new CallbackDispatch($request, $this, [$class, $action]);
169+
return new CallbackDispatch($request, $this, [$class, $action], $param);
172170
}
173171

174172
/**
@@ -186,10 +184,10 @@ protected function bindToNamespace($request, $url, $namespace)
186184
$method = !empty($array[1]) ? $array[1] : $this->router->config('default_action');
187185

188186
if (!empty($array[2])) {
189-
$this->parseUrlParams($request, $array[2]);
187+
$this->parseUrlParams($request, $array[2], $param);
190188
}
191189

192-
return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method]);
190+
return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param);
193191
}
194192

195193
/**
@@ -206,10 +204,10 @@ protected function bindToController($request, $url, $controller)
206204
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
207205

208206
if (!empty($array[1])) {
209-
$this->parseUrlParams($request, $array[1]);
207+
$this->parseUrlParams($request, $array[1], $param);
210208
}
211209

212-
return new ControllerDispatch($request, $this, $controller . '/' . $action);
210+
return new ControllerDispatch($request, $this, $controller . '/' . $action, $param);
213211
}
214212

215213
/**
@@ -226,10 +224,10 @@ protected function bindToModule($request, $url, $controller)
226224
$action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
227225

228226
if (!empty($array[1])) {
229-
$this->parseUrlParams($request, $array[1]);
227+
$this->parseUrlParams($request, $array[1], $param);
230228
}
231229

232-
return new ModuleDispatch($request, $this, $controller . '/' . $action);
230+
return new ModuleDispatch($request, $this, $controller . '/' . $action, $param);
233231
}
234232

235233
}

0 commit comments

Comments
 (0)