Authored by 梁志锋

Merge remote-tracking branch 'origin/develop/wap' into develop/wap

@@ -75,7 +75,7 @@ class Cache @@ -75,7 +75,7 @@ class Cache
75 // 当接口异常,一级缓存没取到数据的情况 75 // 当接口异常,一级缓存没取到数据的情况
76 if ($node === 'slave') { 76 if ($node === 'slave') {
77 $incrementKey = self::makeKey('_increment_' . $key, 'slave'); 77 $incrementKey = self::makeKey('_increment_' . $key, 'slave');
78 - $incrementValue = HoodCache::Memcached('slave')->get($incrementKey, 'slave'); 78 + $incrementValue = HoodCache::Memcached('slave')->get($incrementKey);
79 // 接口调用失败累计5次之后,回填二级缓存数据到一级缓存, 重置计数值为0 79 // 接口调用失败累计5次之后,回填二级缓存数据到一级缓存, 重置计数值为0
80 if (is_int($incrementValue) && $incrementValue > 5) { 80 if (is_int($incrementValue) && $incrementValue > 5) {
81 HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $result, 300); 81 HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $result, 300);
@@ -18,7 +18,7 @@ server @@ -18,7 +18,7 @@ server
18 #cc: e0323a9039add2978bf5b49550572c7c oo:e47ca7a09cf6781e29634502345930a7 18 #cc: e0323a9039add2978bf5b49550572c7c oo:e47ca7a09cf6781e29634502345930a7
19 #acecl:7ea6bdf07376a928c5d4677789c45463 opqcl:352f028bd6ecf28de1c285c573642659 19 #acecl:7ea6bdf07376a928c5d4677789c45463 opqcl:352f028bd6ecf28de1c285c573642659
20 default_type application/json; 20 default_type application/json;
21 - return 200 '{"code":200,"message":"Config Success","md5":"1231231231231","data":{"ae":"e0323a9039add2978bf5b49550572c7c","url":"http://m.yohobuy.com","tl":"352f028bd6ecf28de1c285c573642659"}}'; 21 + return 200 '{"code":200,"message":"Config Success","md5":"e0323a9039add2978bf5b49550572cff","data":{"ae":"e0323a9039add2978bf5b49550572c7c","url":"http://m.yohobuy.com","tl":"352f028bd6ecf28de1c285c573642659"}}';
22 } 22 }
23 # hotfix 23 # hotfix
24 location = /hf/v1 { 24 location = /hf/v1 {
@@ -79,8 +79,8 @@ function loadData($parent, url, page) { @@ -79,8 +79,8 @@ function loadData($parent, url, page) {
79 page: page 79 page: page
80 }, 80 },
81 success: function(data) { 81 success: function(data) {
82 - var $loadingMask = $parent.closest('.fav-type').find('.fav-content-loading');  
83 - 82 + var $loadingMask = $parent.closest('.fav-type').find('.fav-content-loading');
  83 +
84 if (url === 'favBrand') { 84 if (url === 'favBrand') {
85 $brandLoadMore.addClass('hide'); 85 $brandLoadMore.addClass('hide');
86 } else { 86 } else {
@@ -91,23 +91,23 @@ function loadData($parent, url, page) { @@ -91,23 +91,23 @@ function loadData($parent, url, page) {
91 $loadingMask.addClass('hide'); 91 $loadingMask.addClass('hide');
92 $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide'); 92 $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
93 } else if (data === 'end') { 93 } else if (data === 'end') {
94 -  
95 - //处理data等于end时如果loadingMask存在且没有hide样式的情况  
96 - if ($loadingMask && !$loadingMask.hasClass('hide')) { 94 +
  95 + //处理data等于end时如果loadingMask存在且没有hide样式的情况
  96 + if ($loadingMask && !$loadingMask.hasClass('hide')) {
97 $loadingMask.addClass('hide'); 97 $loadingMask.addClass('hide');
98 - $parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');  
99 - }  
100 - 98 + //$parent.closest('.fav-type').find('.fav-null-box').removeClass('hide');
  99 + }
  100 +
101 $parent.closest('.fav-type').find('.fav-load-background') 101 $parent.closest('.fav-type').find('.fav-load-background')
102 - .removeClass('fav-load-background').html('没有更多了');  
103 - 102 + .removeClass('fav-load-background').html('没有更多了');
  103 +
104 // hf: fixes bug to 修改没有数据还调接口,加载错误页面问题 104 // hf: fixes bug to 修改没有数据还调接口,加载错误页面问题
105 brandLockId = true; 105 brandLockId = true;
106 lockId = true; 106 lockId = true;
107 } else if (data.length > 10) { 107 } else if (data.length > 10) {
108 $parent.append(data); 108 $parent.append(data);
109 -  
110 - //如果有数据loadingMask会被remove掉 109 +
  110 + //如果有数据loadingMask会被remove掉
111 $loadingMask.remove(); 111 $loadingMask.remove();
112 if (url === 'favBrand') { 112 if (url === 'favBrand') {
113 initSwiper(data);//如果是收藏品牌需要初始化swiper 113 initSwiper(data);//如果是收藏品牌需要初始化swiper
@@ -113,6 +113,11 @@ class SearchController extends AbstractAction @@ -113,6 +113,11 @@ class SearchController extends AbstractAction
113 $classNames = Category\ClassModel::getClassNames(); 113 $classNames = Category\ClassModel::getClassNames();
114 114
115 do { 115 do {
  116 + // 品类名称为空时跳出
  117 + if (empty($classNames)) {
  118 + break;
  119 + }
  120 +
116 /* 精确查一级品类 */ 121 /* 精确查一级品类 */
117 $sorts = array_keys($classNames['first'], $query, true); 122 $sorts = array_keys($classNames['first'], $query, true);
118 if (isset($sorts[0])) { 123 if (isset($sorts[0])) {
@@ -188,31 +188,48 @@ class UserModel @@ -188,31 +188,48 @@ class UserModel
188 $favProduct = UserData::favoriteProductData($uid, $page, $limit); 188 $favProduct = UserData::favoriteProductData($uid, $page, $limit);
189 189
190 // 处理用户收藏的商品数据 190 // 处理用户收藏的商品数据
191 - if (isset($favProduct['data']) && $page <= $favProduct['data']['page_total']) {  
192 - $datas = array();  
193 - $product = array();  
194 - foreach ($favProduct['data']['product_list'] as $val) {  
195 - if (empty($val['product_skn'])) {  
196 - continue;  
197 - } 191 + do {
  192 + // 开始就没获取到数据或者获取的数据为空时的处理
  193 + if ((!$favProduct || isset($favProduct['data']['product_list']) && empty($favProduct['data']['product_list'])) && $page == 1) {
  194 + break;
  195 + }
198 196
  197 + // 加载第二页以及第二页之后的数据时接口不返回时的处理
  198 + if ($page > 1 && !$favProduct) {
  199 + $result['end'] = true;
  200 + break;
  201 + }
  202 +
  203 + if ($page <= $favProduct['data']['page_total']) {
  204 + $datas = array();
199 $product = array(); 205 $product = array();
200 - $product['fav_id'] = $val['product_id'];  
201 - $product['link'] = isset($val['goodsId'], $val['cnAlphabet']) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';  
202 - $product['imgUrl'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : '';  
203 - ;  
204 - $product['title'] = $val['product_name'];  
205 - $product['price'] = '¥' . Helpers::transPrice($val['market_price']);  
206 - $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . Helpers::transPrice($val['sales_price']) : false;  
207 - $product['savePrice'] = ($val['price_down'] > 0) ? '¥' . Helpers::transPrice($val['price_down']) : false;  
208 - $product['sellOut'] = ($val['storage'] <= 0);  
209 -  
210 - $datas[] = $product;  
211 - }  
212 - !empty($datas) && $result['hasFavProduct'] = $datas;  
213 - } else if (($page > 1 && !$favProduct) || $page > $favProduct['data']['page_total']) {  
214 - $result['end'] = true;  
215 - } 206 + foreach ($favProduct['data']['product_list'] as $val) {
  207 + if (empty($val['product_skn'])) {
  208 + continue;
  209 + }
  210 +
  211 + $product = array();
  212 + $product['fav_id'] = $val['product_id'];
  213 + $product['link'] = isset($val['goodsId'], $val['cnAlphabet']) ? Helpers::url('/product/pro_' . $val['product_id'] . '_' . $val['goodsId'] . '/' . $val['cnAlphabet'] . '.html') : '';
  214 + $product['imgUrl'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : '';
  215 + ;
  216 + $product['title'] = $val['product_name'];
  217 + $product['price'] = '¥' . Helpers::transPrice($val['market_price']);
  218 + $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . Helpers::transPrice($val['sales_price']) : false;
  219 + $product['savePrice'] = ($val['price_down'] > 0) ? '¥' . Helpers::transPrice($val['price_down']) : false;
  220 + $product['sellOut'] = ($val['storage'] <= 0);
  221 +
  222 + $datas[] = $product;
  223 + }
  224 +
  225 + if (!empty($datas)) {
  226 + $result['hasFavProduct'] = $datas;
  227 + }
  228 + } else {
  229 + $result['end'] = true;
  230 + }
  231 +
  232 + } while (false);
216 233
217 return $result; 234 return $result;
218 } 235 }
@@ -234,40 +251,56 @@ class UserModel @@ -234,40 +251,56 @@ class UserModel
234 $favBrand = UserData::favoriteBrandData($uid, $gender, $page, $limit); 251 $favBrand = UserData::favoriteBrandData($uid, $gender, $page, $limit);
235 252
236 // 处理用户收藏的品牌数据 253 // 处理用户收藏的品牌数据
237 - if (isset($favBrand['data']) && $page <= $favBrand['data']['page_total']) {  
238 - $datas = array();  
239 - $brand = array();  
240 - foreach ($favBrand['data']['brand_list'] as $val) {  
241 - $brand = array();  
242 - $brand['id'] = $val['brand_id'];  
243 - $brand['brandImg'] = !empty($val['brand_ico']) ? Images::getImageUrl($val['brand_ico'], 47, 47) : '';  
244 - $brand['brandName'] = $val['brand_name'];  
245 - $brand['update'] = $val['new_product_num'];  
246 - $brand['discount'] = $val['product_discount_num'];  
247 - $brand['link'] = Helpers::url('', array(), $val['brand_domain']);  
248 -  
249 - // 处理品牌产品  
250 - $product = array();  
251 - foreach ($val['new_product'] as $one) {  
252 - if (empty($one['product_skn'])) {  
253 - continue;  
254 - } 254 + do {
  255 + // 开始就没获取到数据或者获取的数据为空时的处理
  256 + if ((!$favBrand || isset($favBrand['data']['total']) && empty($favBrand['data']['total'])) && $page == 1) {
  257 + break;
  258 + }
255 259
  260 + // 加载第二页以及第二页之后的数据时接口不返回时的处理
  261 + if ($page > 1 && !$favBrand) {
  262 + $result['end'] = true;
  263 + break;
  264 + }
  265 +
  266 + if ($page <= $favBrand['data']['page_total']) {
  267 + $datas = array();
  268 + $brand = array();
  269 + foreach ($favBrand['data']['brand_list'] as $val) {
  270 + $brand = array();
  271 + $brand['id'] = $val['brand_id'];
  272 + $brand['brandImg'] = !empty($val['brand_ico']) ? Images::getImageUrl($val['brand_ico'], 47, 47) : '';
  273 + $brand['brandName'] = $val['brand_name'];
  274 + $brand['update'] = $val['new_product_num'];
  275 + $brand['discount'] = $val['product_discount_num'];
  276 + $brand['link'] = Helpers::url('', array(), $val['brand_domain']);
  277 +
  278 + // 处理品牌产品
256 $product = array(); 279 $product = array();
257 - $product['link'] = isset($one['goods'][0], $one['cnAlphabet']) ? Helpers::url('/product/pro_' . $one['product_id'] . '_' . $one['goods'][0]['id'] . '/' . $one['cnAlphabet'] . '.html') : '';  
258 - $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';  
259 - $product['price'] = '¥' . Helpers::transPrice($one['market_price']);  
260 - $product['discount'] = ($one['market_price'] > $one['sales_price']) ? '¥' . Helpers::transPrice($one['sales_price']) : false; 280 + foreach ($val['new_product'] as $one) {
  281 + if (empty($one['product_skn'])) {
  282 + continue;
  283 + }
  284 +
  285 + $product = array();
  286 + $product['link'] = isset($one['goods'][0], $one['cnAlphabet']) ? Helpers::url('/product/pro_' . $one['product_id'] . '_' . $one['goods'][0]['id'] . '/' . $one['cnAlphabet'] . '.html') : '';
  287 + $product['imgUrl'] = (isset($one['default_images']) && !empty($one['default_images'])) ? Images::getImageUrl($one['default_images'], 235, 314) : '';
  288 + $product['price'] = '¥' . Helpers::transPrice($one['market_price']);
  289 + $product['discount'] = ($one['market_price'] > $one['sales_price']) ? '¥' . Helpers::transPrice($one['sales_price']) : false;
  290 +
  291 + $brand['productList'][] = $product;
  292 + }
261 293
262 - $brand['productList'][] = $product; 294 + $datas[] = $brand;
263 } 295 }
264 296
265 - $datas[] = $brand; 297 + if (!empty($datas)) {
  298 + $result['hasFavBrand'] = $datas;
  299 + }
  300 + } else {
  301 + $result['end'] = true;
266 } 302 }
267 - !empty($datas) && $result['hasFavBrand'] = $datas;  
268 - } else if (($page > 1 && !$favBrand) || $page > $favBrand['data']['page_total']) {  
269 - $result['end'] = true;  
270 - } 303 + } while (false);
271 304
272 return $result; 305 return $result;
273 } 306 }
@@ -331,7 +364,7 @@ class UserModel @@ -331,7 +364,7 @@ class UserModel
331 364
332 $record = array(); 365 $record = array();
333 $record['product_name'] = $val['product_name']; 366 $record['product_name'] = $val['product_name'];
334 - $record['product_id'] = $val['product_id']; 367 + $record['product_skn'] = $val['product_skn'];
335 $record['link'] = Helpers::url('/product/show_' . $val['product_skn'] . '.html'); 368 $record['link'] = Helpers::url('/product/show_' . $val['product_skn'] . '.html');
336 $record['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : ''; 369 $record['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : '';
337 $record['sales_price'] = Helpers::transPrice($val['sales_price']); 370 $record['sales_price'] = Helpers::transPrice($val['sales_price']);
@@ -148,7 +148,7 @@ class InfoController extends AbstractAction @@ -148,7 +148,7 @@ class InfoController extends AbstractAction
148 } 148 }
149 // 更多商品链接 149 // 更多商品链接
150 elseif (isset($value['link'])) { 150 elseif (isset($value['link'])) {
151 - $build['link'] = $value['link']['data'][0]['url']; 151 + $build['moreLink'] = $value['link']['data'][0]['url'];
152 } 152 }
153 153
154 $data['detail']['content'][] = $build; 154 $data['detail']['content'][] = $build;
@@ -319,7 +319,7 @@ class InfoController extends AbstractAction @@ -319,7 +319,7 @@ class InfoController extends AbstractAction
319 } 319 }
320 // 更多商品链接 320 // 更多商品链接
321 elseif (isset($value['link'])) { 321 elseif (isset($value['link'])) {
322 - $build['link'] = $value['link']['data'][0]['url']; 322 + $build['moreLink'] = $value['link']['data'][0]['url'];
323 } 323 }
324 324
325 $data['detail']['content'][] = $build; 325 $data['detail']['content'][] = $build;
@@ -455,7 +455,7 @@ class InfoController extends AbstractAction @@ -455,7 +455,7 @@ class InfoController extends AbstractAction
455 } 455 }
456 // 更多商品链接 456 // 更多商品链接
457 elseif (isset($value['link'])) { 457 elseif (isset($value['link'])) {
458 - $build['link'] = $value['link']['data'][0]['url']; 458 + $build['moreLink'] = $value['link']['data'][0]['url'];
459 } 459 }
460 460
461 // 内容详情 461 // 内容详情