1234567891011121314151617181920212223242526272829 |
- <?php
- namespace Thrift\Service;
- use Dever;
- $project = Dever::project('thrift');
- include $project['path'] . 'gen-php/DeverApi/ApiService.php';
- class Api implements \DeverApi\ApiServiceIf
- {
- public function get($api, $param = '')
- {
- $api = trim($api, '/');
- if (defined('DEVER_API_FILTER')) {
- $api = str_replace(DEVER_API_FILTER, '', $api);
- }
- $param = json_decode($param, true);
- array_unshift($param, $api);
- $result = call_user_func_array(array('Dever', 'load'), $param);
- #$result = Dever::load($api, $param);
- return Dever::out($result, array(), true);
- }
- public function start($process = 10)
- {
- $port = (isset($_ENV['ATOMPORT']) && $_ENV['ATOMPORT']) ? $_ENV['ATOMPORT'] : 8081;
- $server = new Server('socket', '0.0.0.0', $port, $process);
- $server->start('\DeverApi\ApiServiceProcessor', $this);
- }
- }
|