Authored by hf

do guang plusstar test use rpc yar call service

@@ -240,4 +240,22 @@ class Yohobuy @@ -240,4 +240,22 @@ class Yohobuy
240 return $result; 240 return $result;
241 } 241 }
242 242
  243 + /**
  244 + * rpc调用远程服务(YAR)
  245 + *
  246 + * @see http://php.net/manual/zh/yar-client.setopt.php
  247 + * @return array
  248 + */
  249 + public static function yarClient($uri, $method, $data = array(), $timeout = 3000)
  250 + {
  251 + $client = new \Yar_Client($uri);
  252 + $client->SetOpt(YAR_OPT_PACKAGER, 'php');
  253 + $client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
  254 + $client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, $timeout);
  255 +
  256 + $result = $client->$method($data);
  257 +
  258 + return $result;
  259 + }
  260 +
243 } 261 }
1 <?php 1 <?php
  2 +
2 namespace LibModels\Wap\Product; 3 namespace LibModels\Wap\Product;
3 4
4 use Api\Sign; 5 use Api\Sign;
@@ -15,6 +16,7 @@ use Api\Yohobuy; @@ -15,6 +16,7 @@ use Api\Yohobuy;
15 */ 16 */
16 class RecomData 17 class RecomData
17 { 18 {
  19 +
18 /** 20 /**
19 * 你可能喜欢的BOYS或GIRLS的商品列表 21 * 你可能喜欢的BOYS或GIRLS的商品列表
20 * 22 *
@@ -76,4 +78,3 @@ class RecomData @@ -76,4 +78,3 @@ class RecomData
76 } 78 }
77 79
78 } 80 }
79 -  
1 <?php 1 <?php
2 use Action\AbstractAction; 2 use Action\AbstractAction;
3 -use LibModels\Wap\Product\RecomData; 3 +use Api\Yohobuy;
4 4
5 /** 5 /**
6 * 频道选择 6 * 频道选择
@@ -11,5 +11,7 @@ class IndexController extends AbstractAction @@ -11,5 +11,7 @@ class IndexController extends AbstractAction
11 { 11 {
12 $this->_view->assign('title', 'YOHO!有货'); 12 $this->_view->assign('title', 'YOHO!有货');
13 $this->_view->display('index', array('test' => 'hello world')); 13 $this->_view->display('index', array('test' => 'hello world'));
  14 +
  15 + //$test = Yohobuy::yarClient('http://service.api.yohobuy.com/guang/service/v1/plustar/', 'getBrandInfo', array('id' => 289));
14 } 16 }
15 } 17 }