Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy.git into develop
Showing
8 changed files
with
116 additions
and
69 deletions
@@ -33,7 +33,7 @@ class HelperSearch | @@ -33,7 +33,7 @@ class HelperSearch | ||
33 | $options = self::$options; | 33 | $options = self::$options; |
34 | $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; | 34 | $cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; |
35 | if (isset($options['brandName']) && !empty($options['brandName'])) { | 35 | if (isset($options['brandName']) && !empty($options['brandName'])) { |
36 | - $initNav = $options['brandName']; | 36 | + $initNav = $options['brandNameEn'] . $options['brandNameCn']; |
37 | }else{ | 37 | }else{ |
38 | $initNav = '列表'; | 38 | $initNav = '列表'; |
39 | } | 39 | } |
@@ -11,3 +11,19 @@ | @@ -11,3 +11,19 @@ | ||
11 | {{/ resetSuccess}} | 11 | {{/ resetSuccess}} |
12 | </div> | 12 | </div> |
13 | {{> layout/footer}} | 13 | {{> layout/footer}} |
14 | +<script type="text/javascript"> | ||
15 | + (function() { | ||
16 | + var count = 5, | ||
17 | + countDown = document.getElementById('count-down'); | ||
18 | + | ||
19 | + | ||
20 | + var timer = setInterval(function(){ | ||
21 | + if (count > 1) { | ||
22 | + count--; | ||
23 | + countDown.innerHTML = count; | ||
24 | + } else { | ||
25 | + location.href = '/'; | ||
26 | + } | ||
27 | + }, 1000); | ||
28 | + })(); | ||
29 | +</script> |
@@ -150,7 +150,7 @@ exports.init = function(num) { | @@ -150,7 +150,7 @@ exports.init = function(num) { | ||
150 | 150 | ||
151 | $goodItemWrapper.mouseleave(function() { | 151 | $goodItemWrapper.mouseleave(function() { |
152 | 152 | ||
153 | - removeHtmlFn(); | 153 | + // removeHtmlFn(); |
154 | }); | 154 | }); |
155 | 155 | ||
156 | function removeHtmlFn() { | 156 | function removeHtmlFn() { |
@@ -171,15 +171,19 @@ $(document).on('hover', '.good-select-color li', function() { | @@ -171,15 +171,19 @@ $(document).on('hover', '.good-select-color li', function() { | ||
171 | }); | 171 | }); |
172 | 172 | ||
173 | $goodInfoMain.on('click', '.col-btn', function() { | 173 | $goodInfoMain.on('click', '.col-btn', function() { |
174 | + var $this = $(this); | ||
175 | + | ||
174 | $.ajax({ | 176 | $.ajax({ |
175 | type: 'POST', | 177 | type: 'POST', |
176 | url: '/product/list/changeFavorite', | 178 | url: '/product/list/changeFavorite', |
177 | data: { | 179 | data: { |
178 | - skn: $(this).closest('.good-info').data('skn'), | ||
179 | - isFavorite: !$(this).hasClass('coled') | 180 | + skn: $this.closest('.good-info').data('skn'), |
181 | + isFavorite: !$this.hasClass('coled') | ||
180 | } | 182 | } |
181 | }).then(function(res) { | 183 | }).then(function(res) { |
182 | - console.log(res); | 184 | + if (res.code === 200) { |
185 | + $this.toggleClass('coled'); | ||
186 | + } | ||
183 | }); | 187 | }); |
184 | }); | 188 | }); |
185 | 189 |
@@ -5,18 +5,19 @@ use WebPlugin\Images; | @@ -5,18 +5,19 @@ use WebPlugin\Images; | ||
5 | use Api\Yohobuy; | 5 | use Api\Yohobuy; |
6 | use LibModels\Web\Product\HotrankData; | 6 | use LibModels\Web\Product\HotrankData; |
7 | use LibModels\Web\Product\SearchData; | 7 | use LibModels\Web\Product\SearchData; |
8 | +use LibModels\Web\Home\IndexData; | ||
9 | +use WebPlugin\DataProcess\WebChannel\Channel as ChannelProcess; | ||
8 | 10 | ||
9 | class HotrankModel { | 11 | class HotrankModel { |
10 | 12 | ||
11 | /** | 13 | /** |
12 | * 获取热销排行频道资源 | 14 | * 获取热销排行频道资源 |
13 | - * | ||
14 | - * @param string $channel | 15 | + * |
15 | * @return array | 16 | * @return array |
16 | */ | 17 | */ |
17 | static public function getChannelResource() | 18 | static public function getChannelResource() |
18 | { | 19 | { |
19 | - $channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; | 20 | + $channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys'; |
20 | switch ($channel) | 21 | switch ($channel) |
21 | { | 22 | { |
22 | case 'boys' : | 23 | case 'boys' : |
@@ -34,33 +35,75 @@ class HotrankModel { | @@ -34,33 +35,75 @@ class HotrankModel { | ||
34 | } | 35 | } |
35 | } | 36 | } |
36 | 37 | ||
38 | + | ||
37 | /** | 39 | /** |
38 | - * 人气单品 一周热卖 | 40 | + * 获取焦点图,热门品牌资源 |
41 | + * @param string $channel | ||
42 | + * @param string $content_code | ||
43 | + * @return array | ||
39 | */ | 44 | */ |
40 | - static public function getSearchData($param,$page,$ajax) | 45 | + static public function getFocusResource($channel, $content_code) |
41 | { | 46 | { |
42 | - // 调用接口查询商品数据 | ||
43 | - $result = SearchData::searchElasticByCondition($param); | ||
44 | - | ||
45 | - if(!empty($result)) | 47 | + $resource = IndexData::getResourceData($content_code); |
48 | + // 格式化数据 | ||
49 | + $data = ChannelProcess::getFormat($channel, $resource['data']); | ||
50 | + return $data; | ||
51 | + } | ||
52 | + | ||
53 | + | ||
54 | + /** | ||
55 | + * 获取人气单品,一周热卖商品资源 | ||
56 | + * @param $config 过滤参数 | ||
57 | + * @param $page 当前页数 | ||
58 | + * @param $ajax 是否是ajax加载 默认0不是 | ||
59 | + */ | ||
60 | + static public function getSearchData($config,$page,$ajax) | ||
61 | + { | ||
62 | + //配置查询商品参数 | ||
63 | + $viewNum = 60; | ||
64 | + $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1, | ||
65 | + 'sort'=>$config['sort'],'gender'=>$config['gender'],'attribute_not'=>2); | ||
66 | + if($ajax == 0) | ||
46 | { | 67 | { |
47 | - $res = self::getProductList($result,$page,$ajax); | ||
48 | - if(!empty($res['popular'])) | 68 | + if($config['sort'] != 0) |
49 | { | 69 | { |
50 | - $data['popular'] = $res['popular']; | 70 | + $param['sort'] = $sort_id; |
71 | + }else{ | ||
72 | + $param['sort'] = ''; | ||
51 | } | 73 | } |
52 | - if(!empty($res['hotWeek'])) | 74 | + if($config['road'] == 3) |
75 | + { | ||
76 | + $param['msort'] = 365; | ||
77 | + }elseif($config['road'] == 4){ | ||
78 | + $param['msort'] = 10; | ||
79 | + }else{ | ||
80 | + $param['not_maxSortId'] = '10,365'; | ||
81 | + } | ||
82 | + }else{ | ||
83 | + if(empty($param['sort'])) | ||
53 | { | 84 | { |
54 | - $data['hotWeek'] = $res['hotWeek']; | ||
55 | - } | 85 | + if($config['road'] == 3) |
86 | + { | ||
87 | + $param['msort'] = 365; | ||
88 | + }elseif($config['road'] == 4){ | ||
89 | + $param['msort'] = 10; | ||
90 | + }else{ | ||
91 | + $param['not_maxSortId'] = '10,365'; | ||
92 | + } | ||
93 | + } | ||
56 | } | 94 | } |
95 | + //根据给定查询数据搜索数据列表 | ||
96 | + $result = SearchData::searchElasticByCondition($param); | ||
97 | + $data = self::getProductList($result,$page,$ajax); | ||
57 | return $data; | 98 | return $data; |
58 | } | 99 | } |
59 | - | ||
60 | - | 100 | + |
61 | 101 | ||
62 | /** | 102 | /** |
63 | - * 获取分类标签 | 103 | + * 获取标签资源 |
104 | + * @param $client_type 客户端类型 | ||
105 | + * @param $channel 频道类型 | ||
106 | + * @param $is_concurrent 是否异步,true异步,false同步,默认true | ||
64 | */ | 107 | */ |
65 | static public function getHotranktag($client_type,$channel,$is_concurrent) | 108 | static public function getHotranktag($client_type,$channel,$is_concurrent) |
66 | { | 109 | { |
@@ -76,10 +119,13 @@ class HotrankModel { | @@ -76,10 +119,13 @@ class HotrankModel { | ||
76 | } | 119 | } |
77 | return $nav; | 120 | return $nav; |
78 | } | 121 | } |
79 | - | ||
80 | 122 | ||
81 | - /** | ||
82 | - * 人气单品 一周热卖 数据处理 | 123 | + |
124 | + /** | ||
125 | + * 人气单品 一周热卖 数据处理 | ||
126 | + * @param $result 过滤参数 | ||
127 | + * @param $page 当前页数 | ||
128 | + * @param $ajax 是否是ajax加载 默认0不是 | ||
83 | */ | 129 | */ |
84 | static public function getProductList($result,$page,$ajax=0) | 130 | static public function getProductList($result,$page,$ajax=0) |
85 | { | 131 | { |
@@ -144,7 +190,9 @@ class HotrankModel { | @@ -144,7 +190,9 @@ class HotrankModel { | ||
144 | 'name'=>'一周热卖', | 190 | 'name'=>'一周热卖', |
145 | 'list'=>$hot, | 191 | 'list'=>$hot, |
146 | ); | 192 | ); |
147 | - | ||
148 | - return array('popular'=>$popular,'hotWeek'=>$hotWeek); | 193 | + $data['popular'] = $popular; |
194 | + $data['hotWeek'] = $hotWeek; | ||
195 | + return $data; | ||
149 | } | 196 | } |
197 | + | ||
150 | } | 198 | } |
@@ -3,7 +3,7 @@ use Action\WebAction; | @@ -3,7 +3,7 @@ use Action\WebAction; | ||
3 | use LibModels\Web\Product\BrandData; | 3 | use LibModels\Web\Product\BrandData; |
4 | use LibModels\Web\Product\FavoriteData; | 4 | use LibModels\Web\Product\FavoriteData; |
5 | 5 | ||
6 | -use \LibModels\Web\Product\HotrankData; | 6 | +use LibModels\Web\Product\HotrankData; |
7 | use product\HotrankModel; | 7 | use product\HotrankModel; |
8 | use LibModels\Web\Home\IndexData; | 8 | use LibModels\Web\Home\IndexData; |
9 | 9 | ||
@@ -28,6 +28,8 @@ class IndexController extends WebAction | @@ -28,6 +28,8 @@ class IndexController extends WebAction | ||
28 | $brandId = $brandInfo['data']['id']; | 28 | $brandId = $brandInfo['data']['id']; |
29 | $node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false; | 29 | $node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false; |
30 | $brandBanner = $brandInfo['data']['brand_banner']; | 30 | $brandBanner = $brandInfo['data']['brand_banner']; |
31 | + $brandNameEn = $brandInfo['data']['brand_name_en']; | ||
32 | + $brandNameCn = $brandInfo['data']['brand_name_cn']; | ||
31 | } else { | 33 | } else { |
32 | $this->go(SITE_MAIN); | 34 | $this->go(SITE_MAIN); |
33 | } | 35 | } |
@@ -47,6 +49,8 @@ class IndexController extends WebAction | @@ -47,6 +49,8 @@ class IndexController extends WebAction | ||
47 | $options['brandId'] = $brandId; | 49 | $options['brandId'] = $brandId; |
48 | $options['node'] = $node; | 50 | $options['node'] = $node; |
49 | $options['brandBanner'] = $brandBanner; | 51 | $options['brandBanner'] = $brandBanner; |
52 | + $options['brandNameEn'] = $brandNameEn; | ||
53 | + $options['brandNameCn'] = $brandNameCn; | ||
50 | $options['reviewNum'] = 6; | 54 | $options['reviewNum'] = 6; |
51 | 55 | ||
52 | //调用模型获得数据 | 56 | //调用模型获得数据 |
@@ -140,28 +144,15 @@ class IndexController extends WebAction | @@ -140,28 +144,15 @@ class IndexController extends WebAction | ||
140 | ); | 144 | ); |
141 | 145 | ||
142 | //焦点图 热门品牌 | 146 | //焦点图 热门品牌 |
143 | - $focus = \Index\HomeModel::getChannelResource($channel['channel'], $channel['code']); | ||
144 | - $data['hotrank']['slide'] = $focus[0]['slide']; | ||
145 | - $data['hotrank']['hotBrands'] = $focus[1]['hotBrands']; | ||
146 | - | 147 | + $focus = \product\HotrankModel::getFocusResource($channel['channel'], $channel['code']); |
148 | + $data['hotrank']['slide'] = $focus[0]['slide']; | ||
149 | + $data['hotrank']['hotBrands'] = $focus[1]['hotBrands']; | ||
150 | + | ||
147 | //人气单品 一周热卖 | 151 | //人气单品 一周热卖 |
148 | - $page = $this->get('page',1); | ||
149 | - $sort_id = $this->get('sid',0); | ||
150 | - $viewNum = 60; | ||
151 | - $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$channel['gender'],'attribute_not'=>2); | ||
152 | - if($sort_id != 0) | ||
153 | - { | ||
154 | - $param['sort'] = $sort_id; | ||
155 | - } | ||
156 | - if($channel['road'] == 3) | ||
157 | - { | ||
158 | - $param['msort'] = 365; | ||
159 | - }elseif($channel['road'] == 4){ | ||
160 | - $param['msort'] = 10; | ||
161 | - }else{ | ||
162 | - $param['not_maxSortId'] = '10,365'; | ||
163 | - } | ||
164 | - $publiclist = \product\HotrankModel::getSearchData($param,$page,0); | 152 | + $page = $this->get('page',1); |
153 | + $sort_id = $this->get('sid',0); | ||
154 | + $config = array('sort' =>$sort_id,'gender' => $channel['gender'],'road' => $channel['road']); | ||
155 | + $publiclist = \product\HotrankModel::getSearchData($config,$page,0); | ||
165 | $data['hotrank']['popular'] = $publiclist['popular']; | 156 | $data['hotrank']['popular'] = $publiclist['popular']; |
166 | $data['hotrank']['hotWeek'] = $publiclist['hotWeek']; | 157 | $data['hotrank']['hotWeek'] = $publiclist['hotWeek']; |
167 | 158 | ||
@@ -176,7 +167,6 @@ class IndexController extends WebAction | @@ -176,7 +167,6 @@ class IndexController extends WebAction | ||
176 | */ | 167 | */ |
177 | public function getdataAction() | 168 | public function getdataAction() |
178 | { | 169 | { |
179 | - | ||
180 | $page = $this->get('page',1); | 170 | $page = $this->get('page',1); |
181 | //加载到100个以后停止 | 171 | //加载到100个以后停止 |
182 | if($page > 2) | 172 | if($page > 2) |
@@ -196,24 +186,11 @@ class IndexController extends WebAction | @@ -196,24 +186,11 @@ class IndexController extends WebAction | ||
196 | $sort = $info['data']['category_id']; | 186 | $sort = $info['data']['category_id']; |
197 | } | 187 | } |
198 | } | 188 | } |
199 | - $viewNum = 60; | ||
200 | //获取频道资源 | 189 | //获取频道资源 |
201 | $channel = \product\HotrankModel::getChannelResource(); | 190 | $channel = \product\HotrankModel::getChannelResource(); |
202 | - $param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1, | ||
203 | - 'gender'=>$channel['gender'],'attribute_not'=>2,); | ||
204 | - if(empty($param['sort'])) | ||
205 | - { | ||
206 | - if($channel['road'] == 3) | ||
207 | - { | ||
208 | - $param['msort'] = 365; | ||
209 | - }elseif($channel['road'] == 4){ | ||
210 | - $param['msort'] = 10; | ||
211 | - }else{ | ||
212 | - $param['not_maxSortId'] = '10,365'; | ||
213 | - } | ||
214 | - } | ||
215 | //一周热卖 | 191 | //一周热卖 |
216 | - $list = \product\HotrankModel::getSearchData($param, $page, 1); | 192 | + $config = array('sort' =>$sort,'gender' => $channel['gender'],'road' => $channel['road']); |
193 | + $list = \product\HotrankModel::getSearchData($config, $page, 1); | ||
217 | $lister = $list['hotWeek']['list']; | 194 | $lister = $list['hotWeek']['list']; |
218 | $lister = array_values($lister); | 195 | $lister = array_values($lister); |
219 | if($sid == 1 && $page == 1) | 196 | if($sid == 1 && $page == 1) |
@@ -29,7 +29,8 @@ class ListController extends WebAction | @@ -29,7 +29,8 @@ class ListController extends WebAction | ||
29 | /** | 29 | /** |
30 | * list列表new(模板new-sale) | 30 | * list列表new(模板new-sale) |
31 | */ | 31 | */ |
32 | - public function newAction(){ | 32 | + public function newAction() |
33 | + { | ||
33 | $condition = array( | 34 | $condition = array( |
34 | 'order' => 's_t_desc' | 35 | 'order' => 's_t_desc' |
35 | ); | 36 | ); |
@@ -113,7 +114,7 @@ class ListController extends WebAction | @@ -113,7 +114,7 @@ class ListController extends WebAction | ||
113 | * @author | 114 | * @author |
114 | * @return json | 115 | * @return json |
115 | */ | 116 | */ |
116 | - public static function changeFavoriteAction() | 117 | + public function changeFavoriteAction() |
117 | { | 118 | { |
118 | if (!$this->isAjax()) { | 119 | if (!$this->isAjax()) { |
119 | return; | 120 | return; |
@@ -46,6 +46,7 @@ class SaleController extends WebAction | @@ -46,6 +46,7 @@ class SaleController extends WebAction | ||
46 | ); | 46 | ); |
47 | 47 | ||
48 | $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); | 48 | $saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo); |
49 | + | ||
49 | $data = array( | 50 | $data = array( |
50 | //初始化js | 51 | //初始化js |
51 | 'productListPage' => true, | 52 | 'productListPage' => true, |
-
Please register or login to post a comment