REST
服务提供商代码MathService
/**
* Http Add
*/
public function http_add()
{
$one = $this->http_input->get('one');
$two = $this->http_input->get('two');
$this->http_output->end($one+$two);
}
服务调用放代码
public function http_testREST()
{
$rest = ConsulServices::getInstance()->getRESTService('MathService', $this->context);
$rest->setQuery(['one' => 1, 'two' => 2]);
$reuslt = yield $rest->add();
$this->http_output->end($reuslt['body']);
}