Exemplo n.º 1
0
 /**
  * 获取控制器
  * @param \CatLib\Constraint\Network\IRequest $request 请求数据
  * @return array()
  */
 protected function getController(IRequest $request)
 {
     $match = $this->router->match($request->packet()->protoID());
     $namespace = Server::isTask() ? $this->namespaceTask : $this->namespace;
     if ($match != null) {
         $cls = $namespace . $match["controller"];
         $func = $match["func"];
     } else {
         $cls = $namespace . $request->protoName();
         $func = $this->func;
     }
     $controller = $this->app[$cls];
     if ($controller instanceof Controller) {
         return [$controller, $func];
     }
     return [null, $func];
 }