|
@@ -124,7 +124,7 @@ class Dispatcher
|
|
|
$this->controllerCls->controller = $controllerCls;
|
|
|
$this->controllerCls->controllerId = $controller;
|
|
|
$this->controllerCls->actionId = $action;
|
|
|
-
|
|
|
+ $realAction = $action . Register::get(Consts::APP_DEFAULT_ACTION_SUFFIX);
|
|
|
//查看是否设置了当前action的对应关系,如果设置了就走对应关系里边的,否则走当前类中的
|
|
|
if ($this->controllerCls->actions
|
|
|
&& isset($this->controllerCls->actions[$action])
|
|
@@ -138,8 +138,8 @@ class Dispatcher
|
|
|
$this->actionCls->actionId = $action;
|
|
|
$this->actionCls->controllerId = $this->controllerCls->controllerId;
|
|
|
//支持多个action对应到同一个文件,如果对应的文件中存在指定的方法就直接调用
|
|
|
- if (method_exists($this->actionCls, $action . Register::get(Consts::APP_DEFAULT_ACTION_SUFFIX))) {
|
|
|
- $this->actionCls->response = call_user_func_array(array($this->actionCls, $action. Register::get(Consts::APP_DEFAULT_ACTION_SUFFIX)), $funcArgs);
|
|
|
+ if (method_exists($this->actionCls, $realAction)) {
|
|
|
+ $this->actionCls->response = call_user_func_array(array($this->actionCls, $realAction), $funcArgs);
|
|
|
}
|
|
|
if(method_exists($this->actionCls, 'initialization')) {
|
|
|
call_user_func_array(array($this->actionCls, 'initialization'), array($this->actionCls));
|
|
@@ -153,10 +153,10 @@ class Dispatcher
|
|
|
call_user_func_array(array($this->controllerCls, 'initialization'), array($this->controllerCls));
|
|
|
}
|
|
|
array_shift($funcArgs);
|
|
|
- $actionName = $action . Register::get(Consts::APP_DEFAULT_ACTION_SUFFIX);
|
|
|
- if (!method_exists($this->controllerCls, $actionName) && !method_exists($this->controllerCls, '__call')) {
|
|
|
- throw new MethodNotFound(\Qii::i(1101, $controller . '->' . $actionName), __LINE__);
|
|
|
+
|
|
|
+ if (!method_exists($this->controllerCls, $realAction) && !method_exists($this->controllerCls, '__call')) {
|
|
|
+ throw new MethodNotFound(\Qii::i(1101, $controller . '->' . $realAction), __LINE__);
|
|
|
}
|
|
|
- return call_user_func_array(array($this->controllerCls, $actionName), $funcArgs);
|
|
|
+ return call_user_func_array(array($this->controllerCls, $realAction), $funcArgs);
|
|
|
}
|
|
|
}
|