Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into feature/web-list
Showing
12 changed files
with
211 additions
and
462 deletions
| @@ -67,7 +67,7 @@ class BrandData | @@ -67,7 +67,7 @@ class BrandData | ||
| 67 | */ | 67 | */ |
| 68 | public static function getBrandLogo($brandId) | 68 | public static function getBrandLogo($brandId) |
| 69 | { | 69 | { |
| 70 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId )); | 70 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId)); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| @@ -78,7 +78,7 @@ class BrandData | @@ -78,7 +78,7 @@ class BrandData | ||
| 78 | */ | 78 | */ |
| 79 | public static function getBrandLogoByDomain($domain) | 79 | public static function getBrandLogoByDomain($domain) |
| 80 | { | 80 | { |
| 81 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain )); | 81 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByDomain', array($domain)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /** | 84 | /** |
| @@ -88,9 +88,9 @@ class BrandData | @@ -88,9 +88,9 @@ class BrandData | ||
| 88 | * @param int $status 状态 | 88 | * @param int $status 状态 |
| 89 | * @return array | 89 | * @return array |
| 90 | */ | 90 | */ |
| 91 | - public static function getFolderByBrand($brand_id,$status = 1) | 91 | + public static function getFolderByBrand($brand_id, $status = 1) |
| 92 | { | 92 | { |
| 93 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id,$status )); | 93 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_FOLDER, 'getFolderByBrand', array($brand_id, $status)); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | /** | 96 | /** |
| @@ -99,8 +99,38 @@ class BrandData | @@ -99,8 +99,38 @@ class BrandData | ||
| 99 | * @param string $mode | 99 | * @param string $mode |
| 100 | * @return mixed | 100 | * @return mixed |
| 101 | */ | 101 | */ |
| 102 | - public static function getByNodeContent($node, $mode='release') | 102 | + public static function getByNodeContent($node, $mode = 'release') |
| 103 | { | 103 | { |
| 104 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode)); | 104 | return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_NODECONTENT, 'getByNodeContent', array($node, $mode)); |
| 105 | } | 105 | } |
| 106 | + | ||
| 107 | + /* | ||
| 108 | + * 品牌一览资源位banner | ||
| 109 | + * @param string $contentCode 获取广告资源需要的位置码 | ||
| 110 | + * @param int $channel 频道标识 1:男,2:女,3:潮童,4:创意生活 | ||
| 111 | + * @return array( | ||
| 112 | + * "brandTop": "顶部的轮翻广告及热门品牌数据", | ||
| 113 | + * "brandList": "按字母'A-Z'分组的品牌列表数据" | ||
| 114 | + * ) | ||
| 115 | + */ | ||
| 116 | + | ||
| 117 | + public static function getTopBanner($contentCode,$channel) | ||
| 118 | + { | ||
| 119 | + /* 顶部的轮翻广告及热门品牌数据 */ | ||
| 120 | + $param = Yohobuy::param(); | ||
| 121 | + $param['content_code'] = $contentCode; | ||
| 122 | + $param['client_secret'] = Sign::getSign($param); | ||
| 123 | + $urlList['brandTop'] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . self::URI_BRAND_TOPPOS, $param); | ||
| 124 | + | ||
| 125 | + /* 按字母"A-Z"分组的品牌列表数据 */ | ||
| 126 | + $param = Yohobuy::param(); | ||
| 127 | + $param['method'] = 'app.brand.brandlist'; | ||
| 128 | + $param['yh_channel'] = $channel; | ||
| 129 | + $param['client_secret'] = Sign::getSign($param); | ||
| 130 | + $urlList['brandList'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
| 131 | + | ||
| 132 | + return Yohobuy::getMulti($urlList, array(), 3600); // 有缓存1小时 | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + | ||
| 106 | } | 136 | } |
| @@ -35,6 +35,7 @@ class Cache | @@ -35,6 +35,7 @@ class Cache | ||
| 35 | */ | 35 | */ |
| 36 | public static function set($key, $value, $expire = 3600) | 36 | public static function set($key, $value, $expire = 3600) |
| 37 | { | 37 | { |
| 38 | + if(USE_CACHE) { | ||
| 38 | try { | 39 | try { |
| 39 | // WINDOWS | 40 | // WINDOWS |
| 40 | if (DIRECTORY_SEPARATOR === '\\') { | 41 | if (DIRECTORY_SEPARATOR === '\\') { |
| @@ -50,6 +51,7 @@ class Cache | @@ -50,6 +51,7 @@ class Cache | ||
| 50 | // do nothing | 51 | // do nothing |
| 51 | } | 52 | } |
| 52 | } | 53 | } |
| 54 | + } | ||
| 53 | 55 | ||
| 54 | /** | 56 | /** |
| 55 | * 获取缓存 | 57 | * 获取缓存 |
| @@ -61,7 +63,7 @@ class Cache | @@ -61,7 +63,7 @@ class Cache | ||
| 61 | public static function get($key, $node = 'master') | 63 | public static function get($key, $node = 'master') |
| 62 | { | 64 | { |
| 63 | $result = array(); | 65 | $result = array(); |
| 64 | - | 66 | + if(USE_CACHE) { |
| 65 | try { | 67 | try { |
| 66 | // WINDOWS | 68 | // WINDOWS |
| 67 | if (DIRECTORY_SEPARATOR === '\\') { | 69 | if (DIRECTORY_SEPARATOR === '\\') { |
| @@ -74,7 +76,7 @@ class Cache | @@ -74,7 +76,7 @@ class Cache | ||
| 74 | } catch (Exception $e) { | 76 | } catch (Exception $e) { |
| 75 | $result = array(); | 77 | $result = array(); |
| 76 | } | 78 | } |
| 77 | - | 79 | + } |
| 78 | return $result; | 80 | return $result; |
| 79 | } | 81 | } |
| 80 | 82 | ||
| @@ -86,6 +88,7 @@ class Cache | @@ -86,6 +88,7 @@ class Cache | ||
| 86 | */ | 88 | */ |
| 87 | public static function delete($key) | 89 | public static function delete($key) |
| 88 | { | 90 | { |
| 91 | + if(USE_CACHE) { | ||
| 89 | // WINDOWS | 92 | // WINDOWS |
| 90 | if (DIRECTORY_SEPARATOR === '\\') { | 93 | if (DIRECTORY_SEPARATOR === '\\') { |
| 91 | HoodCache::Memcache('master')->delete(self::makeKey($key, 'master')); | 94 | HoodCache::Memcache('master')->delete(self::makeKey($key, 'master')); |
| @@ -97,6 +100,7 @@ class Cache | @@ -97,6 +100,7 @@ class Cache | ||
| 97 | HoodCache::Memcached('slave')->delete(self::makeKey($key, 'slave')); | 100 | HoodCache::Memcached('slave')->delete(self::makeKey($key, 'slave')); |
| 98 | } | 101 | } |
| 99 | } | 102 | } |
| 103 | + } | ||
| 100 | 104 | ||
| 101 | /** | 105 | /** |
| 102 | * 生成键名 | 106 | * 生成键名 |
| @@ -292,7 +292,7 @@ class HelperSearch | @@ -292,7 +292,7 @@ class HelperSearch | ||
| 292 | { | 292 | { |
| 293 | $result = array(); | 293 | $result = array(); |
| 294 | $options = self::$options; | 294 | $options = self::$options; |
| 295 | - if (!isset($options['controller']) || $options['controller'] == 'Search') { | 295 | + if (!isset($options['controller']) || $options['controller'] != 'Search') { |
| 296 | return $result; | 296 | return $result; |
| 297 | } | 297 | } |
| 298 | $params = self::$params; | 298 | $params = self::$params; |
| @@ -31,7 +31,11 @@ var _hmt = _hmt || []; | @@ -31,7 +31,11 @@ var _hmt = _hmt || []; | ||
| 31 | s.parentNode.insertBefore(hm, s); | 31 | s.parentNode.insertBefore(hm, s); |
| 32 | })(); | 32 | })(); |
| 33 | } | 33 | } |
| 34 | - window.addEventListener('load', async_load, false); | 34 | + if (window.addEventListener) { |
| 35 | + window.addEventListener(type, async_load, false); | ||
| 36 | + } else if (window.attachEvent) { | ||
| 37 | + window.attachEvent("on" + type, async_load); | ||
| 38 | + } | ||
| 35 | })(); | 39 | })(); |
| 36 | </script> | 40 | </script> |
| 37 | <script> | 41 | <script> |
| @@ -162,7 +162,7 @@ $('.logo-brand').logoBrand({ | @@ -162,7 +162,7 @@ $('.logo-brand').logoBrand({ | ||
| 162 | $.ajax({ | 162 | $.ajax({ |
| 163 | type: 'GET', | 163 | type: 'GET', |
| 164 | dataType: 'json', | 164 | dataType: 'json', |
| 165 | - url: '/hotrank/getdata', | 165 | + url: '/product/index/getdata', |
| 166 | data: param, | 166 | data: param, |
| 167 | success: function(res) { | 167 | success: function(res) { |
| 168 | var data; | 168 | var data; |
| @@ -242,11 +242,14 @@ class DetailModel | @@ -242,11 +242,14 @@ class DetailModel | ||
| 242 | ++ $i; | 242 | ++ $i; |
| 243 | } | 243 | } |
| 244 | // 遍历所有颜色, 构建尺码显示数据 | 244 | // 遍历所有颜色, 构建尺码显示数据 |
| 245 | + $i = 1; | ||
| 245 | foreach ($colorList as $value) { | 246 | foreach ($colorList as $value) { |
| 246 | // 各个尺码的颜色,每行显示一个颜色的对应尺码 | 247 | // 各个尺码的颜色,每行显示一个颜色的对应尺码 |
| 247 | - $sizeGroup[]['size'] = $sizeList[ $value['skcId'] ]; | 248 | + $sizeGroup[$i]['size'] = $sizeList[ $value['skcId'] ]; |
| 248 | // 默认颜色 | 249 | // 默认颜色 |
| 249 | $colorGroup[0]['color'][] = $value; | 250 | $colorGroup[0]['color'][] = $value; |
| 251 | + | ||
| 252 | + ++ $i; | ||
| 250 | } | 253 | } |
| 251 | 254 | ||
| 252 | // 商品图: 多个 | 255 | // 商品图: 多个 |
| @@ -275,6 +278,8 @@ class DetailModel | @@ -275,6 +278,8 @@ class DetailModel | ||
| 275 | $notForSale = $baseInfo['attribute'] == 2; | 278 | $notForSale = $baseInfo['attribute'] == 2; |
| 276 | // 显示加入购物车链接 | 279 | // 显示加入购物车链接 |
| 277 | if (!$soldOut && !$notForSale) { | 280 | if (!$soldOut && !$notForSale) { |
| 281 | + ksort($colorGroup, SORT_NUMERIC); | ||
| 282 | + | ||
| 278 | $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); | 283 | $result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html'); |
| 279 | $result['cartInfo']['productId'] = $productId; | 284 | $result['cartInfo']['productId'] = $productId; |
| 280 | $result['cartInfo']['thumbs'] = $thumbImageList; | 285 | $result['cartInfo']['thumbs'] = $thumbImageList; |
| 1 | <?php | 1 | <?php |
| 2 | -use Action\AbstractAction; | 2 | + |
| 3 | +use Action\WebAction; | ||
| 4 | +use Product\BrandsModel; | ||
| 3 | 5 | ||
| 4 | /** | 6 | /** |
| 5 | * 品牌首页 | 7 | * 品牌首页 |
| 6 | */ | 8 | */ |
| 7 | -class BrandsController extends AbstractAction | 9 | +class BrandsController extends WebAction |
| 8 | { | 10 | { |
| 9 | 11 | ||
| 10 | public function brandsAction() | 12 | public function brandsAction() |
| 11 | { | 13 | { |
| 12 | - $headerdata = array( | ||
| 13 | - 'gobytype' => 'gobuyboys', | ||
| 14 | - 'searchcate' => 'searchcateboys', | ||
| 15 | - 'navbars' => array( | ||
| 16 | - array( | ||
| 17 | - 'name_cn' => '男生', | ||
| 18 | - 'name_en' => 'BOYS', | ||
| 19 | - 'link' => '', | ||
| 20 | - 'classname' => 'boys', | ||
| 21 | - 'index_main' => 0, | ||
| 22 | - 'subnav' => array( | ||
| 23 | - array( | ||
| 24 | - 'name' => '男首1', | ||
| 25 | - 'link' => '', | ||
| 26 | - 'index_sub' => 0, | ||
| 27 | - 'thirdnav' => array( | ||
| 28 | - array( | ||
| 29 | - 'title' => '上装', | ||
| 30 | - 'branditems' => array( | ||
| 31 | - array( | ||
| 32 | - 'brandname' => '背心', | ||
| 33 | - 'link' => '' | ||
| 34 | - ), | ||
| 35 | - array( | ||
| 36 | - 'brandname' => 'T恤', | ||
| 37 | - 'link' => '' | ||
| 38 | - ) | ||
| 39 | - ) | ||
| 40 | - ) | ||
| 41 | - | ||
| 42 | - ) | ||
| 43 | - ), | ||
| 44 | - array( | ||
| 45 | - 'name' => '男首2', | ||
| 46 | - 'link' => '', | ||
| 47 | - 'index_sub' => 1, | ||
| 48 | - 'thirdnav' => array( | ||
| 49 | - array( | ||
| 50 | - 'title' => '上装', | ||
| 51 | - 'branditems' => array( | ||
| 52 | - array( | ||
| 53 | - 'brandname' => '背心', | ||
| 54 | - 'link' => '' | ||
| 55 | - ), | ||
| 56 | - array( | ||
| 57 | - 'brandname' => 'T恤', | ||
| 58 | - 'link' => '' | ||
| 59 | - ) | ||
| 60 | - ) | ||
| 61 | - ) | ||
| 62 | - ) | ||
| 63 | - ), | ||
| 64 | - array( | ||
| 65 | - 'name' => '男首3', | ||
| 66 | - 'link' => '', | ||
| 67 | - 'index_sub' => 2, | ||
| 68 | - 'thirdnav' => array( | ||
| 69 | - array( | ||
| 70 | - 'title' => '上装', | ||
| 71 | - 'branditems' => array( | ||
| 72 | - array( | ||
| 73 | - 'brandname' => '背心', | ||
| 74 | - 'link' => '' | ||
| 75 | - ), | ||
| 76 | - array( | ||
| 77 | - 'brandname' => 'T恤', | ||
| 78 | - 'link' => '' | ||
| 79 | - ) | ||
| 80 | - ) | ||
| 81 | - ) | ||
| 82 | - ) | ||
| 83 | - ) | ||
| 84 | - ) | ||
| 85 | - ), | ||
| 86 | - array( | ||
| 87 | - 'name_cn' => '女生', | ||
| 88 | - 'name_en' => 'GIRLS', | ||
| 89 | - 'link' => 'http=>//www.baidu.com', | ||
| 90 | - 'classname' => '', | ||
| 91 | - 'index_main' => 0, | ||
| 92 | - 'subnav' => array( | ||
| 93 | - array( | ||
| 94 | - 'name' => '女生1', | ||
| 95 | - 'link' => '', | ||
| 96 | - 'index_sub' => 0, | ||
| 97 | - 'thirdnav' => array( | ||
| 98 | - array( | ||
| 99 | - 'title' => '上装', | ||
| 100 | - 'branditems' => array( | ||
| 101 | - array( | ||
| 102 | - 'brandname' => '背心', | ||
| 103 | - 'link' => '' | ||
| 104 | - ), | ||
| 105 | - array( | ||
| 106 | - 'brandname' => 'T恤', | ||
| 107 | - 'link' => '' | ||
| 108 | - ) | ||
| 109 | - ) | ||
| 110 | - ) | ||
| 111 | - ) | ||
| 112 | - ), | ||
| 113 | - array( | ||
| 114 | - 'name' => '女生2', | ||
| 115 | - 'link' => '', | ||
| 116 | - 'index_sub' => 1, | ||
| 117 | - 'thirdnav' => array( | ||
| 118 | - array( | ||
| 119 | - 'title' => '上装', | ||
| 120 | - 'branditems' => array( | ||
| 121 | - array( | ||
| 122 | - 'brandname' => '背心', | ||
| 123 | - 'link' => '' | ||
| 124 | - ), | ||
| 125 | - array( | ||
| 126 | - 'brandname' => 'T恤', | ||
| 127 | - 'link' => '' | ||
| 128 | - ) | ||
| 129 | - ) | ||
| 130 | - ) | ||
| 131 | - ) | ||
| 132 | - ), | ||
| 133 | - array( | ||
| 134 | - 'name' => '女生3', | ||
| 135 | - 'link' => '', | ||
| 136 | - 'index_sub' => 2, | ||
| 137 | - 'thirdnav' => array( | ||
| 138 | - array( | ||
| 139 | - 'title' => '上装', | ||
| 140 | - 'branditems' => array( | ||
| 141 | - array( | ||
| 142 | - 'brandname' => '背心', | ||
| 143 | - 'link' => '' | ||
| 144 | - ), | ||
| 145 | - array( | ||
| 146 | - 'brandname' => 'T恤', | ||
| 147 | - 'link' => '' | ||
| 148 | - ) | ||
| 149 | - ) | ||
| 150 | - ) | ||
| 151 | - ) | ||
| 152 | - ) | ||
| 153 | - ) | ||
| 154 | - ) | ||
| 155 | - ), | ||
| 156 | - 'myyoho' => array( | ||
| 157 | - 'email' => 'hhh@126.com', | ||
| 158 | - 'viptype' => '普通会员', | ||
| 159 | - 'currentscore' => 495, | ||
| 160 | - 'totalscore' => 600, | ||
| 161 | - 'cardtype' => '银卡', | ||
| 162 | - 'infolist' => array( | ||
| 163 | - array( | ||
| 164 | - 'name' => '待处理的订单', | ||
| 165 | - 'link' => '', | ||
| 166 | - 'num' => '0' | ||
| 167 | - ), | ||
| 168 | - array( | ||
| 169 | - 'name' => '我的收藏', | ||
| 170 | - 'link' => '', | ||
| 171 | - 'num' => '1' | ||
| 172 | - ), | ||
| 173 | - array( | ||
| 174 | - 'name' => '我的优惠券', | ||
| 175 | - 'link' => '', | ||
| 176 | - 'num' => '2' | ||
| 177 | - ), | ||
| 178 | - array( | ||
| 179 | - 'name' => '我的YOHO币', | ||
| 180 | - 'link' => '', | ||
| 181 | - 'num' => '1' | ||
| 182 | - ), | ||
| 183 | - array( | ||
| 184 | - 'name' => '我的退货换货', | ||
| 185 | - 'link' => '', | ||
| 186 | - 'num' => '1' | ||
| 187 | - ) | ||
| 188 | - ), | ||
| 189 | - 'updlink' => '' | ||
| 190 | - ), | ||
| 191 | - 'gobuy' => array( | ||
| 192 | - 'gobuynum' => 3 | ||
| 193 | - ), | ||
| 194 | - 'breadcrumbnav' => array( | ||
| 195 | - array( | ||
| 196 | - 'notend' => array( | ||
| 197 | - 'link' => 'http=>//www.baidu.com', | ||
| 198 | - 'name' => 'BOYS首页' | ||
| 199 | - ) | ||
| 200 | - ), | ||
| 201 | - array( | ||
| 202 | - 'notend' => array( | ||
| 203 | - 'link' => 'http=>//www.baidu.com', | ||
| 204 | - 'name' => '上衣' | ||
| 205 | - ) | ||
| 206 | - ), | ||
| 207 | - array( | ||
| 208 | - 'isend' => array( | ||
| 209 | - 'link' => 'http=>//www.baidu.com', | ||
| 210 | - 'name' => '衬衫' | ||
| 211 | - ) | ||
| 212 | - ) | ||
| 213 | - ) | ||
| 214 | - ); | ||
| 215 | - | ||
| 216 | - $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg'; | ||
| 217 | - $item = array( | ||
| 218 | - 'name' => 'cc', | ||
| 219 | - 'key' => '1000011' | ||
| 220 | - ); | ||
| 221 | - $item0 = array( | ||
| 222 | - 'name' => 'cc', | ||
| 223 | - 'hot' => 'hot', | ||
| 224 | - 'key' => '1000012' | ||
| 225 | - ); | 14 | + //品牌一览头部 |
| 15 | + $channel = $this->getCookie("_Channel") ? $this->getCookie("_Channel") : 'boys'; | ||
| 16 | + $this->setWebNavHeader($channel); | ||
| 226 | 17 | ||
| 227 | - $item1 = array( | ||
| 228 | - 'name' => '所有品牌', | ||
| 229 | - 'src' => $imgsrc, | ||
| 230 | - 'url' => '' | ||
| 231 | - ); | ||
| 232 | - $item2 = array( | ||
| 233 | - 'name' => '所有品牌', | ||
| 234 | - 'src' => $imgsrc, | ||
| 235 | - 'url' => '', | ||
| 236 | - 'items' => array( | ||
| 237 | - $item1, | ||
| 238 | - $item1, | ||
| 239 | - $item1, | ||
| 240 | - $item1, | ||
| 241 | - $item1, | ||
| 242 | - $item1, | ||
| 243 | - $item1, | ||
| 244 | - $item1, | ||
| 245 | - $item1, | ||
| 246 | - $item1 | ||
| 247 | - ) | ||
| 248 | - ); | 18 | + //banner-list |
| 19 | + $res = BrandsModel::getBrandView($channel); | ||
| 249 | 20 | ||
| 21 | + //数据整合 | ||
| 250 | $data = array( | 22 | $data = array( |
| 251 | 'brandsHomePage' => true, | 23 | 'brandsHomePage' => true, |
| 252 | - 'headerdata' => $headerdata, | ||
| 253 | 'brands' => array( | 24 | 'brands' => array( |
| 254 | - 'category' => array( | ||
| 255 | - 'A' => array( | ||
| 256 | - $item, | ||
| 257 | - $item, | ||
| 258 | - $item, | ||
| 259 | - $item, | ||
| 260 | - $item, | ||
| 261 | - $item, | ||
| 262 | - $item, | ||
| 263 | - $item, | ||
| 264 | - $item | ||
| 265 | - ), | ||
| 266 | - 'B' => array( | ||
| 267 | - $item, | ||
| 268 | - $item, | ||
| 269 | - $item0, | ||
| 270 | - $item, | ||
| 271 | - $item, | ||
| 272 | - $item, | ||
| 273 | - $item, | ||
| 274 | - $item, | ||
| 275 | - $item | ||
| 276 | - ), | ||
| 277 | - 'C' => array( | ||
| 278 | - $item, | ||
| 279 | - $item, | ||
| 280 | - $item, | ||
| 281 | - $item, | ||
| 282 | - $item, | ||
| 283 | - $item, | ||
| 284 | - $item, | ||
| 285 | - $item, | ||
| 286 | - $item | ||
| 287 | - ), | ||
| 288 | - 'D' => array( | ||
| 289 | - $item, | ||
| 290 | - $item, | ||
| 291 | - $item, | ||
| 292 | - $item, | ||
| 293 | - $item, | ||
| 294 | - $item, | ||
| 295 | - $item, | ||
| 296 | - $item, | ||
| 297 | - $item, | ||
| 298 | - $item, | ||
| 299 | - $item0, | ||
| 300 | - $item, | ||
| 301 | - $item, | ||
| 302 | - $item, | ||
| 303 | - $item, | ||
| 304 | - $item, | ||
| 305 | - $item, | ||
| 306 | - $item, | ||
| 307 | - $item, | ||
| 308 | - $item, | ||
| 309 | - $item, | ||
| 310 | - $item, | ||
| 311 | - $item, | ||
| 312 | - $item, | ||
| 313 | - $item | ||
| 314 | - ), | ||
| 315 | - 'E' => array( | ||
| 316 | - $item, | ||
| 317 | - $item, | ||
| 318 | - $item0, | ||
| 319 | - $item, | ||
| 320 | - $item, | ||
| 321 | - $item, | ||
| 322 | - $item, | ||
| 323 | - $item, | ||
| 324 | - $item | ||
| 325 | - ), | ||
| 326 | - 'F' => array( | ||
| 327 | - $item0, | ||
| 328 | - $item, | ||
| 329 | - $item, | ||
| 330 | - $item0, | ||
| 331 | - $item0, | ||
| 332 | - $item, | ||
| 333 | - $item0, | ||
| 334 | - $item, | ||
| 335 | - $item | ||
| 336 | - ), | ||
| 337 | - 'G' => array( | ||
| 338 | - $item, | ||
| 339 | - $item, | ||
| 340 | - $item, | ||
| 341 | - $item, | ||
| 342 | - $item, | ||
| 343 | - $item0, | ||
| 344 | - $item, | ||
| 345 | - $item, | ||
| 346 | - $item | ||
| 347 | - ), | ||
| 348 | - 'H' => array( | ||
| 349 | - $item, | ||
| 350 | - $item, | ||
| 351 | - $item, | ||
| 352 | - $item, | ||
| 353 | - $item, | ||
| 354 | - $item, | ||
| 355 | - $item0, | ||
| 356 | - $item, | ||
| 357 | - $item | ||
| 358 | - ), | ||
| 359 | - 'I' => array( | ||
| 360 | - $item, | ||
| 361 | - $item, | ||
| 362 | - $item0, | ||
| 363 | - $item0, | ||
| 364 | - $item0, | ||
| 365 | - $item0, | ||
| 366 | - $item, | ||
| 367 | - $item, | ||
| 368 | - $item | ||
| 369 | - ), | ||
| 370 | - 'J' => array( | ||
| 371 | - $item, | ||
| 372 | - $item, | ||
| 373 | - $item, | ||
| 374 | - $item, | ||
| 375 | - $item0, | ||
| 376 | - $item, | ||
| 377 | - $item, | ||
| 378 | - $item, | ||
| 379 | - $item | ||
| 380 | - ), | ||
| 381 | - 'K' => array( | ||
| 382 | - $item, | ||
| 383 | - $item, | ||
| 384 | - $item, | ||
| 385 | - $item, | ||
| 386 | - $item, | ||
| 387 | - $item, | ||
| 388 | - $item, | ||
| 389 | - $item, | ||
| 390 | - $item | ||
| 391 | - ), | ||
| 392 | - 'L' => array( | ||
| 393 | - $item, | ||
| 394 | - $item0, | ||
| 395 | - $item, | ||
| 396 | - $item, | ||
| 397 | - $item, | ||
| 398 | - $item, | ||
| 399 | - $item, | ||
| 400 | - $item, | ||
| 401 | - $item | ||
| 402 | - ), | ||
| 403 | - 'M' => array( | ||
| 404 | - $item, | ||
| 405 | - $item0, | ||
| 406 | - $item, | ||
| 407 | - $item, | ||
| 408 | - $item, | ||
| 409 | - $item, | ||
| 410 | - $item, | ||
| 411 | - $item, | ||
| 412 | - $item | ||
| 413 | - ), | ||
| 414 | - 'N' => array( | ||
| 415 | - $item, | ||
| 416 | - $item0, | ||
| 417 | - $item0, | ||
| 418 | - $item0, | ||
| 419 | - $item, | ||
| 420 | - $item, | ||
| 421 | - $item, | ||
| 422 | - $item, | ||
| 423 | - $item | ||
| 424 | - ) | ||
| 425 | - ), | ||
| 426 | - 'tabs' => array( | ||
| 427 | - $item2, | ||
| 428 | - $item2, | ||
| 429 | - $item2, | ||
| 430 | - $item2, | ||
| 431 | - $item2 | ||
| 432 | - ) | 25 | + 'category' => $res['brandList'], |
| 26 | + 'tabs' => $res['brandTop'] | ||
| 433 | ) | 27 | ) |
| 434 | ); | 28 | ); |
| 435 | - | ||
| 436 | $this->_view->display('brands', $data); | 29 | $this->_view->display('brands', $data); |
| 437 | } | 30 | } |
| 438 | 31 | ||
| @@ -449,35 +42,22 @@ class BrandsController extends AbstractAction | @@ -449,35 +42,22 @@ class BrandsController extends AbstractAction | ||
| 449 | 42 | ||
| 450 | do { | 43 | do { |
| 451 | /* 判断是不是AJAX请求 */ | 44 | /* 判断是不是AJAX请求 */ |
| 452 | - if (! $this->isAjax()) { | 45 | + if (!$this->isAjax()) { |
| 453 | break; | 46 | break; |
| 454 | } | 47 | } |
| 48 | + $brandId = $this->get('brandId',0); | ||
| 49 | + $uid=$this->getUid(false); | ||
| 50 | + $brandId=144; | ||
| 51 | + BrandsModel::getBrandInfo($brandId, $uid); | ||
| 52 | + | ||
| 53 | + | ||
| 455 | 54 | ||
| 456 | - $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg'; | ||
| 457 | - $data = array( | ||
| 458 | - 'key' => '1000011', | ||
| 459 | - 'icon' => $imgsrc, | ||
| 460 | - 'title' => '优显led触控台灯', | ||
| 461 | - 'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯', | ||
| 462 | - 'subtitle' => 'AAAAAA', | ||
| 463 | - 'imgs' => array( | ||
| 464 | - array( | ||
| 465 | - 'src' => $imgsrc | ||
| 466 | - ), | ||
| 467 | - array( | ||
| 468 | - 'src' => $imgsrc | ||
| 469 | - ), | ||
| 470 | - array( | ||
| 471 | - 'src' => $imgsrc | ||
| 472 | - ) | ||
| 473 | - ) | ||
| 474 | - ) // 提示 | ||
| 475 | -; | ||
| 476 | $result = array( | 55 | $result = array( |
| 477 | 'code' => 200, | 56 | 'code' => 200, |
| 478 | 'brand' => $data | 57 | 'brand' => $data |
| 479 | ); | 58 | ); |
| 480 | - } while (false); | 59 | + } |
| 60 | + while (false); | ||
| 481 | 61 | ||
| 482 | $this->echoJson($result); | 62 | $this->echoJson($result); |
| 483 | } | 63 | } |
| @@ -516,7 +96,6 @@ class BrandsController extends AbstractAction | @@ -516,7 +96,6 @@ class BrandsController extends AbstractAction | ||
| 516 | ) | 96 | ) |
| 517 | ) | 97 | ) |
| 518 | ) | 98 | ) |
| 519 | - | ||
| 520 | ) | 99 | ) |
| 521 | ), | 100 | ), |
| 522 | array( | 101 | array( |
| @@ -982,7 +561,6 @@ class BrandsController extends AbstractAction | @@ -982,7 +561,6 @@ class BrandsController extends AbstractAction | ||
| 982 | ) | 561 | ) |
| 983 | ) | 562 | ) |
| 984 | ) | 563 | ) |
| 985 | - | ||
| 986 | ) | 564 | ) |
| 987 | ), | 565 | ), |
| 988 | array( | 566 | array( |
| @@ -1196,4 +774,5 @@ class BrandsController extends AbstractAction | @@ -1196,4 +774,5 @@ class BrandsController extends AbstractAction | ||
| 1196 | ); | 774 | ); |
| 1197 | $this->_view->display('list', $data); | 775 | $this->_view->display('list', $data); |
| 1198 | } | 776 | } |
| 777 | + | ||
| 1199 | } | 778 | } |
| @@ -5,6 +5,7 @@ namespace Product; | @@ -5,6 +5,7 @@ namespace Product; | ||
| 5 | use Api\Yohobuy; | 5 | use Api\Yohobuy; |
| 6 | use Plugin\HelperSearch; | 6 | use Plugin\HelperSearch; |
| 7 | use LibModels\Web\Product\BrandData; | 7 | use LibModels\Web\Product\BrandData; |
| 8 | +use Index\HomeModel; | ||
| 8 | use Product\SearchModel; | 9 | use Product\SearchModel; |
| 9 | 10 | ||
| 10 | /** | 11 | /** |
| @@ -14,6 +15,13 @@ use Product\SearchModel; | @@ -14,6 +15,13 @@ use Product\SearchModel; | ||
| 14 | */ | 15 | */ |
| 15 | class BrandsModel | 16 | class BrandsModel |
| 16 | { | 17 | { |
| 18 | + | ||
| 19 | + //品牌一览资源位CODE码 | ||
| 20 | + const BOYS_BRAND_CODE = '8b16b7baf9a66fbe553a6caa97d2ce2a'; | ||
| 21 | + const GIRLS_BRAND_CODE = 'c95ae9e40f0add10549b819f821ad626'; | ||
| 22 | + const KIDS_BRAND_CODE = '84b7926282fdef92f1039bdcf77c18ba'; | ||
| 23 | + const LIFESTYLE_BRAND_CODE = 'c575c6bfdfa4125fae7d24bbec7119c8'; | ||
| 24 | + | ||
| 17 | /** | 25 | /** |
| 18 | * 搜索品牌数据 | 26 | * 搜索品牌数据 |
| 19 | * @param $condition array 搜索数据的条件 | 27 | * @param $condition array 搜索数据的条件 |
| @@ -30,7 +38,7 @@ class BrandsModel | @@ -30,7 +38,7 @@ class BrandsModel | ||
| 30 | $data['leftContent'][] = array('picLink' => $adNav); | 38 | $data['leftContent'][] = array('picLink' => $adNav); |
| 31 | 39 | ||
| 32 | //获取静态内容(eg:20141219-100447) | 40 | //获取静态内容(eg:20141219-100447) |
| 33 | - if($options['node']){ | 41 | + if ($options['node']) { |
| 34 | $nodeContent = HelperSearch::formatNodeContent($options['node']); | 42 | $nodeContent = HelperSearch::formatNodeContent($options['node']); |
| 35 | $data['leftContent'][]['picLink']['list'] = $nodeContent; | 43 | $data['leftContent'][]['picLink']['list'] = $nodeContent; |
| 36 | } | 44 | } |
| @@ -38,7 +46,6 @@ class BrandsModel | @@ -38,7 +46,6 @@ class BrandsModel | ||
| 38 | return $data; | 46 | return $data; |
| 39 | } | 47 | } |
| 40 | 48 | ||
| 41 | - | ||
| 42 | //获取品牌系列数据 | 49 | //获取品牌系列数据 |
| 43 | public static function getAdNav($brandId, $status = 1) | 50 | public static function getAdNav($brandId, $status = 1) |
| 44 | { | 51 | { |
| @@ -83,7 +90,6 @@ class BrandsModel | @@ -83,7 +90,6 @@ class BrandsModel | ||
| 83 | 90 | ||
| 84 | //组合用户浏览记录url | 91 | //组合用户浏览记录url |
| 85 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); | 92 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); |
| 86 | - | ||
| 87 | //批量调接口 | 93 | //批量调接口 |
| 88 | $result = Yohobuy::getMulti($urlList, array(), true); | 94 | $result = Yohobuy::getMulti($urlList, array(), true); |
| 89 | 95 | ||
| @@ -93,4 +99,124 @@ class BrandsModel | @@ -93,4 +99,124 @@ class BrandsModel | ||
| 93 | 99 | ||
| 94 | return $data; | 100 | return $data; |
| 95 | } | 101 | } |
| 102 | + | ||
| 103 | + /* | ||
| 104 | + * 获取品牌一览页面,品牌top & 列表 | ||
| 105 | + */ | ||
| 106 | + | ||
| 107 | + public static function getBrandView($channel) | ||
| 108 | + { | ||
| 109 | + $switchParams = self::switchBrandParams($channel); | ||
| 110 | + $brandTop = array(); | ||
| 111 | + /* | ||
| 112 | + * $item1 = array( | ||
| 113 | + 'name' => '所有品牌', | ||
| 114 | + 'src' => $imgsrc, | ||
| 115 | + 'url' => '' | ||
| 116 | + ); | ||
| 117 | + */ | ||
| 118 | + $brandAds = array(); | ||
| 119 | + $brandList = array(); | ||
| 120 | + $res = BrandData::getTopBanner($switchParams['brandCode'], $switchParams['channelType']); | ||
| 121 | + if (isset($res['brandTop'][0]['data']) && $res['brandTop'][0]['data']) { | ||
| 122 | + foreach ($res['brandTop'][0]['data'] as $tk => $tv) { | ||
| 123 | + $imgUrl = explode("?", $tv['src']); | ||
| 124 | + $topTmp = array( | ||
| 125 | + 'name' => $tv['title'], | ||
| 126 | + 'src' => $imgUrl[0], | ||
| 127 | + 'url' => $tv['url'], | ||
| 128 | + 'items' => array() | ||
| 129 | + ); | ||
| 130 | + $brandTop[$tk] = $topTmp; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + if (isset($res['brandList']['brands']) && $res['brandList']['brands']) { | ||
| 134 | + foreach ($res['brandList']['brands'] as $lk => $lv) { | ||
| 135 | + if (isset($lv) && $lv) { | ||
| 136 | + $listTmp = array(); | ||
| 137 | + foreach ($lv as $ltk => $ltv) { | ||
| 138 | + $listTmp[$ltk] = array( | ||
| 139 | + 'name' => $ltv['brand_name'], | ||
| 140 | + 'key' => $ltv['id'] | ||
| 141 | + ); | ||
| 142 | + if ($ltv['is_hot'] == 'Y') { | ||
| 143 | + $listTmp[$ltk] += array('hot' => 'hot'); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + $brandList[$lk] = $listTmp; | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + return array( | ||
| 151 | + 'brandTop' => $brandTop, | ||
| 152 | + 'brandList' => $brandList | ||
| 153 | + ); | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + /* | ||
| 157 | + * 获取单个广告浮窗内容 | ||
| 158 | + */ | ||
| 159 | + public static function getBrandInfo($brandId, $uid) | ||
| 160 | + { | ||
| 161 | + $imgsrc = 'http://img11.static.yhbimg.com/goodsimg/2015/10/19/10/01b312c3b7a7efebcd671e73495ff3e306.jpg'; | ||
| 162 | + $data = array( | ||
| 163 | + 'key' => '1000011', | ||
| 164 | + 'icon' => $imgsrc, | ||
| 165 | + 'title' => '优显led触控台灯', | ||
| 166 | + 'content' => '优显led触控台灯优显led触控台灯优显led触控台灯优显led触控台灯', | ||
| 167 | + 'subtitle' => 'AAAAAA', | ||
| 168 | + 'imgs' => array( | ||
| 169 | + array( | ||
| 170 | + 'src' => $imgsrc | ||
| 171 | + ), | ||
| 172 | + array( | ||
| 173 | + 'src' => $imgsrc | ||
| 174 | + ), | ||
| 175 | + array( | ||
| 176 | + 'src' => $imgsrc | ||
| 177 | + ) | ||
| 178 | + ) | ||
| 179 | + ); | ||
| 180 | + $res = BrandData::getBrandIntro($brandId, $uid); | ||
| 181 | +//if(isset($res['data']) && $res['data']){ | ||
| 182 | +// $data['key']=$brandId; | ||
| 183 | +// $data['icon']= | ||
| 184 | +//} | ||
| 185 | + var_dump($res); | ||
| 186 | + die(); | ||
| 187 | + | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /* | ||
| 191 | + * 获取品牌一览资源位&channelType | ||
| 192 | + */ | ||
| 193 | + | ||
| 194 | + public static function switchBrandParams($channelStr = 'boys') | ||
| 195 | + { | ||
| 196 | + $res = array('channelType' => 1, 'brandCode' => self::BOYS_BRAND_CODE); | ||
| 197 | + switch ($channelStr) { | ||
| 198 | + case HomeModel::COOKIE_NAME_BOYS: | ||
| 199 | + $res['channelType'] = 1; | ||
| 200 | + $res['brandCode'] = self::BOYS_BRAND_CODE; | ||
| 201 | + break; | ||
| 202 | + case HomeModel::COOKIE_NAME_GIRLS: | ||
| 203 | + $res['channelType'] = 2; | ||
| 204 | + $res['brandCode'] = self::GIRLS_BRAND_CODE; | ||
| 205 | + break; | ||
| 206 | + case HomeModel::COOKIE_NAME_KIDS: | ||
| 207 | + $res['channelType'] = 3; | ||
| 208 | + $res['brandCode'] = self::KIDS_BRAND_CODE; | ||
| 209 | + break; | ||
| 210 | + case HomeModel::COOKIE_NAME_LIFESTYLE: | ||
| 211 | + $res['channelType'] = 4; | ||
| 212 | + $res['brandCode'] = self::LIFESTYLE_BRAND_CODE; | ||
| 213 | + break; | ||
| 214 | + default: | ||
| 215 | + $res['channelType'] = 1; | ||
| 216 | + $res['brandCode'] = self::BOYS_BRAND_CODE; | ||
| 217 | + break; | ||
| 218 | + } | ||
| 219 | + return $res; | ||
| 220 | + } | ||
| 221 | + | ||
| 96 | } | 222 | } |
| @@ -150,7 +150,7 @@ class SearchModel | @@ -150,7 +150,7 @@ class SearchModel | ||
| 150 | // 组合搜索折扣区间url | 150 | // 组合搜索折扣区间url |
| 151 | $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']); | 151 | $urlList['discount'] = HelperSearch::getDiscountUrl($searchCondition['condition']); |
| 152 | // 组合搜索最新上架url | 152 | // 组合搜索最新上架url |
| 153 | - $urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']); | 153 | + //$urlList['recent'] = HelperSearch::getRecentShelveUrl($searchCondition['condition']); |
| 154 | //用户浏览记录 | 154 | //用户浏览记录 |
| 155 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); | 155 | //$urlList['reviewUrl'] = HelperSearch::getReviewUrl($searchCondition['condition']); |
| 156 | 156 |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -use Action\AbstractAction; | 3 | +use Action\WebAction; |
| 4 | use LibModels\Web\Passport\LoginData; | 4 | use LibModels\Web\Passport\LoginData; |
| 5 | use Plugin\Helpers; | 5 | use Plugin\Helpers; |
| 6 | use Plugin\Partner\Factory; | 6 | use Plugin\Partner\Factory; |
| 7 | 7 | ||
| 8 | -class AutosignController extends AbstractAction | 8 | +class AutosignController extends WebAction |
| 9 | { | 9 | { |
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 1 | <?php | 1 | <?php |
| 2 | 2 | ||
| 3 | -use Action\AbstractAction; | 3 | +use Action\WebAction; |
| 4 | use LibModels\Web\Passport\RegData; | 4 | use LibModels\Web\Passport\RegData; |
| 5 | use LibModels\Wap\Passport\BindData; | 5 | use LibModels\Wap\Passport\BindData; |
| 6 | use Passport\PassportModel as PassportModel; | 6 | use Passport\PassportModel as PassportModel; |
| 7 | use Plugin\Helpers; | 7 | use Plugin\Helpers; |
| 8 | 8 | ||
| 9 | -class AutouserinfoController extends AbstractAction | 9 | +class AutouserinfoController extends WebAction |
| 10 | { | 10 | { |
| 11 | 11 | ||
| 12 | /** | 12 | /** |
-
Please register or login to post a comment