Authored by hf

do guang plusstar test use rpc yar call service

... ... @@ -240,4 +240,22 @@ class Yohobuy
return $result;
}
/**
* rpc调用远程服务(YAR)
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @return array
*/
public static function yarClient($uri, $method, $data = array(), $timeout = 3000)
{
$client = new \Yar_Client($uri);
$client->SetOpt(YAR_OPT_PACKAGER, 'php');
$client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, $timeout);
$result = $client->$method($data);
return $result;
}
}
... ...
<?php
namespace LibModels\Wap\Product;
use Api\Sign;
... ... @@ -15,6 +16,7 @@ use Api\Yohobuy;
*/
class RecomData
{
/**
* 你可能喜欢的BOYS或GIRLS的商品列表
*
... ... @@ -76,4 +78,3 @@ class RecomData
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\RecomData;
use Api\Yohobuy;
/**
* 频道选择
... ... @@ -11,5 +11,7 @@ class IndexController extends AbstractAction
{
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', array('test' => 'hello world'));
//$test = Yohobuy::yarClient('http://service.api.yohobuy.com/guang/service/v1/plustar/', 'getBrandInfo', array('id' => 289));
}
}
\ No newline at end of file
... ...