Authored by Rock Zhang

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

Conflicts:
	library/Api/Yohobuy.php
Showing 37 changed files with 1032 additions and 873 deletions
... ... @@ -44,8 +44,8 @@ class Yohobuy
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* PC重构地址 */
const API_URL = 'http://test2.open.yohobuy.com/';
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const API_URL = 'http://test.open.yohobuy.com/';
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
... ...
... ... @@ -77,7 +77,7 @@ class Process
$val['url'] = Helpers::transUrl($val['url'], $type);
$temp['tplrecommend']['category'][] = array(
'name' => $val['name'],
'url' => $val['url']
'href' => $val['url']
);
}
... ... @@ -118,12 +118,17 @@ class Process
$height = 450;
if ($data['focus_type'] == 1) {
foreach ($data['data'] as $val) {
$ret = array();
$val['src'] = Images::getImageUrl($val['src'], $width, $height, 1);
$val['url'] = Helpers::transUrl($val['url'], $type);
$temp[] = array(
$ret = array (
'href' => $val['url'],
'img' => $val['src']
'img' => $val['src'],
);
if(!empty($val['bgColor'])) {
$ret['bgColor'] = $val['bgColor'];
}
$temp[] = $ret;
}
$result['slide']['list'] = $temp;
}
... ... @@ -149,7 +154,8 @@ class Process
$val['url'] = Helpers::transUrl($val['url'], $type);
$temp['list'][] = array(
'href' => $val['url'],
'img' => $val['src']
'img' => $val['src'],
// 'bgColor'=> $val[]
);
}
... ...
... ... @@ -97,11 +97,8 @@ class HelperSearch
$result['opts']['pageCounts'] = self::viewNum();
$result['opts']['curPage'] = self::$page;
$result['opts']['pageCount'] = $data['data']['page_total'];
$result['opts']['nextHref'] = self::next($data['data']['page_total'],$data['data']['filter']);
$result['hasNextPage'] = array(
'href' => self::next($data['data']['page_total'],$data['data']['filter']),
'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
);
$result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : '';
$result['hasNextPage'] = self::next($data['data']['page_total']);
//分类
$result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
//一周新品上架
... ... @@ -168,12 +165,6 @@ class HelperSearch
public static function standard($filter) {
$params = self::$params;
$result = array();
if (empty(self::$params)) {
return $result;
}
if (empty($filter) || !is_array($filter)) {
return array();
}
foreach ($filter as $key => $val) {
if (substr_compare($key, 'parameter', 0, 9) != 0) {
continue;
... ... @@ -181,7 +172,6 @@ class HelperSearch
if (!isset($val['sub']) || empty($val['sub'])) {
continue;
}
$sub = array();
foreach ($val['sub'] as $pval) {
if (isset(self::$params['parameter_' . $val['standard_id']]) && self::$params['parameter_' . $val['standard_id']] == $pval['standard_id']) {
... ... @@ -189,12 +179,12 @@ class HelperSearch
unset($tmpParams['parameter_' . $val['standard_id']]);
self::$selected['parameter_' . $val['standard_id']] = array(
'name' => $pval['standard_name'],
'href' => self::buildurl($tmpParams)
'href' => self::buildUrl($tmpParams)
);
}
$sub[] = array(
'name' => $pval['standard_name'],
'href' => self::buildurl(array_merge($params, array(
'href' => self::buildUrl(array_merge($params, array(
'parameter_' . $val['standard_id'] => $pval['standard_id']
))) ,
'selected' => isset(self::$params['parameter_' . $val['standard_id']]) && self::$params['parameter_' . $val['standard_id']] == $pval['standard_id'] ? true : false
... ... @@ -223,21 +213,20 @@ class HelperSearch
if (isset($params['gender'])) {
unset($params['gender']);
}
//设置选中
if ($gender == '1,3' || $gender == '2,3') {
self::$selected['gender'] = array(
'name' => $gender == '1,3' ? 'BOYS' : 'GIRLS',
'href' => self::buildurl($params)
'href' => self::buildUrl($params)
);
}
$result = array();
foreach ($filter['gender'] as $key => $val) {
$result[] = array(
'name' => $val,
'href' => self::buildurl(array_merge($params, array(
'href' => self::buildUrl(array_merge($params, array(
'gender' => $key
))) ,
'selected' => $gender == $key ? true : false
);
}
return $result;
... ... @@ -249,105 +238,50 @@ class HelperSearch
* @param array $option
* @return array
*/
public static function groupSort($sort, $option = array()) {
public static function groupSort($sort, $option = array())
{
//设置导航
self::setListNav($option);
$params = self::$params;
$gender = isset($params['gender']) ? $params['gender'] : '';
$query = array();
if (isset($option['needKeyword']) && $option['needKeyword'] == 'Y') {
if (isset($params['query']) && !empty($params['query'])) {
$query['query'] = $params['query'];
}
if (isset($params['keyword']) && !empty($params['keyword'])) {
$query['keyword'] = $params['keyword'];
}
}
if (isset($params['gender']) && !empty($params['gender'])) {
$query['gender'] = $params['gender'];
}
if (isset($option['needDay']) && !empty($option['needDay']) && isset($params['day']) && !empty($params['day'])) {
$query['day'] = $params['day'];
}
if (isset($option['needPd']) && !empty($option['needPd']) && isset($params['p_d']) && !empty($params['p_d'])) {
$query['p_d'] = $params['p_d'];
}
if (isset($option['specialsale_id']) && !empty($option['specialsale_id']) && isset($params['specialsale_id']) && !empty($params['specialsale_id'])) {
$query['specialsale_id'] = $params['specialsale_id'];
}
$result = array(
'all' => array(
'sort_id' => 0,
'name' => '全部品类',
'href' => self::buildurl($query) ,
// 'num' => 0,
'active' => ''
'href' => self::buildUrl() ,
'active' => isset($params['msort']) ? false : true,
) ,
'list' => array()
);
foreach ($sort as $val) {
$sortList = array();
foreach ($sort as $key => $val) {
//若参数有分类,设置导航
if (isset($params['msort']) && $params['msort'] == $val['sort_id']) {
$nav_index = isset($option['brandName']) && $option['brandName'] ? 2 : 1;
self::$listnav[$nav_index] = array(
'sort_id' => $val['sort_id'],
//是否有品牌
$navIndex = isset($option['brandName']) && $option['brandName'] ? 2 : 1;
self::$listnav[$navIndex] = array(
'name' => $val['sort_name'],
'href' => self::buildurl(array(
'href' => self::buildUrl(array(
'msort' => $val['sort_id'],
'gender' => $gender
))
);
}
//$result['all']['num']+= $val['count'];
$msort = array(
'sort_id' => $val['sort_id'],
'name' => $val['sort_name'],
// 'num' => $val['count'],
'active' => isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id']
))) ,
'childList' => array()
unset($params['msort']);
unset($params['misort']);
$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' => '全部分类',
'href' => self::buildUrl(array_merge($params, array('msort'=>$val['sort_id'])))
);
$sub = array();
if (!empty($val['sub'])) {
$sub[] = array(
'sort_id' => $val['sort_id'],
'name' => '全部' . $val['sort_name'],
// 'num' => $val['count'],
'childActive' => !isset($params['misort']) && isset($params['msort']) && $params['msort'] == $val['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id']
))) ,
);
foreach ($val['sub'] as $mval) {
if (isset($params['misort']) && $params['misort'] == $mval['sort_id']) {
$nav_index = isset($option['brandName']) && $option['brandName'] ? 3 : 2;
self::$listnav[$nav_index] = array(
'sort_id' => $mval['sort_id'],
'name' => $mval['sort_name'],
'href' => ''
);
}
$sub[] = array(
'sort_id' => $mval['sort_id'],
'name' => $mval['sort_name'],
// 'num' => $mval['count'],
'childActive' => isset($params['misort']) && $params['misort'] == $mval['sort_id'] ? true : false,
'href' => self::buildurl(array_merge($query, array(
'msort' => $val['sort_id'],
'misort' => $mval['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($params, array('msort' => $val['sort_id'], 'misort' => $v['sort_id'])));
$sortList[$key]['childList'][$k+1]['childActive'] = isset(self::$params['misort']) && self::$params['misort'] == $v['sort_id'] ? true : false;
}
$msort['childList'] = $sub;
}
$result['list'][] = $msort;
}
$result['list'] = $sortList;
return $result;
}
... ... @@ -358,14 +292,10 @@ class HelperSearch
* @return array
*/
public static function brand($filter, $options = array()) {
//品牌列表返回空
if (isset($options['brandName'])) {
return array();
}
$params = self::$params;
$brand_ids = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array();
if (isset($params['brand'])) {
unset($params['brand']);
}
$result = array(
'default' => array() ,
'brandIndex' => array(
... ... @@ -374,58 +304,28 @@ class HelperSearch
'H~N',
'O~T',
'U~Z') ,
'brandsShow' => array() ,
'list' => array(
'0~9' => array() ,
'A~G' => array() ,
'H~N' => array() ,
'O~T' => array() ,
'U~Z' => array() ,
)
'brandsShow' => array()
);
$brand_keys = array_reverse(array_keys($result['list']));
$params = self::$params;
//url中的品牌ids
$brandIds = isset($params['brand']) && !empty($params['brand']) ? explode(',', $params['brand']) : array();
if (isset($filter['brand']) && !empty($filter['brand'])) {
//有商品结果时
$brand = $filter['brand'];
foreach ($brand as $v) {
if (!isset($v['brand_alif']) && isset($v['brand_name_en'])) {
$v['brand_alif'] = substr($v['brand_name_en'], 0, 1);
}
else if (!isset($v['brand_alif'])) {
$v['brand_alif'] = '';
}
if (!isset($v['brand_domain'])) {
$v['brand_domain'] = '';
}
//选中的筛选条件
if (in_array($v['id'], $brand_ids)) {
$selected_brand = explode(',', self::$params['brand']);
$selected_key = array_search($v['id'], $selected_brand);
unset($selected_brand[$selected_key]);
$selected_params = $params;
$selected_params['brand'] = implode(',', $selected_brand);
self::$selected['brand'][] = array(
'name' => $v['brand_name'],
'href' => self::buildurl($selected_params)
);
}
$selected_brand = isset(self::$params['brand']) && !empty(self::$params['brand']) ? explode(',', self::$params['brand']) : array();
if (empty($selected_brand)) {
$url = self::buildurl(array_merge($params, array(
'brand' => $v['id']
)));
}
else if (in_array($v['id'], $brand_ids)) {
$tk = array_search($v['id'], $selected_brand);
unset($selected_brand[$tk]);
$url = self::buildurl(array_merge($params, array(
'brand' => implode(',', $selected_brand)
foreach ($brand as $key => $v) {
$selectBrandIds = $brandIds;
//品牌id在提交的参数中,构造url参数去除该品牌id
if (in_array($v['id'], $brandIds)) {
$filterKey = array_search($v['id'], $selectBrandIds);
unset($selectBrandIds[$filterKey]);
$url = self::buildUrl(array_merge($params, array(
'brand' => implode(',', $selectBrandIds)
)));
}
//该品牌url参数中添加该品牌的id
else {
$selected_brand[] = $v['id'];
$url = self::buildurl(array_merge($params, array(
'brand' => implode(',', $selected_brand)
$selectBrandIds[] = $v['id'];
$url = self::buildUrl(array_merge($params, array(
'brand' => implode(',', $selectBrandIds)
)));
}
$this_brand = array(
... ... @@ -433,53 +333,41 @@ class HelperSearch
'name' => $v['brand_name'],
'alif' => $v['brand_alif'],
'href' => $url,
'active' => in_array($v['id'], $brand_ids) ? true : false
'active' => in_array($v['id'], $brandIds) ? true : false
);
//默认品牌
if (count($result['default']) < 10) {
$result['default'][] = $this_brand;
}
$result['brandsShow'][] = $this_brand;
foreach ($brand_keys as $range) {
if (ord($v['brand_alif']) >= ord($range)) {
$_order_key = $v['brand_alif'] . $v['brand_name'];
$result['list'][$range][$_order_key] = $this_brand;
break;
}
}
//品牌列表
$brandList[$v['brand_alif']][] = $this_brand;
$brandAll[$v['id']] = $v['brand_name'];
}
foreach ($result['list'] as $key => $value) {
ksort($result['list'][$key]);
$result['list'][$key] = array_values($result['list'][$key]);
if (empty($value)) {
unset($result['list'][$key]);
}
//清空品牌参数
unset($params['brand']);
//设置已选中的品牌
foreach ($brandIds as $key => $val) {
$brandParam = $brandIds;
unset($brandParam[$key]);
$params['brand'] = implode(',', $brandParam);
self::$selected['brand'][] = array(
'name' => $brandAll[$val],
'href' => self::buildUrl($params)
);
}
}
else if (isset($filter['paramNames']) && isset($filter['paramNames']['brand'])) {
//无商品结果时且选择了品牌
$brand = $filter['paramNames']['brand'];
foreach ($brand as $v) {
//选中的筛选条件
if (in_array($v['id'], $brand_ids)) {
$selected_brand = explode(',', self::$params['brand']);
$selected_key = array_search($v['id'], $selected_brand);
unset($selected_brand[$selected_key]);
$selected_params = $params;
$selected_params['brand'] = implode(',', $selected_brand);
self::$selected['brand'][] = array(
'name' => $v['name'],
'href' => self::buildurl($selected_params)
);
//品牌列表排序
ksort($brandList);
foreach ($brandList as $key => $val) {
if (is_array($val)) {
foreach ($val as $v) {
$result['brandsShow'][] = $v;
}
}
}
$result['list'] = array();
}
else {
$result['list'] = array();
unset($brandList);
}
return $result;
}
/**
* 尺码的链接,不能多选
* @param array $filter
... ... @@ -487,7 +375,7 @@ class HelperSearch
*/
public static function size($filter) {
$params = self::$params;
$size_id = isset($params['size']) && !empty($params['size']) ? $params['size'] : '';
$sizeId = isset($params['size']) && !empty($params['size']) ? $params['size'] : '';
if (isset($params['size'])) {
unset($params['size']);
}
... ... @@ -495,32 +383,21 @@ class HelperSearch
if (isset($filter['size']) && !empty($filter['size'])) {
$size = $filter['size'];
foreach ($size as $v) {
if ($v['size_id'] == $size_id) {
//设置选中
if ($v['size_id'] == $sizeId) {
self::$selected['size'] = array(
'name' => $v['size_name'],
'href' => self::buildurl($params)
'href' => self::buildUrl($params)
);
}
$result[] = array(
'size_id' => $v['size_id'],
'name' => $v['size_name'],
'href' => self::buildurl(array_merge($params, array(
'href' => self::buildUrl(array_merge($params, array(
'size' => $v['size_id']
))) ,
'selected' => $size_id == $v['size_id'] ? true : false
);
}
}
else if (isset($filter['paramNames']) && isset($filter['paramNames']['size'])) {
$size = $filter['paramNames']['size'];
foreach ($size as $val) {
self::$selected['size'] = array(
'name' => $val['name'],
'href' => self::buildurl($params)
);
}
}
return $result;
}
... ... @@ -531,51 +408,29 @@ class HelperSearch
*/
public static function color($filter) {
$params = self::$params;
$color_id = isset($params['color']) && !empty(self::$params['color']) ? self::$params['color'] : '';
$colorId = isset($params['color']) && !empty(self::$params['color']) ? self::$params['color'] : '';
if (isset($params['color'])) {
unset($params['color']);
}
$result = array();
if (isset($filter['color']) && !empty($filter['color'])) {
//有商品结果时的颜色
$color = $filter['color'];
foreach ($color as $v) {
if ($v['color_id'] == $color_id) {
$background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")";
self::$selected['color'] = array(
'color' => $background,
'href' => self::buildurl($params)
);
}
$result[] = array(
'color_id' => $v['color_id'],
'name' => $v['color_name'],
'rgb' => empty($v['color_value']) ? '#' . $v['color_code'] : "url({$v['color_value']})",
'href' => self::buildurl(array_merge($params, array(
'color' => $v['color_id']
))) ,
'selected' => $color_id == $v['color_id'] ? true : false
$color = $filter['color'];
foreach ($color as $v) {
//设置已选中
if ($v['color_id'] == $colorId) {
$background = empty($v['color_value']) ? '#' . $v['color_code'] : "url(" . $v['color_value'] . ")";
self::$selected['color'] = array(
'color' => $background,
'href' => self::buildUrl($params)
);
}
$result[] = array(
'name' => $v['color_name'],
'rgb' => empty($v['color_value']) ? '#' . $v['color_code'] : "url({$v['color_value']})",
'href' => self::buildUrl(array_merge($params, array(
'color' => $v['color_id']
))) ,
);
}
else if (isset($filter['paramNames']) && isset($filter['paramNames']['color'])) {
//无商品结果时的颜色
$color = $filter['paramNames']['color'];
foreach ($color as $v) {
if ($v['id'] == $color_id) {
$background = empty($v['value']) ? '#' . $v['code'] : "url(" . $v['value'] . ")";
self::$selected['color'] = array(
'name' => '<em style="background:' . $background . ';">&nbsp;</em>',
'href' => self::buildurl($params)
);
}
}
}
return $result;
}
... ... @@ -586,53 +441,27 @@ class HelperSearch
*/
public static function price($filter) {
$params = self::$params;
$price_id = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price'])) {
unset($params['price']);
}
$result = array();
if (isset($filter['price']) && !empty($filter['price'])) {
//有商品时
if (!empty($price_id) && isset($filter['price'][$price_id])) {
self::$selected['price'] = array(
'name' => $filter['price'][$price_id],
'href' => self::buildurl($params)
);
}
else if (!empty($price_id)) {
$_price = explode(',', $price_id);
if (count($_price) == 2) {
self::$selected['price'] = array(
'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$_price[0] . '-' . (int)$_price[1],
'href' => self::buildurl($params)
);
}
}
foreach ($filter['price'] as $key => $val) {
$val = trim($val,'¥');
$result[] = array(
'name' => $val,
'href' => self::buildurl(array_merge($params, array(
'price' => $key
))) ,
'selected' => isset(self::$params['price']) && $key == self::$params['price'] ? true : false
);
}
//设置已选中价格
if (!empty($priceId) && isset($filter['price'][$priceId])) {
self::$selected['price'] = array(
'name' => $filter['price'][$priceId],
'href' => self::buildUrl($params)
);
}
else if (!empty($price_id)) {
//无商品结果时
$_price = explode(',', $price_id);
if (count($_price) == 2) {
self::$selected['price'] = array(
'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$_price[0] . '-' . (int)$_price[1],
'href' => self::buildurl($params)
);
}
//返回价格条件
foreach ($filter['price'] as $key => $val) {
$val = trim($val,'¥');
$result[] = array(
'name' => $val,
'href' => self::buildUrl(array_merge($params, array(
'price' => $key
))) ,
);
}
return $result;
}
... ... @@ -644,75 +473,46 @@ class HelperSearch
*/
public static function style($filter) {
$params = self::$params;
$style_ids = isset($params['style']) && !empty($params['style']) ? explode(',', $params['style']) : array();
$styleIds = isset($params['style']) && !empty($params['style']) ? explode(',', $params['style']) : array();
if (isset($params['style'])) {
unset($params['style']);
}
$result = array();
if (isset($filter['style']) && !empty($filter['style'])) {
//有商品结果时
$style = $filter['style'];
foreach ($style as $v) {
//选中的筛选条件
if (in_array($v['style_id'], $style_ids)) {
$selected_style = explode(',', self::$params['style']);
$selected_key = array_search($v['style_id'], $selected_style);
unset($selected_style[$selected_key]);
$selected_params = $params;
$selected_params['style'] = implode(',', $selected_style);
self::$selected['style'][] = array(
'name' => $v['style_name'],
'href' => self::buildurl($selected_params)
);
}
$selected_style = isset(self::$params['style']) && !empty(self::$params['style']) ? explode(',', self::$params['style']) : array();
if (empty($selected_style)) {
$url = self::buildurl(array_merge($params, array(
'style' => $v['style_id']
)));
}
else if (in_array($v['style_id'], $selected_style)) {
$tk = array_search($v['style_id'], $selected_style);
unset($selected_style[$tk]);
$url = self::buildurl(array_merge($params, array(
'style' => implode(',', $selected_style)
)));
}
else {
$selected_style[] = $v['style_id'];
$url = self::buildurl($params + array(
'style' => implode(',', $selected_style)
));
}
$result[] = array(
'style_id' => $v['style_id'],
$style = $filter['style'];
foreach ($style as $v) {
//选中的筛选条件
if (in_array($v['style_id'], $styleIds)) {
$selectedStyle = explode(',', self::$params['style']);
$selectedKey = array_search($v['style_id'], $selectedStyle);
unset($selectedStyle[$selectedKey]);
$selectedParams = $params;
$selectedParams['style'] = implode(',', $selectedStyle);
self::$selected['style'][] = array(
'name' => $v['style_name'],
'href' => $url,
'selected' => in_array($v['style_id'], $style_ids) ? true : false
'href' => self::buildUrl($selectedParams)
);
}
}
else if (isset($filter['paramNames']) && isset($filter['paramNames']['style'])) {
//无商品结果时
$style = $filter['paramNames']['style'];
foreach ($style as $v) {
//选中的筛选条件
if (in_array($v['id'], $style_ids)) {
$selected_style = explode(',', self::$params['style']);
$selected_key = array_search($v['id'], $selected_style);
unset($selected_style[$selected_key]);
$selected_params = $params;
$selected_params['style'] = implode(',', $selected_style);
self::$selected['style'][] = array(
'name' => $v['name'],
'href' => self::buildurl($selected_params)
);
}
$selectedStyle = isset(self::$params['style']) && !empty(self::$params['style']) ? explode(',', self::$params['style']) : array();
//风格id在提交的参数中,构造url参数去除该风格id
if (in_array($v['style_id'], $selectedStyle)) {
$filterKey = array_search($v['style_id'], $selectedStyle);
unset($selectedStyle[$filterKey]);
$url = self::buildUrl(array_merge($params, array(
'style' => implode(',', $selectedStyle)
)));
}
//该风格url参数中添加该风格的id
else {
$selectedStyle[] = $v['style_id'];
$url = self::buildUrl(array_merge($params, array(
'style' => implode(',', $selectedStyle)
)));
}
$result[] = array(
'id' => $v['style_id'],
'name' => $v['style_name'],
'href' => $url,
);
}
$data[0] = array(
'attr' => 'style',
... ... @@ -739,18 +539,14 @@ class HelperSearch
public static function viewNum()
{
$params = self::$params;
$view_num = array(
60,
100,
200
);
$viewNum = array(60, 100, 200);
$result = array();
foreach ($view_num as $value) {
foreach ($viewNum as $value) {
$params['viewNum'] = $value;
$params['page'] = 1;
$result[] = array(
'count' => $value,
'href' => self::buildurl($params)
'href' => self::buildUrl($params)
);
}
return $result;
... ... @@ -762,10 +558,8 @@ class HelperSearch
public static function rowNum($num = 5)
{
$params = self::$params;
$params['rowNum'] = $num;
return self::buildurl($params);
return self::buildUrl($params);
}
/**
... ... @@ -773,6 +567,7 @@ class HelperSearch
*/
public static function specialoffer()
{
$selected = '';
$params = self::$params;
if (isset($params['specialoffer']) && !empty($params['specialoffer'])) {
unset($params['specialoffer']);
... ... @@ -780,12 +575,10 @@ class HelperSearch
}
else {
$params['specialoffer'] = 1;
$selected = '';
}
return array(
'name' => '打折',
'href' => self::buildurl($params) ,
'href' => self::buildUrl($params) ,
'checked' => $selected
);
}
... ... @@ -795,6 +588,7 @@ class HelperSearch
*/
public static function limited()
{
$selected = '';
$params = self::$params;
if (isset($params['limited']) && !empty($params['limited'])) {
unset($params['limited']);
... ... @@ -802,11 +596,10 @@ class HelperSearch
}
else {
$params['limited'] = 'Y';
$selected = '';
}
return array(
'name' => '限量',
'href' => self::buildurl($params) ,
'href' => self::buildUrl($params) ,
'checked' => $selected
);
}
... ... @@ -817,18 +610,17 @@ class HelperSearch
public static function isnew()
{
$params = self::$params;
$selected = '';
if (isset($params['isNew']) && !empty($params['isNew'])) {
unset($params['isNew']);
$selected = true;
}
else {
$params['isNew'] = 'Y';
$selected = false;
}
return array(
'name' => '新品',
'href' => self::buildurl($params) ,
'href' => self::buildUrl($params) ,
'checked' => $selected
);
}
... ... @@ -844,10 +636,10 @@ class HelperSearch
}
$result = array(
'name' => '最新',
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildurl($params) : self::buildurl(array_merge($params, array(
'order' => 's_t_desc'
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildUrl($params) : self::buildUrl(array_merge($params, array(
'order' => 's_t_asc'
))) ,
'selected' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? true : ''
'active' => isset(self::$params['order']) && self::$params['order'] == 's_t_asc' ? true : ''
);
return $result;
}
... ... @@ -863,8 +655,8 @@ class HelperSearch
}
$result = array(
'name' => '默认',
'href' => self::buildurl($params) ,
'selected' => !isset(self::$params['order']) || empty(self::$params['order']) ? true : ''
'href' => self::buildUrl($params) ,
'active' => !isset(self::$params['order']) || empty(self::$params['order']) ? true : ''
);
return $result;
}
... ... @@ -882,33 +674,34 @@ class HelperSearch
's_p_asc',
's_p_desc'
))) {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 's_p_asc'
)));
$asc = '';
$desc = '';
$active = '';
$desc = true;
}
else if (self::$params['order'] == 's_p_asc') {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 's_p_desc'
)));
$asc = true;
$desc = '';
$active = true;
$desc = true;
}
else {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 's_p_asc'
)));
$asc = '';
$desc = true;
$desc = '';
$active = '';
}
$result = array(
'name' => '价格',
'href' => $url,
'asc' => $asc,
'hasSortOrient' => true,
'active' => $active,
'desc' => $desc
);
return $result;
}
... ... @@ -925,21 +718,21 @@ class HelperSearch
'p_d_asc',
'p_d_desc'
))) {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 'p_d_asc'
)));
$asc = '';
$desc = '';
}
else if (self::$params['order'] == 'p_d_asc') {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 'p_d_desc'
)));
$asc = true;
$desc = '';
}
else {
$url = self::buildurl(array_merge($params, array(
$url = self::buildUrl(array_merge($params, array(
'order' => 'p_d_asc'
)));
$asc = '';
... ... @@ -947,6 +740,7 @@ class HelperSearch
}
$result = array(
'name' => '折扣',
'hasSortOrient' => true,
'href' => $url,
'asc' => $asc,
'desc' => $desc
... ... @@ -956,58 +750,16 @@ class HelperSearch
}
/**
* 获取自定义价格要提交的地址
*/
public static function priceSubmit()
{
$params = self::$params;
$price = array();
if (isset($params['price'])) {
$price = explode(',', $params['price']);
unset($params['price']);
}
$result = array();
foreach ($params as $key => $value) {
$result[] = '<input type="hidden" name="' . $key . '" value="' . $value . '">';
}
if (count($price) == 2 && !in_array(self::$params['price'], array(
'0,300',
'300,600',
'600,1000',
'1000,2000',
'2000,99999'
))) {
return array(
'start' => $price[0],
'end' => $price[1],
'selected' => true,
'form' => implode('', $result)
);
}
else {
return array(
'start' => '',
'end' => '',
'selected' => false,
'form' => implode('', $result)
);
}
}
/**
* 组织参数
* @param array $params
* @return string
*/
private static function buildurl($params)
private static function buildUrl($params = array())
{
if (empty($params)) {
return self::current();
}
$queryPath = explode('?', $_SERVER['REQUEST_URI']);
$params_arr = array();
foreach ($params as $key => $val) {
if (is_array($val) || $val === '') {
... ... @@ -1054,31 +806,18 @@ class HelperSearch
public static function getDiscount(array $list = array())
{
$params = self::$params;
if (empty($list)) {
return array();
}
$params = $_GET;
$query = array();
if (isset($params['gender'])) {
$query['gender'] = $params['gender'];
}
if (isset($params['msort'])) {
$query['msort'] = $params['msort'];
}
if (isset($params['misort'])) {
$query['misort'] = $params['misort'];
}
$total = 0;
foreach ($list as $k => $v) {
$total+= $v['count'];
$total += $v['count'];
$query['p_d'] = $k;
$list[$k]['href'] = self::buildurl($query);
//$list[$k]['num'] = $total;
$list[$k]['href'] = self::buildUrl($query);
$list[$k]['active'] = isset($params['p_d']) && $params['p_d'] == $k ? true : false;
}
$result = array(
//'updateNum' => $total,
'list' => array_values($list)
);
return $result;
... ... @@ -1094,15 +833,6 @@ class HelperSearch
}
$params = self::$params;
$query = array();
if (isset($params['gender'])) {
$query['gender'] = $params['gender'];
}
if (isset($params['msort'])) {
$query['msort'] = $params['msort'];
}
if (isset($params['misort'])) {
$query['misort'] = $params['misort'];
}
$data = array();
$i = 0;
foreach ($list as $k => $v) {
... ... @@ -1113,7 +843,7 @@ class HelperSearch
if (isset($params['shelve_time']) && $query['shelve_time'] == $params['shelve_time']) {
$data[$i]['active'] = true;
}
@$data[$i]['href'] = self::buildurl($query);
$data[$i]['href'] = self::buildUrl($query);
$data[$i]['name'] = $k;
$i++;
}
... ... @@ -1121,6 +851,8 @@ class HelperSearch
//'updateNum' => $total,
'list' => $data
);
unset($data);
unset($query);
return $result;
}
/**
... ... @@ -1132,17 +864,22 @@ class HelperSearch
return $url[0];
}
/**
* 下一页地址
* 下一页
*/
public static function next($total,$filter){
$page = 1;
public static function next($total){
$param = self::$params;
$page = self::$page;
if($page < $total){
$next = array();
if ($page < $total) {
$page ++;
$param['page'] = $page;
$nextUrl = self::buildUrl($param);
$next = array(
'href' => $nextUrl,
'src' => 'http://img10.static.yhbimg.com/product/2014/01/15/11/01fa01614784f6239760f1b749663016f1.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
);
}
return self::buildurl($param);
return $next;
}
/**
... ... @@ -1164,8 +901,8 @@ class HelperSearch
return $result;
}
//分页
public static function pager($total,$view_num){
public static function pager($total,$viewNum){
$Paging = new Paging('Yoho');
return $Paging->setTotal($total)->setSize($view_num)->view(0);
return $Paging->setTotal($total)->setSize($viewNum)->view(0);
}
}
... ...
... ... @@ -15,5 +15,5 @@ return array(
// 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
'transport' => 'http',
// 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数)
'return_url' => SITE_MAIN . '/passport/login/alipaycallback',
'return_url' => SITE_MAIN . '/passport/autosign/alipaycallback',
);
... ...
<?php
defined('DOMAIN') || define('DOMAIN', $_SERVER['HTTP_HOST']);
defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appId' => '09f4fa0661be14ec1ddeee13253a3ec4',
'appKey' => 'b4204e2055d63102',
'callback' => DOMAIN . '/passport/login/doubanback',
'appId' => '03b4e36bf13dc75a0b1eaa43d3b9560e',
'appKey' => 'f16d5913e8610672',
'callback' => SITE_MAIN . '/passport/autosign/doubanback',
'scope' => 'douban_basic_common',
);
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appid' => '100229394',
'appkey' => 'c0af9c29e0900813028c2ccb42021792',
'callback' => SITE_MAIN . '/passport/login/qqcallback',
'callback' => SITE_MAIN . '/passport/autosign/qqcallback',
'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist',
'errorReport' => true,
);
\ No newline at end of file
... ...
<?php
defined('DOMAIN') || define('DOMAIN', $_SERVER['HTTP_HOST']);
defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appId' => '783130c654c94a77ace97054ae266019',
'appKey' => '05e430de8c1e40d3a1f39ca8d3f8252c',
'callback' => DOMAIN . '/passport/login/renrenback',
'callback' => SITE_MAIN . '/passport/autosign/renrenback',
'scope' => 'publish_feed,photo_upload',
);
\ No newline at end of file
... ...
... ... @@ -4,5 +4,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appId' => '3739328910',
'appKey' => '9d44cded26d048e23089e5e975c93df1',
'appCallbackUrl' => SITE_MAIN . '/passport/login/sinacallback',
'appCallbackUrl' => SITE_MAIN . '/passport/autosign/sinacallback',
);
\ No newline at end of file
... ...
... ... @@ -29,6 +29,7 @@ var $chosePanel = $('#chose-panel'),
cbFn,
$allChoseItems,
queryString,
$soonSoldOut = $('.soonSoldOut-tag'),
$yohoPage = $('.yoho-page');
//初始化购物车面板显示
... ... @@ -210,7 +211,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
//如果当前有尺码被选中,且数量等于0,则颜色块添加数量为0的样式
if (curGoodNum > 0) {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
} else {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
}
$leftNum.val(curGoodNum);
} else {
$allChoseItems.find('.num .left-num').html('');
... ... @@ -263,7 +269,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 如果当前有尺码被选中,且数量等于0, 否则显示剩余件数
if (curGoodNum > 0 && hasChooseColor) {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
if ($soonSoldOut.length > 0) {
$allChoseItems.find('.num .left-num').html('即将售罄');
} else {
$allChoseItems.find('.num .left-num').html('剩余' + curGoodNum + '件');
}
$('#left-num').val(curGoodNum);
} else {
$allChoseItems.find('.num .left-num').html('');
... ...
... ... @@ -15,8 +15,8 @@
{{# list}}
{{#unless @last}}
<li>
<a href="{{href}}">
<img class="lazy" data-original="{{img}}" alt="">
<a href="{{href}}" target= "_blank">
<img class="lazy" data-original="{{img}}" alt="" >
</a>
</li>
{{/unless}}
... ... @@ -26,7 +26,7 @@
{{# list}}
{{#if @last}}
<div class="last-item">
<a href="{{href}}">
<a href="{{href}}" target= "_blank">
<img class="lazy" data-original="{{img}}" alt="">
</a>
</div>
... ... @@ -43,7 +43,7 @@
<ul class="img-list clearfix">
{{# imgBrand}}
<li class="img-item">
<a href="{{href}}">
<a href="{{href}}" target= "_blank">
<img src="{{img}}" alt="">
</a>
</li>
... ... @@ -70,7 +70,7 @@
{{! 广告}}
{{# adbanner}}
<div class="floor-ad">
<a href="{{url}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
<a href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
</div>
{{/ adbanner}}
... ...
... ... @@ -4,11 +4,14 @@
{{# girls}}
{{! 头部banner}}
{{# slide}}
{{>index/slide-banner}}
{{/ slide}}
{{# debrisSlider}}
<div class="debris-slider clearfix">
<div class="left-col col">
{{# left}}
<a href="{{href}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}">
</a>
{{/ left}}
... ... @@ -17,7 +20,7 @@
<ul class="slide-wrapper">
{{# center}}
<li>
<a href="{{href}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}">
</a>
</li>
... ... @@ -34,7 +37,7 @@
</div>
<div class="right-col col">
{{# right}}
<a href="{{href}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{img}}">
</a>
{{/ right}}
... ...
... ... @@ -70,7 +70,7 @@
{{! 广告}}
{{# adbanner}}
<div class="floor-ad">
<a href="{{url}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
<a href="{{href}}" target= "_blank"><img class="lazy" data-original="{{img}}"/></a>
</div>
{{/ adbanner}}
... ...
{{> layout/header}}
<div class="home-page yoho-page kids" data-page="kids">
<div class="home-page yoho-page kids" data-page="kids">
{{# kids}}
{{! 头部banner}}
{{# slide}}
... ...
{{> layout/header}}
<div class="login-page passport-page yoho-page clearfix">
<div class="passport-page yoho-page clearfix">
{{# passport}}
{{> passport/cover}}
<div class="content">
<div class="register-page">
<form id="register-form" class="register-form" method="POST" action="{{actionUrl}}" autocomplete="off">
<ul>
<li class="clearfix">
<select id="region" class="region" name="region">
{{#each region}}
<option {{#if selected}}selected="selected"{{/if}} value="{{id}}">{{name}}</option>
{{/each}}
</select>
</li>
<li class="clearfix" data-index="0">
<span id="country-code" class="country-code">{{location}}</span>
<input value="" id="phone-num" class="input va phone-num" type="text" name="phoneNum" placeholder="请输入手机号码" autocomplete="off">
</li>
<li class="w330 clearfix" data-index="1">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="图形验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
<a class="link change-captcha">换一张</a>
</li>
<li class="clearfix" data-index="2">
<input id="msg-captcha" class="input va msg-captcha" type="text" name="msgCaptcha" placeholder="短信验证码" autocomplete="off" maxlength="4">
<input id="send-captcha" class="btn send-captcha disable" type="button" value="获取短信验证码">
<span id="msg-tip" class="hide msg-tip">短信验证码已发送至您的手机,请查收</span>
</li>
<li class="clearfix" data-index="3">
<input id="pwd" class="input va pwd" name="pwd" placeholder="设置密码" autocomplete="off" maxlength="20" type="password">
<div class="pwd-intensity-container">
<span class="pwd-intensity low">低</span>
<span class="pwd-intensity mid">中</span>
<span class="pwd-intensity high">高</span>
</div>
<div id="pwd-tips" class="hide pwd-tips">
<div class="default" id="pwd-tip1"><i></i>密码只支持6-20位字符</div>
<div class="default" id="pwd-tip2"><i></i>建议由字母、 数字、 符号两种以上组合</div>
</div>
</li>
<li class="items-container clearfix">
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
<input name="refer" id="refer" type="hidden" value="{{referUrl}}">
<input id="register-btn" class="btn register-btn disable" type="submit" value="立即注册" disabled="">
</li>
<li class="quick-login-container">
我已注册YOHO!有货账号
<a class="link go-login" href="{{loginUrl}}">快速登录</a>
</li>
</ul>
<div id="err-tip" class="err-tip hide">
<span></span>
<b></b>
</div>
</form>
</div>
{{> passport/register}}
</div>
{{/ passport}}
</div>
... ...
{{> layout/header}}
<div class="passport-page yoho-page clearfix">
{{# passport}}
{{> passport/cover}}
<div class="content">
{{> passport/register}}
</div>
{{/ passport}}
<div class="page-tip clearfix">为了给您更好的购物体验, 建议您创建YOHO!Family账号</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
<div class="slide-container">
<div class="slide-container {{#if pagination}}slide-thumb-container{{/if}}">
<div class="slide-wrapper">
<ul>
{{# list}}
<li>
<li style="background:{{bgColor}}">
<a href="{{href}}" target= "_blank">
<img class="lazy" data-original="{{img}}" alt="">
</a>
... ... @@ -30,11 +30,12 @@
<ul class="clearfix">
{{# pagination}}
<li>
<a href="{{href}}"></a>
<a href="{{href}}" target="_blank"></a>
<img src="{{img}}" alt="">
</li>
{{/ pagination}}
</ul>
</div>
{{/if}}
</div>
\ No newline at end of file
</div>
<div class="slide-container-placeholder {{#if pagination}}slide-thumb-container-placeholder{{/if}}"></div>
\ No newline at end of file
... ...
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
var _hmt = _hmt || [];
(function() {
function async_load(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "http://static.yohobuy.com/js/analytics/analysis.js";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
window.addEventListener('load', async_load, false);
})();
</script>
<script>
window._py = window._py||[];
window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
window._py.push(['domain','stats.ipinyou.com']);
window._py.push(['e','']);
if(typeof _goodsData!='undefined'){
window._py.push(['pi',_goodsData]);
}
-function(d){
var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
}(document);
</script>
<script src="http://static.yohobuy.com/js/v3/o_code.js?v=20150420" async="async"></script>
\ No newline at end of file
... ...
... ... @@ -20,5 +20,6 @@
</script>
{{/if}}
{{> layout/use}}
{{> layout/analysis}}
</body>
</html>
\ No newline at end of file
... ...
<div class="register-page">
<form id="register-form" class="register-form" method="POST" action="{{actionUrl}}" autocomplete="off">
<ul>
<li class="clearfix">
<select id="region" class="region" name="region">
{{#each region}}
<option {{#if selected}}selected="selected"{{/if}} value="{{id}}">{{name}}</option>
{{/each}}
</select>
</li>
<li class="clearfix" data-index="0">
<span id="country-code" class="country-code">{{location}}</span>
<input value="" id="phone-num" class="input va phone-num" type="text" name="phoneNum" placeholder="请输入手机号码" autocomplete="off">
</li>
<li class="w330 clearfix" data-index="1">
<input id="captcha" class="input va captcha" type="text" name="captcha" placeholder="图形验证码" autocomplete="off" maxlength="4">
<img id="captcha-img" class="captcha-img" src="{{captchaUrl}}" alt="">
<a class="link change-captcha">换一张</a>
</li>
<li class="clearfix" data-index="2">
<input id="msg-captcha" class="input va msg-captcha" type="text" name="msgCaptcha" placeholder="短信验证码" autocomplete="off" maxlength="4">
<input id="send-captcha" class="btn send-captcha disable" type="button" value="获取短信验证码">
<span id="msg-tip" class="hide msg-tip">短信验证码已发送至您的手机,请查收</span>
</li>
<li class="clearfix" data-index="3">
<input id="pwd" class="input va pwd" name="pwd" placeholder="设置密码" autocomplete="off" maxlength="20" type="password">
<div class="pwd-intensity-container">
<span class="pwd-intensity low">低</span>
<span class="pwd-intensity mid">中</span>
<span class="pwd-intensity high">高</span>
</div>
<div id="pwd-tips" class="hide pwd-tips">
<div class="default" id="pwd-tip1"><i></i>密码只支持6-20位字符</div>
<div class="default" id="pwd-tip2"><i></i>建议由字母、 数字、 符号两种以上组合</div>
</div>
</li>
<li class="items-container clearfix">
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
<input name="refer" id="refer" type="hidden" value="{{referUrl}}">
<input id="register-btn" class="btn register-btn disable" type="submit" value="{{regBtnText}}" disabled="">
</li>
{{# loginUrl}}
<li class="quick-login-container">
我已注册YOHO!有货账号
<a class="link go-login" href="{{.}}">完善信息</a>
</li>
{{/loginUrl}}
{{# skipUrl}}
<li class="skip-user-info">
<a href="{{.}}">跳过此步</a>
</li>
{{/skipUrl}}
</ul>
<div id="err-tip" class="err-tip hide">
<span></span>
<b></b>
</div>
</form>
</div>
\ No newline at end of file
... ...
... ... @@ -106,6 +106,34 @@ function getShoppingKey() {
return JSON.parse(c).k;
}
//YAS统计代码
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
(function() {
var uid = getUid();
uid = uid === 0 ? '' : uid;
window._ozuid = uid;//暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_web', uid, '', '');
}
}());
window.cookie = cookie;
window.setCookie = setCookie;
... ... @@ -2572,7 +2600,7 @@ var $ = require("jquery"),
//插入more的位置,more占的是下一页第一个brand的位置,所以page是i/17
out = out + '<li class="brand-more" data-page="' + Math.floor(i / (showNum + 1)) + '">' +
'<a href="javascript:;">MORE ></a></li>' +
'<a href="javascript:;" target="_blank">MORE ></a></li>' +
'<li data-page="' + Math.floor(i / showNum) + '">' + item + '</li>';
} else {
out = out + '<li data-page="' + Math.floor(i / showNum) + '">' + item + '</li>';
... ... @@ -2581,7 +2609,7 @@ var $ = require("jquery"),
//加上最后一个more, more占的是下一页第一个brand的位置,这里已经循环不到brand,所以加在末尾
return out + '<li class="brand-more" data-page="' + Math.floor(i / (showNum + 1)) + '">' +
'<a href="javascript:;">MORE ></a></li></ul>';
'<a href="javascript:;" target="_blank">MORE ></a></li></ul>';
});
},
... ... @@ -2598,7 +2626,7 @@ var $ = require("jquery"),
that._createHelper();
brandHtml = '\{{#brandList logoBrand}}' +
'<a href="\{{href}}"><img class="lazy" data-original="\{{img}}" alt=""></a>' +
'<a href="\{{href}}" target="_blank"><img class="lazy" data-original="\{{img}}" alt=""></a>' +
'\{{/brandList}}';
brandTpl = Handlebars.compile(brandHtml);
that.$element.html(brandTpl(data));
... ... @@ -3721,6 +3749,7 @@ module.exports = function(data) {
var $load = $('.loading a');
var load = new InfiniteLoad({
index: 1,
isload: false,
offset: {
height: function() {
return parseFloat($container.offset().top) + parseFloat($container.height()) - 200;
... ... @@ -3728,28 +3757,35 @@ module.exports = function(data) {
}
});
var loadAjax;
var url = data.url;
var url = data.url,
count = data.count,
rows = data.rows;
data.pageIndex = 0;
delete data.url;
delete data.count;
delete data.rows;
loadAjax = function(url, data, count) {
var options = {
type: 'POST',
url: url,
data: data,
success: function(data) {
var code = data.code;
success: function(result) {
var code = result.code;
var myTemplate,len,pos;
if (code === 200) {
len = data.goods.length % count;
pos = data.goods.length - len - 1;
len = result.goods.length % count;
pos = result.goods.length - len - 1;
data.goods.splice(pos, len);
result.goods.splice(pos, len);
myTemplate = Handlebars.compile(load.tpl);
$container.append(myTemplate(data.goods));
$container.append(myTemplate(result.goods));
data.pageIndex = data.pageIndex + result.goods.length;
//懒加载插件貌似有点问题,图片先直接展示
lazyload($container.find('img.lazy'));
... ... @@ -3768,17 +3804,14 @@ module.exports = function(data) {
}
};
options.data = data;
$.ajax(options);
};
load.on('after', function(p) {
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = data.count * data.rows[1];
data.pageCount = count * rows[1];
loadAjax(url, data);
});
... ... @@ -3814,7 +3847,7 @@ module.exports = function(data) {
load.tpl += ' {{/ tags}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-img">';
load.tpl += ' <a class="good-thumb" href="{{url}}">';
load.tpl += ' <a class="good-thumb" href="{{url}}" target= "_blank">';
load.tpl += ' <img class="lazy" data-original="{{thumb}}">';
load.tpl += ' </a>';
load.tpl += ' {{# isFew}}';
... ... @@ -3826,7 +3859,7 @@ module.exports = function(data) {
load.tpl += ' {{/if}}';
load.tpl += ' </div>';
load.tpl += ' <div class="good-detail-text">';
load.tpl += ' <a href="{{url}}">{{name}}</a>';
load.tpl += ' <a href="{{url}}" target= "_blank">{{name}}</a>';
load.tpl += ' <p class="price">';
load.tpl += ' <span class="sale-price{{#unless marketPrice}}prime-cost{{/unless}}">';
load.tpl += ' ¥{{salePrice}}';
... ... @@ -3839,16 +3872,12 @@ module.exports = function(data) {
load.tpl += '</div>';
load.tpl += '{{/each}}';
data = $.extend({}, data, {
pageIndex: p.index
});
data.pageCount = data.count * data.rows[0];
data.pageCount = count * rows[0];
loadAjax(url, data, data.count);
load.emit();
//load.emit();
});
load.init();
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -94,6 +94,34 @@ function getShoppingKey() {
return JSON.parse(c).k;
}
//YAS统计代码
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
(function() {
var uid = getUid();
uid = uid === 0 ? '' : uid;
window._ozuid = uid;//暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_web', uid, '', '');
}
}());
window.cookie = cookie;
window.setCookie = setCookie;
... ...
... ... @@ -55,7 +55,7 @@ var $ = require('yoho.jquery'),
//插入more的位置,more占的是下一页第一个brand的位置,所以page是i/17
out = out + '<li class="brand-more" data-page="' + Math.floor(i / (showNum + 1)) + '">' +
'<a href="javascript:;">MORE ></a></li>' +
'<a href="javascript:;" target="_blank">MORE ></a></li>' +
'<li data-page="' + Math.floor(i / showNum) + '">' + item + '</li>';
} else {
out = out + '<li data-page="' + Math.floor(i / showNum) + '">' + item + '</li>';
... ... @@ -64,7 +64,7 @@ var $ = require('yoho.jquery'),
//加上最后一个more, more占的是下一页第一个brand的位置,这里已经循环不到brand,所以加在末尾
return out + '<li class="brand-more" data-page="' + Math.floor(i / (showNum + 1)) + '">' +
'<a href="javascript:;">MORE ></a></li></ul>';
'<a href="javascript:;" target="_blank">MORE ></a></li></ul>';
});
},
... ... @@ -81,7 +81,7 @@ var $ = require('yoho.jquery'),
that._createHelper();
brandHtml = '\{{#brandList logoBrand}}' +
'<a href="\{{href}}"><img class="lazy" data-original="\{{img}}" alt=""></a>' +
'<a href="\{{href}}" target="_blank"><img class="lazy" data-original="\{{img}}" alt=""></a>' +
'\{{/brandList}}';
brandTpl = Handlebars.compile(brandHtml);
that.$element.html(brandTpl(data));
... ...
... ... @@ -21,6 +21,10 @@ var $ = require('yoho.jquery'),
Slider.prototype = {
init: function() {
if (!this.$element) {
return;
}
if (this.len <= 1) {
lazyLoad(this.$element.find('img.lazy'));
return;
... ... @@ -126,7 +130,13 @@ var $ = require('yoho.jquery'),
this.smallItem.eq(this.index).addClass('focus').siblings().removeClass('focus');
this.bigItem.eq(this.index).fadeIn().siblings().fadeOut();
this.bigItem.eq(this.index).show().stop().animate({
opacity: 1
}).siblings().stop().animate({
opacity: 0
}, function() {
$(this).hide();
});
},
_autoplay: function() {
var that = this;
... ...
... ... @@ -41,9 +41,8 @@ if (homePage === 'boys') {
$('.slide-container').slider({
pagination: '.thumb-pagination'
});
} else if (homePage === 'girls') {
$('.center-col').slider();
} else {
$('.center-col').slider();
$('.slide-container').slider();
}
... ...
... ... @@ -6,11 +6,28 @@
// overflow: hidden;
/*大banner*/
.slide-container {
position: relative;
position: absolute;
left: 0;
right: 0;
height: 387px;
&.slide-thumb-container {
height: 440px;
}
img {
display: block;
}
}
.slide-container-placeholder {
height: 387px;
width: 100%;
&.slide-thumb-container-placeholder {
height: 440px;
}
}
/*大banner大图*/
.slide-wrapper {
... ... @@ -37,6 +54,13 @@
width: 100%;
height: 100%;
a {
display: block;
height: 100%;
width: 990px;
margin: 0 auto;
}
&:first-child {
display: block;
}
... ... @@ -50,7 +74,7 @@
/*大图上的左右切换按钮*/
.slide-switch {
display: none;
display: block;
/* @include opacity(0);
@include transition-property(opacity);
@include transition-duration(.2s);
... ... @@ -68,11 +92,13 @@
@include opacity(0.55);
&.prev {
left: 0;
left: 50%;
margin-left: -495px;
}
&.next {
right: 0;
right: 50%;
margin-right: -495px;
}
&:hover{
... ... @@ -88,7 +114,8 @@
/*大banner缩略图*/
.thumb-pagination {
margin: 7px 0 0;
width: 990px;
margin: 7px auto 0;
li {
position: relative;
... ... @@ -223,6 +250,17 @@
height: 100%;
}
.slide-switch {
a.prev {
left: 0;
margin-left: 0;
}
a.next {
right: 0;
margin-right: 0;
}
}
img {
max-width: 100%;
max-height: 100%;
... ...
... ... @@ -2,13 +2,51 @@
@media screen and (min-width: 1150px) {
.home-page {
width: 1150px;
.slide-container{
height: 450px;
&.slide-thumb-container {
height: 510px;
}
}
.slide-wrapper {
height: 450px;
li {
a {
width: 1150px;
}
}
}
.slide-container-placeholder {
height: 450px;
&.slide-thumb-container-placeholder {
height: 510px;
}
}
.slide-switch {
a {
&.prev {
margin-left: -575px;
}
&.next {
margin-right: -575px;
}
}
}
.thumb-pagination {
margin: 6px 0 0;
width: 1148px;
margin: 6px auto 0;
padding: 0 0 0 2px;
li {
... ...
... ... @@ -172,6 +172,20 @@ $tip: sprite-map("passport/tip/*.png", $spacing: 10px);
margin-right: 5px;
}
}
/*完善信息提示框*/
.page-tip {
display: block;
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
font-size: 20px;
font-weight: bold;
color: #ccc;
clear: both;
margin-bottom: 15px;
}
}
.passport-cover {
... ...
... ... @@ -200,6 +200,15 @@
text-align: right;
white-space: nowrap;
}
&.skip-user-info {
font-size: 18px;
text-align: center;
a {
color: #ff1901;
text-decoration: underline;
}
}
}
.err-tip {
... ...
... ... @@ -55,9 +55,6 @@ class SearchModel
'productListPage' => true,
'list' => $list
);
}else{
//接口异常,调用二级缓存
$data = array();
}
return $data;
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Web\Passport\RegData;
use LibModels\Web\Passport\LoginData;
use LibModels\Web\Home\IndexData;
use Passport\PassportModel as PassportModel;
use Plugin\Helpers;
use Plugin\Images;
use Plugin\Partner\Factory;
class AutosignController extends AbstractAction
{
/**
* 支付宝登录:授权页面
*/
public function alipayAction()
{
$this->setSession('_TOKEN', '');
Factory::create('alipay')->getAuthorizeUrl();
exit();
}
/**
* QQ账号登录:授权页面
*/
public function qqAction()
{
$this->setSession('_TOKEN', '');
Factory::create('qqconnect')->getAuthorizeUrl();
exit();
}
/**
* 新浪微博账号登录:授权页面
*/
public function sinaAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('sinaweibo')->getAuthorizeUrl());
}
/**
* 新浪微博账号登录:授权页面
*/
public function renrenAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('renren')->getAuthorizeUrl());
}
/**
* 豆瓣账号登录:授权页面
*/
public function doubanAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('douban')->getAuthorizeUrl());
}
/**
* 支付宝账号登录:回调方法
*/
public function alipaycallbackAction()
{
$realName = $this->_request->get('real_name');
$email = $this->_request->get('email');
$userId = $this->_request->get('user_id');
$result = array();
if (isset($realName, $email, $userId)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$this->go(Helpers::url('/passport/bind/index', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName)));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* QQ账号登录:回调方法
*/
public function qqcallbackAction()
{
$qqconnect = Factory::create('qqconnect');
$access = $qqconnect->getAccessToken();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
$result = array();
if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$this->go(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* 新浪微博账号登录:回调方法
*/
public function sinacallbackAction()
{
$sina = Factory::create('sinaweibo');
$access = $sina->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* renren账号登录:回调方法
*/
public function renrenbackAction()
{
$renren = Factory::create('renren');
$access = $renren->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $renren->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'renren', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['nick_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* douban账号登录:回调方法
*/
public function doubanbackAction()
{
$sina = Factory::create('douban');
$access = $sina->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'douban', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Web\Passport\RegData;
use LibModels\Web\Passport\LoginData;
use LibModels\Web\Home\IndexData;
use Passport\PassportModel as PassportModel;
use Plugin\Helpers;
use Plugin\Images;
use Plugin\Partner\Factory;
class AutouserinfoController extends AbstractAction
{
/**
* 第三方登录完善个人信息:
* 绑定手机号
*/
public function indexAction()
{
$this->setTitle('联合登录补全信息');
$nickname = $this->get('nickname');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
//登录后跳转页面
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
//获取用户
$uid = $this->getUid(true);
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
//整合
$data = array(
'loginPage' => true,
'simpleHeader' => $simpleHeader,
'passport' => array(
'coverHref' => '',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
),
);
$this->_view->display('index', $data);
}
/**
* 完善信息页面
*/
public function userInfoAction()
{
//获取用户
$uid = $this->getUid(true);
$nickname = $this->get('nickname');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
//整合
$data = array(
'simpleHeader' => $simpleHeader,
'passport' => array(
'coverHref' => '',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'goShoppingUrl' => SITE_MAIN,
'completeInfoUrl' => Helpers::url('/passport/autouserinfo/index', array('openId' => $openId, 'sourceType' => $sourceType, 'nickname' => $nickname)),
),
);
$this->_view->display('userinfo', $data);
}
/*
* 发送绑定验证吗
*/
/*
* 验证图形验证码
*/
/*
* 验证短信验证码
*/
/*
* 绑定手机号
*/
}
... ...
... ... @@ -26,7 +26,7 @@ class LoginController extends AbstractAction
$this->setCookie('_TOKEN', '');
//登录后跳转页面
$refer = $this->get('refer');
$refer = empty($_SERVER["HTTP_REFERER"])?'':$_SERVER["HTTP_REFERER"];
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
... ... @@ -55,17 +55,17 @@ class LoginController extends AbstractAction
'simpleHeader' => $simpleHeader,
'passport' => array(
'coverHref' => $coverHref,
'coverImg' => $coverImg,
'coverImg' => !empty($coverImg)?$coverImg:'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'countryCode' => '+86',
'countryName' => '中国',
'countryList' => RegData::getAreasData(),
'forgetPwd' => Helpers::url('/passport/back/index'),
'fastReg' => Helpers::url('/reg.html'),
'qqLogin' => Helpers::url('/passport/login/qq'),
'weiboLogin' => Helpers::url('/passport/login/sina'),
'alipayLogin' => Helpers::url('/passport/login/alipay'),
'doubanLogin' => Helpers::url('/passport/login/douban'),
'renrenLogin' => Helpers::url('/passport/login/renren'),
'qqLogin' => Helpers::url('/passport/autosign/qq'),
'weiboLogin' => Helpers::url('/passport/autosign/sina'),
'alipayLogin' => Helpers::url('/passport/autosign/alipay'),
'doubanLogin' => Helpers::url('/passport/autosign/douban'),
'renrenLogin' => Helpers::url('/passport/autosign/renren'),
),
);
... ... @@ -160,262 +160,4 @@ class LoginController extends AbstractAction
$this->go($refer);
}
//第三方登录
/**
* 支付宝登录:授权页面
*/
public function alipayAction()
{
$this->setSession('_TOKEN', '');
Factory::create('alipay')->getAuthorizeUrl();
exit();
}
/**
* QQ账号登录:授权页面
*/
public function qqAction()
{
$this->setSession('_TOKEN', '');
Factory::create('qqconnect')->getAuthorizeUrl();
exit();
}
/**
* 新浪微博账号登录:授权页面
*/
public function sinaAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('sinaweibo')->getAuthorizeUrl());
}
/**
* 新浪微博账号登录:授权页面
*/
public function renrenAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('renren')->getAuthorizeUrl());
}
/**
* 豆瓣账号登录:授权页面
*/
public function doubanAction()
{
$this->setSession('_TOKEN', '');
$this->go(Factory::create('douban')->getAuthorizeUrl());
}
/**
* 支付宝账号登录:回调方法
*/
public function alipaycallbackAction()
{
$realName = $this->_request->get('real_name');
$email = $this->_request->get('email');
$userId = $this->_request->get('user_id');
$result = array();
if (isset($realName, $email, $userId)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($realName, $userId, 'alipay', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$this->go(Helpers::url('/passport/bind/index', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName)));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* QQ账号登录:回调方法
*/
public function qqcallbackAction()
{
$qqconnect = Factory::create('qqconnect');
$access = $qqconnect->getAccessToken();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
$result = array();
if (!empty($partnerInfo) && isset($partnerInfo['nickname'])) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* 新浪微博账号登录:回调方法
*/
public function sinacallbackAction()
{
$sina = Factory::create('sinaweibo');
$access = $sina->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* renren账号登录:回调方法
*/
public function renrenbackAction()
{
$renren = Factory::create('renren');
$access = $renren->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $renren->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'renren', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['nick_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
/**
* douban账号登录:回调方法
*/
public function doubanbackAction()
{
$sina = Factory::create('douban');
$access = $sina->getAccessToken();
/* 获取用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['uid'], 'douban', $shoppingKey);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
// $this->go(Helpers::url('/passport/bind/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
else {
$refer = rawurldecode($refer);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->go(Helpers::syncUserSession($result['data']['uid'], $refer));
}
else {
$this->go($refer);
}
}
}
... ...
<?php
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use Passport\RegModel;
use Plugin\Helpers;
use Plugin\Cache;
use Passport\PassportModel;
... ... @@ -14,6 +13,7 @@ class RegisterController extends WebAction
{
$refer = $this->get('refer', SITE_MAIN);
$cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
$this->setSession('effective_time', time() + 1800);
$data = array(
'registerPage' => true,
'passport' => array(
... ... @@ -25,14 +25,46 @@ class RegisterController extends WebAction
'referUrl' => $refer,
'loginUrl' => '/signin.html?refer='.$refer,
'coverHref' => $cover['url'],
'coverImg' => $cover['img']
'coverImg' => $cover['img'],
'regBtnText' => '快速登录'
)
);
$this->setCookie('refer', $refer);
$this->_view->display('index', $data);
}
/**
* 第三方登录
*/
public function thirdAction()
{
$refer = $this->get('refer', SITE_MAIN);
$cover = PassportModel::getLeftBanner(PassportModel::REGISTER_LEFT_BANNER_CODE);
$this->setSession('effective_time', time() + 1800);
$data = array(
'registerPage' => true,
'passport' => array(
'actionUrl' => '/passport/register/mobileregister',
'region' => RegData::getAreasData(),
'location' => '+86',
'captchaUrl' => 'http://web.dev.yohobuy.com/passport/images?t=1449799445',
'itemUrl' => '##',
'referUrl' => $refer,
'skipUrl' => '/signin.html?refer='.$refer,
'coverHref' => $cover['url'],
'coverImg' => $cover['img'],
'regBtnText' => '完善信息'
)
);
$this->setCookie('refer', $refer);
$this->_view->display('third-register', $data);
}
/**
* 检测手机号
*
* @return json
*/
public function checkmobileAction()
{
... ... @@ -41,7 +73,7 @@ class RegisterController extends WebAction
$ip = Helpers::getClientIp();
$data = array('code' => 400, 'message' => '', 'data' => '');
$ip_key = md5('ip_checkmobile_' . $ip);
$ip_times = Cache::increment($ip_key);
$ip_times = Cache::increment($ip_key, 1, 0, 3600);
do{
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
... ... @@ -56,9 +88,10 @@ class RegisterController extends WebAction
$data['message'] = '由于你IP受限无法注册';
break;
}
if(!empty(PassportModel::getUserInfoByMobile($area, $mobile))) {
$data['message'] = '手机号码已经存在';
break;
$user = PassportModel::getUserInfoByMobile($area, $mobile);
if(!empty($user)) {
$data['message'] = '手机号码已经存在';
break;
}
$data['code'] = 200;
} while(false);
... ... @@ -93,7 +126,13 @@ class RegisterController extends WebAction
$data['message'] = '验证码不正确';
break;
}
//发送代码
$send_code_key = md5('send_code_' .$area.'_'.$mobile);
$send_code_times = Cache::increment($send_code_key, 1, 0, 3600);
if($send_code_times > 50) {
$data['message'] = '发送验证码太多';
break;
}
/* 向手机发送注册验证码 */
$data = RegData::sendCodeToMobile($area, $mobile);
if (!isset($data['code'])) {
... ... @@ -149,6 +188,12 @@ class RegisterController extends WebAction
$data['message'] = '验证码错误';
break;
}
$effective_time = $this->getSession('effective_time');
if($effective_time < time() || empty($effective_time))
{
$data['message'] = '注册超时';
break;
}
/*手机注册*/
$data = RegData::regMobile($area, $mobile, $password);
if (!isset($data['code']) || $data['code'] != 200) {
... ... @@ -161,17 +206,15 @@ class RegisterController extends WebAction
} else {
$refer = rawurldecode($refer);
}
// $data['data']['href'] = $refer;
// $data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$data['code'] = 200;
$data['data']['href'] = $refer;
$data['data']['session'] = Helpers::syncUserSession($data['data']['uid']);
$token = Helpers::makeToken($data['data']['uid']);
$this->setCookie('_TOKEN', $token);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $data['data']['uid']);
//$this->setSession('session_key', $data['data']['session_key']);
}while(false);
$this->go($refer);
echo $this->echoJson($data);
}
}
\ No newline at end of file
... ...
... ... @@ -39,8 +39,10 @@ class ListController extends WebAction
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//字符转码
foreach($condition as $key => $val){
$condition[$key] = rawurldecode($val);
if (!empty($condition)) {
foreach ($condition as $key => $val) {
$condition[$key] = rawurldecode($val);
}
}
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
... ... @@ -48,11 +50,11 @@ class ListController extends WebAction
$condition['gender'] = $gender;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =59;
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 59;
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
... ... @@ -66,8 +68,6 @@ class ListController extends WebAction
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
... ... @@ -83,14 +83,13 @@ class ListController extends WebAction
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum']-1,
'viewNum' =>$condition['viewNum'],
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$data = SearchModel::getSearchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
... ...