Authored by 周少峰

brand binds many shops

@@ -124,26 +124,7 @@ class ListData @@ -124,26 +124,7 @@ class ListData
124 $param['method'] = 'app.shop.getSortInfo'; 124 $param['method'] = 'app.shop.getSortInfo';
125 $param['shop_id'] = $shopId; 125 $param['shop_id'] = $shopId;
126 $param['client_secret'] = Sign::getSign($param); 126 $param['client_secret'] = Sign::getSign($param);
127 - //TODO  
128 - return Yohobuy::get(Yohobuy::API_URL, $param);  
129 -// return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache);  
130 - }  
131 -  
132 - /**  
133 - * 根据brandid获取相关店铺  
134 - * @param int $brandId  
135 - * @author sefon 2016-4-28 13:41:09  
136 - * @return array  
137 - */  
138 - public static function getShopByBrandId($brandId, $cache = 600)  
139 - {  
140 - $param = Yohobuy::param();  
141 - $param['method'] = 'app.shop.queryShopByBrandId';  
142 - $param['brand_id'] = $brandId;  
143 - $param['client_secret'] = Sign::getSign($param);  
144 - //TODO  
145 return Yohobuy::get(Yohobuy::API_URL, $param); 127 return Yohobuy::get(Yohobuy::API_URL, $param);
146 -// return Yohobuy::get('http://192.168.102.218:8080/gateway/', $param, $cache);  
147 } 128 }
148 129
149 } 130 }
@@ -148,4 +148,18 @@ class ShopData @@ -148,4 +148,18 @@ class ShopData
148 return Yohobuy::get(Yohobuy::API_URL, $param); 148 return Yohobuy::get(Yohobuy::API_URL, $param);
149 } 149 }
150 150
  151 + /**
  152 + * 根据brandid获取相关店铺
  153 + * @param int $brandId
  154 + * @author sefon 2016-4-28 13:41:09
  155 + * @return array
  156 + */
  157 + public static function getShopByBrandId($brandId, $cache = 600)
  158 + {
  159 + $param = Yohobuy::param();
  160 + $param['method'] = 'app.shop.queryShopsByBrandId';
  161 + $param['brand_id'] = $brandId;
  162 + $param['client_secret'] = Sign::getSign($param);
  163 + return Yohobuy::get(Yohobuy::API_URL, $param);
  164 + }
151 } 165 }
@@ -431,10 +431,18 @@ class ListModel @@ -431,10 +431,18 @@ class ListModel
431 * @author sefon 2016-4-28 13:38:23 431 * @author sefon 2016-4-28 13:38:23
432 * @return array 432 * @return array
433 */ 433 */
434 - public static function brandShop($brandId) 434 + public static function getBrandShops($brandId)
435 { 435 {
436 - $brandShop = ListData::getShopByBrandId($brandId);  
437 -// print_r($brandShop); exit; 436 + $result = array();
  437 + $brandShop = ShopData::getShopByBrandId(1559);
  438 + if (isset($brandShop['code']) && $brandShop['code'] && !empty($brandShop['data'])) {
  439 + foreach ($brandShop['data'] as $key => $val) {
  440 + $result[$key]['url'] = Helpers::url('/product/index/brand/', array('shop_id', $val['shop_id']));
  441 + $result[$key]['thumb'] = $val['brand_ico'];
  442 + $result[$key]['name'] = $val['brand_name'];
  443 + }
  444 + }
  445 + return $result;
438 } 446 }
439 447
440 /** 448 /**
@@ -133,6 +133,7 @@ class IndexController extends AbstractAction @@ -133,6 +133,7 @@ class IndexController extends AbstractAction
133 } 133 }
134 /* 品牌域名参数 @see Bootstrap.php */ 134 /* 品牌域名参数 @see Bootstrap.php */
135 $domain = $this->param('named'); 135 $domain = $this->param('named');
  136 + $domain = 'andybrier';
136 if (empty($domain)) { 137 if (empty($domain)) {
137 $this->go(SITE_MAIN); 138 $this->go(SITE_MAIN);
138 } 139 }
@@ -141,8 +142,7 @@ class IndexController extends AbstractAction @@ -141,8 +142,7 @@ class IndexController extends AbstractAction
141 // 存标题信息 142 // 存标题信息
142 $title = ''; 143 $title = '';
143 $brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title); 144 $brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title);
144 - //TODO 无店铺:0--->品牌页 无单品店有多品店:1--->搜索页 有单品店:2--->店铺页面  
145 - //TODO 通过品牌域名获取店铺shopId 先固定shopId = 672 145 + //无店铺:0--->品牌页 无单品店有多品店:1--->搜索页 有单品店:2--->店铺页面
146 // $brandLogo['shopId'] = 672; 146 // $brandLogo['shopId'] = 672;
147 // $brandLogo['type'] = 2; 147 // $brandLogo['type'] = 2;
148 if ($brandLogo['type'] == 2 && !empty($brandLogo['shopId'])) { 148 if ($brandLogo['type'] == 2 && !empty($brandLogo['shopId'])) {
@@ -153,7 +153,11 @@ class IndexController extends AbstractAction @@ -153,7 +153,11 @@ class IndexController extends AbstractAction
153 if ($brandLogo && isset($brandLogo['id'])) { 153 if ($brandLogo && isset($brandLogo['id'])) {
154 $brandId = $brandLogo['id']; 154 $brandId = $brandLogo['id'];
155 } 155 }
156 - 156 + //获取品牌店铺信息
  157 + $brandShop = $this->brandShop($brandId);
  158 + if (!empty($brandShop)) {
  159 + $brandLogo = $brandShop;
  160 + }
157 /* 搜索框相关 */ 161 /* 搜索框相关 */
158 $from = $this->get('from'); 162 $from = $this->get('from');
159 $query = $this->get('query'); 163 $query = $this->get('query');
@@ -542,294 +546,18 @@ class IndexController extends AbstractAction @@ -542,294 +546,18 @@ class IndexController extends AbstractAction
542 } while(false); 546 } while(false);
543 $this->echoJson($data); 547 $this->echoJson($data);
544 } 548 }
  549 +
  550 +
545 /** 551 /**
546 - * 店铺品牌首页  
547 - *  
548 - * @return mixed 552 + * 根据brandId 获取相关店铺列表
  553 + * @param int $brandId
  554 + * @author sefon 2016-4-28 13:38:23
  555 + * @return array
549 */ 556 */
550 - public function testAction() 557 + public static function brandShop($brandId)
551 { 558 {
552 -  
553 - $data = array(  
554 - 'shopId' => '104',  
555 - 'appVersion' => '123',  
556 - 'branerImg' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026e96d1b403d28407650c7228bb4ca405.jpg?imageView2/2/w/640/h/200',  
557 - 'logoImg' => '',  
558 - 'storeName' => 'Vans专营店',  
559 - 'collect' => false,  
560 - 'alreadyCollect' => 'product/collect.png',  
561 - 'notCollect' => '',  
562 - 'allGoods' => '',  
563 - 'goodList' => 'http://www.baidu.com',  
564 - 'brandList' => array(  
565 - 'list' => array(  
566 - array(  
567 - 'url' => '',  
568 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
569 - 'brandName' => '123re34456556900'  
570 - ),  
571 - array(  
572 - 'url' => '',  
573 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
574 - 'brandName' => '123re34456556900'  
575 - ),  
576 - array(  
577 - 'url' => '',  
578 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
579 - 'brandName' => '123re344565'  
580 - ),  
581 - array(  
582 - 'url' => '',  
583 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
584 - 'brandName' => '123re34456556900'  
585 - ),  
586 - array(  
587 - 'url' => '',  
588 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
589 - 'brandName' => '123re34456556900'  
590 - ),  
591 - array(  
592 - 'url' => '',  
593 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
594 - 'brandName' => '123re344565'  
595 - ),  
596 - array(  
597 - 'url' => '',  
598 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/18/05/026b9aee5b7d2ec33e8db877c3d87b3386.jpg?imageView2/2/w/640/h/403',  
599 - 'brandName' => '123re344565'  
600 - )  
601 - ),  
602 - 'url' => ''  
603 - ),  
604 - 'bannerTop' => array(  
605 - 'list' => array(  
606 - array(  
607 - 'url' => '',  
608 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200',  
609 - ),  
610 - array(  
611 - 'url' => '',  
612 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/19/11/02039485d87cc1b100b883244cf386e62d.jpg?imageView/2/w/640/h/200',  
613 - ),  
614 - )  
615 - ),  
616 - 'spring' => array(  
617 - array(  
618 - 'url' => '',  
619 - 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/01ea96f5fd2ea8ef99d37d00f39d8e57f0.jpg?imageView/2/w/275/h/160'  
620 - ),  
621 - array(  
622 - 'url' => '',  
623 - 'springType' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160'  
624 - )  
625 - ),  
626 - 'hotCategory' => array(  
627 - 'name' => '热门品类',  
628 - 'list' => array(  
629 - array(  
630 - 'url' => '',  
631 - 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/27/03/02727a01918939223937019a3f9114ee19.jpg?imageView/2/w/140/h/140',  
632 - ),  
633 - array(  
634 - 'url' => 'http://img12.static.yhbimg.com/yhb-img01/2016/04/27/03/02727a01918939223937019a3f9114ee19.jpg?imageView/2/w/140/h/140',  
635 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
636 - ),  
637 - array(  
638 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
639 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
640 - ),  
641 - array(  
642 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
643 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
644 - ),  
645 - array(  
646 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
647 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
648 - ),  
649 - array(  
650 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
651 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
652 - ),  
653 - array(  
654 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
655 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
656 - ),  
657 - array(  
658 - 'url' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
659 - 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/12/29/08/019c44dcf0a93e9f3afe2fbec0d1961046.jpg?imageView/2/w/275/h/160',  
660 - )  
661 - )  
662 - ),  
663 - 'hotList' => array(  
664 - array(  
665 - 'url' => '',  
666 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
667 - 'productName' => 'Vans专营店',  
668 - 'originalPrice' => '¥599.00',  
669 - 'presentPrice' => '¥399.00'  
670 - ),  
671 - array(  
672 - 'url' => '',  
673 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
674 - 'productName' => 'Vans专营店',  
675 - 'originalPrice' => '¥599',  
676 - 'presentPrice' => '¥399'  
677 - ),  
678 - array(  
679 - 'url' => '',  
680 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
681 - 'productName' => 'Vans专营店',  
682 - 'originalPrice' => '¥599',  
683 - 'presentPrice' => '¥399'  
684 - ),  
685 - array(  
686 - 'url' => '',  
687 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
688 - 'productName' => 'Vans专营店',  
689 - 'originalPrice' => '¥599',  
690 - 'presentPrice' => '¥399'  
691 - ),  
692 - array(  
693 - 'url' => '',  
694 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
695 - 'productName' => 'Vans专营店',  
696 - 'originalPrice' => '¥599.00',  
697 - 'presentPrice' => '¥399.00'  
698 - ),  
699 - array(  
700 - 'url' => '',  
701 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
702 - 'productName' => 'Vans专营店',  
703 - 'originalPrice' => '¥599',  
704 - 'presentPrice' => '¥399'  
705 - ),  
706 - array(  
707 - 'url' => '',  
708 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
709 - 'productName' => 'Vans专营店',  
710 - 'originalPrice' => '¥599',  
711 - 'presentPrice' => '¥399'  
712 - ),  
713 - array(  
714 - 'url' => '',  
715 - 'listUrl' => 'http://img11.static.yhbimg.com/goodsimg/2016/04/07/07/0147c904336407bb9f4008bfda7920b9bd.jpg?imageMogr2/thumbnail/276x366/extent/276x366/background/d2hpdGU=/position/center/quality/80',  
716 - 'productName' => 'Vans专营店',  
717 - 'originalPrice' => '¥599',  
718 - 'presentPrice' => '¥399'  
719 - )  
720 - ),  
721 - 'goods' => array(  
722 - array(  
723 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
724 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
725 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
726 - 'salePrice' => '759.00',  
727 - 'price' => '799.00',  
728 - 'tags' => array(  
729 - 'is_new' => false,  
730 - 'is_advance' => true,  
731 - 'is_discount' => false,  
732 - 'is_yohoood' => false,  
733 - 'is_limited' => false  
734 - ),  
735 - 'is_soon_sold_out' => false  
736 - ),  
737 - array(  
738 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
739 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
740 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
741 - 'salePrice' => '759.00',  
742 - 'price' => '799.00',  
743 - 'tags' => array(  
744 - 'is_new' => true,  
745 - 'is_advance' => false,  
746 - 'is_discount' => false,  
747 - 'is_yohoood' => false,  
748 - 'is_limited' => false  
749 - ),  
750 - 'is_soon_sold_out' => false  
751 - ),  
752 - array(  
753 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
754 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
755 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
756 - 'salePrice' => '759.00',  
757 - 'price' => '799.00',  
758 - 'tags' => array(  
759 - 'is_new' => true,  
760 - 'is_advance' => false,  
761 - 'is_discount' => false,  
762 - 'is_yohoood' => false,  
763 - 'is_limited' => false  
764 - ),  
765 - 'is_soon_sold_out' => false  
766 - ),  
767 - array(  
768 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
769 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
770 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
771 - 'salePrice' => '759.00',  
772 - 'price' => '799.00',  
773 - 'tags' => array(  
774 - 'is_new' => true,  
775 - 'is_advance' => false,  
776 - 'is_discount' => false,  
777 - 'is_yohoood' => false,  
778 - 'is_limited' => false  
779 - ),  
780 - 'is_soon_sold_out' => false  
781 - ),  
782 - array(  
783 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
784 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
785 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
786 - 'salePrice' => '759.00',  
787 - 'price' => '799.00',  
788 - 'tags' => array(  
789 - 'is_new' => true,  
790 - 'is_advance' => false,  
791 - 'is_discount' => false,  
792 - 'is_yohoood' => false,  
793 - 'is_limited' => false  
794 - ),  
795 - 'is_soon_sold_out' => false  
796 - ),  
797 - array(  
798 - 'url' => 'http://m.yohobuy.com/product/pro_320421_412063/SYSTAGYuanLingWeiYiSYSA601HC09.html',  
799 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/12/07/09/01ced0e2ed6a4f2a6d95be70cd0a6c5a56.jpg?imageView/2/w/235/h/314',  
800 - 'name' => 'NEFF ONE OF US RAGLAN L/S 男款森林风连帽卫衣',  
801 - 'salePrice' => '759.00',  
802 - 'price' => '799.00',  
803 - 'tags' => array(  
804 - 'is_new' => true,  
805 - 'is_advance' => false,  
806 - 'is_discount' => false,  
807 - 'is_yohoood' => false,  
808 - 'is_limited' => false  
809 - ),  
810 - 'is_soon_sold_out' => false  
811 - )  
812 - ),  
813 - 'filter' => array(  
814 - 'classify' => array(  
815 - array(  
816 - 'default' => true,  
817 - 'title' => 'aaa',  
818 - 'name' => 'name',  
819 - 'dataType' => '1',  
820 - 'subs' => array(  
821 - 'chosed' => true,  
822 - 'dataId' => '1',  
823 - 'name' => 'bbb',  
824 - )  
825 - )  
826 - )  
827 - )  
828 - );  
829 -  
830 - return $this->_view->display('shop', array(  
831 - 'shopIndex' => $data,  
832 - 'shopPage' => true  
833 - )); 559 + //TODO 1559
  560 + return ListModel::getBrandShops($brandId);
834 } 561 }
  562 +
835 } 563 }