Authored by 郭成尧

店铺简介搞定

@@ -30,7 +30,8 @@ class Yohobuy @@ -30,7 +30,8 @@ class Yohobuy
30 const API_OLD = 'http://api2.open.yohobuy.com/';*/ 30 const API_OLD = 'http://api2.open.yohobuy.com/';*/
31 31
32 // 测试环境 */ 32 // 测试环境 */
33 - const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/' 33 +// const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
  34 + const API_URL = 'http://devapi.yoho.cn:58078/'; // 'http://192.168.102.205:8080/gateway/'
34 const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; 35 const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
35 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 36 const YOHOBUY_URL = 'http://www.yohobuy.com/';
36 const API_OLD = 'http://test2.open.yohobuy.com/'; 37 const API_OLD = 'http://test2.open.yohobuy.com/';
@@ -12,7 +12,7 @@ namespace LibModels\Wap\Shop; @@ -12,7 +12,7 @@ namespace LibModels\Wap\Shop;
12 use Api\Yohobuy; 12 use Api\Yohobuy;
13 use Api\Sign; 13 use Api\Sign;
14 14
15 -class IntroData 15 +class ShopData
16 { 16 {
17 /** 17 /**
18 * 调取店铺简介数据 18 * 调取店铺简介数据
@@ -20,11 +20,20 @@ class IntroData @@ -20,11 +20,20 @@ class IntroData
20 * @param $shopId 20 * @param $shopId
21 * @return mixed 21 * @return mixed
22 */ 22 */
23 - public static function getShopIntro($shopId) 23 + public static function getShopIntro($shopId = 0)
  24 + {
  25 + $param = Yohobuy::param();
  26 + $param['method'] = 'app.shops.getIntro';
  27 + $param['shops_id'] = $shopId;
  28 + $param['client_secret'] = Sign::getSign($param);
  29 + return Yohobuy::get(Yohobuy::API_URL, $param);
  30 + }
  31 +
  32 + public static function getShopCategory($shopId = 0)
24 { 33 {
25 $param = Yohobuy::param(); 34 $param = Yohobuy::param();
26 $param['method'] = 'app.shop.getSortInfo'; 35 $param['method'] = 'app.shop.getSortInfo';
27 - $param['shop_id'] = $shopId; 36 + $param['shops_id'] = $shopId;
28 $param['client_secret'] = Sign::getSign($param); 37 $param['client_secret'] = Sign::getSign($param);
29 return Yohobuy::get(Yohobuy::API_URL, $param); 38 return Yohobuy::get(Yohobuy::API_URL, $param);
30 } 39 }
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 */ 8 */
9 9
10 use Action\AbstractAction; 10 use Action\AbstractAction;
11 -use LibModels\Wap\Shop\IntroData; 11 +use LibModels\Wap\Shop\ShopData;
12 12
13 class IndexController extends AbstractAction 13 class IndexController extends AbstractAction
14 { 14 {
@@ -39,7 +39,7 @@ class IndexController extends AbstractAction @@ -39,7 +39,7 @@ class IndexController extends AbstractAction
39 $result = array(); 39 $result = array();
40 // 假数据 40 // 假数据
41 $result = $this->getCategoryContent(); 41 $result = $this->getCategoryContent();
42 - $result2 = IntroData::getShopIntro(356); 42 + $result2 = ShopData::getShopIntro(356);
43 43
44 return $this->_view->display('category', array( 44 return $this->_view->display('category', array(
45 'content' => $result, 45 'content' => $result,
@@ -53,15 +53,18 @@ class IndexController extends AbstractAction @@ -53,15 +53,18 @@ class IndexController extends AbstractAction
53 */ 53 */
54 public function introAction() 54 public function introAction()
55 { 55 {
  56 + $requestData = filter_input_array(INPUT_GET, array(
  57 + 'shopId' => FILTER_DEFAULT,
  58 + ));
  59 + if (empty($requestData['shopId'])) {
  60 + $this->go(SITE_MAIN);
  61 + }
56 $result = array(); 62 $result = array();
57 // 假数据 63 // 假数据
58 - $result = $this->getIntroContent();  
59 -// $requestData = filter_input_array(INPUT_GET, array(  
60 -// 'shopId' => FILTER_DEFAULT,  
61 -// ));  
62 -// if (empty($requestData['shopId'])) {  
63 -// $this->go(SITE_MAIN);  
64 -// } 64 + $resource = ShopData::getShopIntro($requestData['shopId']);
  65 + if($resource['code'] === 200){
  66 + $result = $resource['data'];
  67 + }
65 return $this->_view->display('intro', array( 68 return $this->_view->display('intro', array(
66 'content' => $result, 69 'content' => $result,
67 )); 70 ));