123456789101112131415161718192021222324252627 |
- <?php
- namespace Thrift\Service;
- use Dever;
- $project = Dever::project('thrift');
- include_once $project['path'] . 'gen-php/DeverApi/ApiService.php';
- class Get
- {
- public function get($api, $param = '')
- {
- $port = (isset($_ENV['ATOMPORT']) && $_ENV['ATOMPORT']) ? $_ENV['ATOMPORT'] : 8081;
- $thrift = new Client('socket', '0.0.0.0', $port);
- return $thrift->get('\DeverApi\ApiServiceClient', array($this, 'handle'),array($api, $param));
- }
- public function handle($client, $api, $param = '')
- {
- $param = json_encode($param);
- return $client->get($api, $param);
- }
- public function test($id)
- {
- return array('id' => $id);
- }
- }
|