示例#1
0
文件: API.php 项目: HuangStomach/gini
 public function __index()
 {
     $request = @json_decode(\Gini\CGI::content(), true);
     if ($request === null) {
         $response = ['jsonrpc' => '2.0', 'error' => ['code' => -32700, 'message' => 'Parse error'], 'id' => $id];
     } else {
         $response = \Gini\API::dispatch((array) $request);
     }
     return \Gini\IoC::construct('\\Gini\\CGI\\Response\\JSON', $response);
 }
示例#2
0
 private function _testCall($method, $params)
 {
     $apiData = ['jsonrpc' => '2.0', 'method' => $method, 'params' => $params, 'id' => uniqid()];
     $response = \Gini\API::dispatch($apiData);
     $this->assertSame($params[0], $response['result'], 'call ' . $method);
 }