Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -270,11 +270,11 @@ class SearchData extends \LibModels\Wap\Product\SearchData
}
/**
* 并行调接口url获取(产品分类)
* @param
* @param $condition
* @return string
*/
public static function getClassesUrl($condition)
public static function getClassesUrl($condition = array())
{
$condition['sales'] = 'Y'; //在销售商品分类
$condition['status'] = 1; //上架商品分类
... ... @@ -284,7 +284,8 @@ class SearchData extends \LibModels\Wap\Product\SearchData
/**
* 并行调接口url获取(获取折扣区间)
* @param
* @param array $param
* @return string
*/
public static function getDiscountUrl($param = array())
... ...
... ... @@ -27,6 +27,8 @@ class HelperSearch
public static $selected = array();
//list分类面包屑
public static $listNav = array();
//
public static $specialsaleParam = array();
//设置导航
private static function setListNav()
{
... ... @@ -100,6 +102,10 @@ class HelperSearch
if (isset($data['discount']['discount']) && !empty($data['discount']['discount'])) {
$result['leftContent'][]['allDiscount'] = self::getDiscount($data['discount']['discount']);
}
//一周新品上架
if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//分类条件(搜索页面)
if (isset($data['sort']['sort'])) {
//分类条件(搜索页面)
... ... @@ -110,10 +116,7 @@ class HelperSearch
$result['leftContent'][]['allSort'] = self::groupSort($data['sort']['sort']);
}
}
//一周新品上架
if (isset($data['recent']['recent']) && !empty($data['recent']['recent'])) {
$result['leftContent'][]['newSales'] = self::recentShelve($data['recent']['recent']);
}
//品牌banner
$result['brandBanner'] = isset($data['brand']) && !empty($data['brand']) ? self::getBannerFormat($data['brand'], $options['brandBanner']) : array();
//总记录数
... ... @@ -149,6 +152,7 @@ class HelperSearch
/**
* TODO 组织商品列表信息
* @param $product 接口返回商品列表
* @param $options 条件
* @author sefon 2015-12-21 17:24:04
* @return array
*/
... ... @@ -350,6 +354,13 @@ class HelperSearch
);
$sortList = array();
//加上specialsale_id参数
if (self::$options['controller'] == 'Sale') {
self::$specialsaleParam = array(
'specialsale_id' => isset(self::$params['specialsale_id']) ? self::$params['specialsale_id'] : ''
);
}
foreach ($sort as $key => $val) {
//是否有品牌
if ($options['action'] != 'brand' && $options['controller'] != 'Index') {
... ... @@ -379,13 +390,13 @@ class HelperSearch
$sortList[$key]['name'] = $val['sort_name'];
$sortList[$key]['active'] = isset(self::$params['msort']) && self::$params['msort'] == $val['sort_id'] ? true : false;
$sortList[$key]['childList'][] = array(
'name' => '全部分类',
'name' => '全部'.$val['sort_name'],
'href' => self::buildUrl(array_merge($gender, array('msort'=>$val['sort_id'])))
);
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$sortList[$key]['childList'][$k+1]['name'] = $v['sort_name'];
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($gender, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$sortList[$key]['childList'][$k+1]['href'] = self::buildUrl(array_merge($gender, array('msort' => $val['sort_id'], 'misort' => $v['sort_id']), self::$specialsaleParam));
$sortList[$key]['childList'][$k+1]['childActive'] = isset(self::$params['misort']) && self::$params['misort'] == $v['sort_id'] ? true : false;
}
}
... ... @@ -1037,6 +1048,7 @@ class HelperSearch
if ($data) {
$result['conditions'] = $data;
$result['clearUrl'] = self::current();
}
return $result;
}
... ... @@ -1046,7 +1058,7 @@ class HelperSearch
* @param array $list
* @return array
*/
public static function getDiscount(array $list = array())
public static function getDiscount($list = array())
{
$params = self::$params;
$query = array();
... ... @@ -1085,7 +1097,7 @@ class HelperSearch
$data[$i]['active'] = true;
}
$data[$i]['href'] = self::buildUrl($query);
$data[$i]['name'] = $k;
$data[$i]['name'] = date('m月d日', strtotime($k));
$i++;
}
$result = array(
... ... @@ -1093,6 +1105,7 @@ class HelperSearch
);
unset($data);
unset($query);
return $result;
}
/**
... ... @@ -1101,6 +1114,9 @@ class HelperSearch
public static function current()
{
$url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
if (!empty(self::$specialsaleParam)) {
$url[0] .= '?' . http_build_query(self::$specialsaleParam);
}
return $url[0];
}
/**
... ... @@ -1377,4 +1393,65 @@ class HelperSearch
}
return $url;
}
public static function stripTags($html) {
$search = array(
' ',
"'<script[^>]*?>.*?</script>'si",
"'<[\/\!]*?[^<>]*?>'si",
"'([\r\n])[\s]+'",
"'&(quot|#34|#034|#x22);'i",
"'&(amp|#38|#038|#x26);'i",
"'&(lt|#60|#060|#x3c);'i",
"'&(gt|#62|#062|#x3e);'i",
"'&(nbsp|#160|#xa0);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&(reg|#174);'i",
"'&(deg|#176);'i",
"'&(#39|#039|#x27);'",
"'&(euro|#8364);'i",
"'&a(uml|UML);'",
"'&o(uml|UML);'",
"'&u(uml|UML);'",
"'&A(uml|UML);'",
"'&O(uml|UML);'",
"'&U(uml|UML);'",
"'&szlig;'i",
"\n",
"\r",
"\t",
"\0",
" "
);
return trim(str_replace($search, '', strip_tags($html,"")));
}
/**
*
* 按字来切分字符 (UTF-8截字)
*
* @param String $str
* @param Integer $length
* @param Integer $start
* @param String $encoding
* @return String
*/
public static function mbSubstr($str, $length, $start = 0, $suffix = '...', $encoding = "utf-8") {
if (!is_string($str)) {
return $str;
}
$str = trim($str);
if (mb_strlen($str) == $length) {
return $str;
}
$strs = mb_substr($str, $start, $length, $encoding);
if ((mb_strlen($str) / 3) > $length) {
$strs .= $suffix;
}
return $strs;
}
}
... ...
... ... @@ -97,7 +97,7 @@
<div class="category">
{{# thirdnav}}
<div class="thirdnavlist">
<h1 class="category-title thirdnavbar">{{title}}</h1>
<h1 class="category-title thirdnavbar"><a href="{{link}}">{{title}}</a> </h1>
<ul class="category-list">
{{#branditems}}
<li class="category-
... ...
... ... @@ -15,7 +15,7 @@
</a>
{{^}}
{{#if @last}}
<b>{{name}}</b>
<b>{{{name}}}</b>
{{else}}
{{name}}
{{/if}}
... ...
... ... @@ -482,7 +482,15 @@ function actionGoodsCart() {
if (typeof window.cookie(params.cookie) === 'undefined') {
cartInfo = null;
} else {
if (params.cookie) {
try {
cartInfo = json2.parse(window.cookie(params.cookie));
} catch (e) {
}
}
}
if (cartInfo != null) {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
... ... @@ -682,7 +690,7 @@ function JsonPCallBack(data) {
if (data.data.url !== '') {
topbanner = '<a target="_blank" href="' + data.data.url + '" class="page-top-banner"' +
'style="height:36px;border:none;background-image:url(' + window.unescape(data.data.src) + ');' +
'background-position: center;display:block;background-size:contain">&nbsp;</a>';
'background-position: center;display:block;">&nbsp;</a>';
} else {
topbanner = '<div class="noticewrapper">' +
'<div class="noticecontainer">' +
... ... @@ -1152,7 +1160,7 @@ function actionTipPic() {
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
$('.main-link').attr('href', logolink);
}
... ... @@ -1825,6 +1833,7 @@ function init() {
actionAddKeyWords(); //增加关键字
}
init();
});
define("js/simple-header", ["jquery"], function(require, exports, module){
var $ = require("jquery");
... ... @@ -2112,7 +2121,8 @@ $brandMulti.click(function() {
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
brandShowMore();
$brandPanel.removeClass('hide').addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
... ... @@ -2194,7 +2204,8 @@ $('.multi-select-cancel').click(function() {
$brandMore.trigger('click');
}
$panel.removeClass('multi');
$panel.addClass('hide').removeClass('multi');
brandHideMore();
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
... ... @@ -3533,7 +3544,7 @@ slide = new Slide({
loop: false,
auto: false,
timeout: 2,
index: 3
index: 1
});
slide.on('change', function(data) {
... ... @@ -4764,7 +4775,7 @@ function validateRule(page, $element, callback) {
callback();
} else if (val.length <= 3) {
validateResult[2].message = '短信验证码为4位';
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
callback();
... ... @@ -5778,7 +5789,7 @@ $('#login-btn').on('click', function() {
}
} else {
$passwordTip.removeClass('hide').children('em').html(data.message);
$password.addClass('error');
$password.addClass('error').val('');
}
},
complete: function() {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -147,7 +147,15 @@ function actionGoodsCart() {
if (typeof window.cookie(params.cookie) === 'undefined') {
cartInfo = null;
} else {
if (params.cookie) {
try {
cartInfo = json2.parse(window.cookie(params.cookie));
} catch (e) {
}
}
}
if (cartInfo != null) {
totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
... ... @@ -817,7 +825,7 @@ function actionTipPic() {
}
});
logolink = $('.first-nav-list .cur').find('a').attr('href');
$('.main-link').attr('href', link);
$('.main-link').attr('href', logolink);
}
... ...
... ... @@ -254,7 +254,7 @@ function validateRule(page, $element, callback) {
callback();
} else if (val.length <= 3) {
validateResult[2].message = '短信验证码为4位';
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
callback();
... ...
... ... @@ -759,10 +759,10 @@
.gobuy {
margin-top: 47px;
margin-left: 23px;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdX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hYiW8WIIOaP2HpIqkov9h06ycQN0jBtVmDusCOpTPJihAm8x1SVqRjEW5gmBDnYVW5KfWxeMC1uGSvPDTnSFNTEXKfdAbySegWZUbYbIWUVnLH7VDM+ndP4mm4Q6eYA6uI23LsKk2uDwj5+M6+BJgAFPmZONXOE3uAAAAAElFTkSuQmCC);
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsSAAALEgHS3X78AAABc0lEQVRIx73VvS9DURjH8W+LTYTZfyBCIhLJM0pMNotJxCJi8xdYJWI0WFkstg6mumn1pxEikXiX2Fgog5dUBUNv5fa62tJzPdNznufc80lO7jknYWbrwDjVcQz0S3rDUSSBsYh6D9DnCqlAs0AaOAn1hlxCiUpiZgPAfqC3KmkyDqgFKAAdfukSGHFgFCXdJIIVM0sBoy63zI/FZKiQiQEBmPsv6C4M7QFPMUBeFeQfUMUO+RHH9m1HQZ5j5BY4ioJ2gaJDKCPp4xsk6RXIO4SyUL7rosJzCHm1oKwj5AE4rAXtACUHUE7S+4+QpGfKP0Wz4VWSZCOTmoitRqBl4LwJZE3S1/uWqDfbzDr/gJQkVd2ZdaEAaEAXkJb0Eup1U376DyRdRX2frE+AmS0BOSAFZMysNdDrBU6BDeDMzIb/DAHTgXwQGAiMJ4B2P28DppqBCqHxfSC/rTP3V9AMcA08AvOSLgK9FWCT8gHPAwtRC3wCDWxrvGA4PUcAAAAASUVORK5CYII=);
background-repeat: no-repeat;
width: 30px;
height: 30px;
width: 26px;
height: 26px;
position: relative;
cursor: pointer;
}
... ...
... ... @@ -46,11 +46,9 @@ class SaleModel
$data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['saleBanner']['img'] = $special['banner'][0]['img'];
$data['saleTitle']['name'] = '全部商品';
$data['saleTitle']['count'] = $data['totalCount'];
$data['saleTitle']['count'] = isset($data['totalCount']) ? $data['totalCount'] : 0;
}
//获取广告位数据
if (isset($special['left_ad_code'])) {
$nodeContent = HelperSearch::getNodeContent($special['left_ad_code']);
... ...
... ... @@ -157,9 +157,10 @@ class SearchModel
// 组合搜索商品url
$urlList['product'] = SearchData::getProductUrl($searchCondition['condition']);
// 组合搜索分类url
$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
//$urlList['sort'] = SearchData::getClassesUrl($searchCondition['sortCondition']);
$urlList['sort'] = SearchData::getClassesUrl();
// 组合搜索折扣区间url
$urlList['discount'] = SearchData::getDiscountUrl($searchCondition['condition']);
$urlList['discount'] = SearchData::getDiscountUrl();
$result = Yohobuy::getMulti($urlList);
// 组织模板数据
$data = HelperSearch::getList($result, $searchCondition['options']);
... ... @@ -275,4 +276,32 @@ class SearchModel
return HelperSearch::size($result['data']['filter'], true);
}
}
/**
* @param $keyword
* @return array
*/
public static function searchError($keyword) {
$keyword = HelperSearch::stripTags($keyword);
$keyword = HelperSearch::mbSubstr($keyword, 300);
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -66,14 +66,15 @@ class ListController extends WebAction
$options['controller'] = 'Index';
$options['action'] = 'sale';
$options['reviewNum'] = 6;
$condition = array(
'p_d' => '0.01,0.99'
);
$option = array(
'controller' => 'List',
'action' => 'sale',
'reviewNum' => 6
);
$condition = array();
if (!$this->get('p_d')){
$condition['p_d'] = '0.01,0.99';
}
$list = SearchModel::getListData($condition,$option);
$data = array(
//初始化js
... ...
... ... @@ -30,7 +30,6 @@ class SaleController extends WebAction
$special = array();
}
$condition = array();
//传品牌ID参数
if(!empty($special['brand_id'])){
... ... @@ -50,7 +49,6 @@ class SaleController extends WebAction
);
$saleData = SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
... ...
... ... @@ -63,24 +63,7 @@ class SearchController extends WebAction
public function errorAction()
{
$keyword = $this->get('query');
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http:://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
$data = SearchModel::searchError($keyword);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
... ...
... ... @@ -26,6 +26,12 @@ routes.searchsuggest.route.module = Product
routes.searchsuggest.route.controller = Search
routes.searchsuggest.route.action = suggest
;error(suggest 错误提示)
routes.searcherror.type = "rewrite"
routes.searcherror.match = "/error"
routes.searcherror.route.module = Product
routes.searcherror.route.controller = Search
routes.searcherror.route.action = error
;about(品牌介绍)
routes.brandabout.type = "rewrite"
... ... @@ -33,3 +39,5 @@ routes.brandabout.match = "/about"
routes.brandabout.route.module = Product
routes.brandabout.route.controller = Index
routes.brandabout.route.action = about
... ...