/** * 执行请求 * @param TXRequest $request * @throws TXException * @return mixed */ private function call(TXRequest $request) { $module = $request->getModule() . 'Action'; $method = $request->getMethod(); $args = $this->getArgs($module, $method); $object = $this->getAction($module, $request); if ($object instanceof TXResponse || $object instanceof TXJSONResponse) { TXEvent::trigger(afterAction, array($request)); return $object; } if ($object instanceof TXAction) { $result = call_user_func_array([$object, $method], $args); TXEvent::trigger(afterAction, array($request)); return $result; } else { throw new TXException(2001, $request->getModule(), 404); } }