예제 #1
0
 function callJsonRPC($method, $params = null)
 {
     // check if the method exists...
     if (!$this->checkMethod($this->selectedGroup, $method)) {
         return null;
     }
     if (!$this->checkParams($this->selectedGroup, $method, $params)) {
         return array("result" => null, "error" => JsonRpc::getInvalidParamsError());
     }
     // load class
     $CI =& get_instance();
     $handlerClassName = $this->descriptors[$this->selectedGroup]["handlerClass"];
     $handlerClassNameLc = strtolower($handlerClassName);
     $CI->load->library('business/' . $handlerClassName);
     $result = $CI->{$handlerClassNameLc}->{$method}($params);
     $errorCode = $CI->{$handlerClassNameLc}->errorCode;
     $errorMessage = $CI->{$handlerClassNameLc}->errorMessage;
     return array("result" => $result, "error" => $errorCode != 0 ? array('code' => $errorCode, 'message' => $errorMessage) : null);
 }