Authored by hf

do guang plusstar test use rpc yar call service

... ... @@ -239,5 +239,23 @@ 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的商品列表
*
... ... @@ -33,10 +35,10 @@ class RecomData
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, true);
}
/**
* 你可能喜欢的潮童的商品列表
*
... ... @@ -55,7 +57,7 @@ class RecomData
return Yohobuy::get(Yohobuy::API_URL, $param, true);
}
/**
* 你可能喜欢的创意生活的新品到着和人气单品列表
*
... ... @@ -74,6 +76,5 @@ class RecomData
return Yohobuy::get(Yohobuy::API_URL, $param, true);
}
}
}
... ...
<?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
... ...