Get.php 697 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Thrift\Service;
  3. use Dever;
  4. $project = Dever::project('thrift');
  5. include_once $project['path'] . 'gen-php/DeverApi/ApiService.php';
  6. class Get
  7. {
  8. public function get($api, $param = '')
  9. {
  10. $port = (isset($_ENV['ATOMPORT']) && $_ENV['ATOMPORT']) ? $_ENV['ATOMPORT'] : 8081;
  11. $thrift = new Client('socket', '0.0.0.0', $port);
  12. return $thrift->get('\DeverApi\ApiServiceClient', array($this, 'handle'),array($api, $param));
  13. }
  14. public function handle($client, $api, $param = '')
  15. {
  16. $param = json_encode($param);
  17. return $client->get($api, $param);
  18. }
  19. public function test($id)
  20. {
  21. return array('id' => $id);
  22. }
  23. }