Esempio n. 1
0
 public function handle()
 {
     $method = $this->parameters->method;
     $methodConfig = $this->di->get('apiConfig')->method;
     if (!isset($methodConfig[$method])) {
         $this->error(ResultStatus::METHOD_NOT_EXIST, 'method不存在');
         return;
     }
     $classConfig = $methodConfig[$method];
     $classInstance = Util::NewInstance($classConfig->class, [$this->di, $this->parameters->postBody, $classConfig->offsetExists('config') ? $classConfig->config : [], $this->parameters, $this->apiAccess]);
     $classInstance->handle();
     $status = $classInstance->getStatus();
     if ($status == ResultStatus::SUCCESS) {
         $result = $classInstance->getResult();
         $this->setResponse($result);
     } else {
         $error = $classInstance->getError();
         $this->error($status, $error);
     }
 }