Authored by Rock Zhang

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

Showing 31 changed files with 835 additions and 275 deletions
... ... @@ -34,7 +34,7 @@ class BrandData
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['uid'] = '10267443';
$param['uid'] = $uid;
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
... ...
<?php
namespace LibModels\Web\Product;
use Api\Yohobuy;
/**
* sale操作类
* @name SaleData
* @package
* @copyright yoho.inc
* @version 1.0 (2016-01-07)
* @author
*/
class SaleData
{
const URL_SALE_SPECIAL = '/operating/service/v1/special';
/**
* 获取专区信息
* @param $specialId 专区ID
*/
public static function getSpecial($specialsaleId) {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_SALE_SPECIAL, 'getOneSpecial', array($specialsaleId));
}
}
... ...
... ... @@ -2,6 +2,7 @@
namespace Plugin;
use Plugin\Paging;
use LibModels\Web\Product\BrandData;
/**
* 搜索辅助类
*/
... ... @@ -12,6 +13,8 @@ class HelperSearch
*/
public static $params = array();
private static $from = '';
//当前页
public static $page = 1;
... ... @@ -27,6 +30,12 @@ class HelperSearch
public static $listnav = array();
private static function setFrom($from = '')
{
if ($from) {
self::$from = $from;
}
}
//设置导航
private static function setListNav($option = array())
{
... ... @@ -77,6 +86,7 @@ class HelperSearch
$result['filters']['brand'] = self::brand($filter, $options);
//价格
$result['filters']['price'] = self::price($filter);
$result['filters']['customPrice'] = self::customPrice($filter);
//颜色
$result['filters']['color'] = self::color($filter);
//尺寸
... ... @@ -152,7 +162,9 @@ class HelperSearch
'salePrice' => $val['sales_price'],
'marketPrice' => $val['market_price'],
'isFew' => $isFew,
'skn' => $val['product_skn']
'skn' => $val['product_skn'],
'showColBtn' => true,
'coled' => true
);
}
return $goods;
... ... @@ -452,6 +464,15 @@ class HelperSearch
'name' => $filter['price'][$priceId],
'href' => self::buildUrl($params)
);
}else{
$price = explode(',', $priceId);
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) {
... ... @@ -467,6 +488,27 @@ class HelperSearch
}
/**
* 获取自定义价格要提交的地址
*/
public static function customPrice($filter) {
$params = self::$params;
$result = array(
'min' => '',
'max' => ''
);
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price']) && !isset($filter['price'][$priceId]) ) {
$price = explode(',', $params['price']);
unset($params['price']);
$result = array(
'min' => $price[0],
'max' => $price[1]
);
}
return $result;
}
/**
* 风格,可以多选
* @param array $filter
* @return array
... ... @@ -905,4 +947,25 @@ class HelperSearch
$Paging = new Paging('Yoho');
return $Paging->setTotal($total)->setSize($viewNum)->view(0);
}
//组织静态资源数据格式
public static function formatNodeContent($code){
$nodeContent = BrandData::getByNodeContent($code);
if (isset($nodeContent['code']) && $nodeContent['code'] === 200) {
$result = array();
$string = $nodeContent['data'];
$hrefPatten="/<a href=[\'\"]?([^\'\" ]+).*?>/";
preg_match_all($hrefPatten, $string, $href);
$pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";
preg_match_all($pattern,$string,$img);
foreach($href[1] as $key=>$vo){
$result[$key]['href'] = $vo;
$result[$key]['src'] = $img[1][$key];
}
return $result;
}
}
}
... ...
{
"name": "yohobuy",
"version": "1.3.3",
"version": "1.3.4",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -4,11 +4,7 @@
<div class="infos">
<div class="basic-info" >
{{#thumbs}}
{{#if @first}}
<img class="thumb" src={{img}}>
{{else}}
<img class="thumb hide" src={{img}}>
{{/if}}
<img class="thumb {{#unless @first}}hide{{/if}}" src={{img}}>
{{/thumbs}}
<div class="text-info">
<p class="name">{{name}}</p>
... ... @@ -34,7 +30,7 @@
<div class="size-list block-list">
<span>尺码</span>
{{# sizes}}
<ul class="size-row clearfix hide">
<ul class="size-row clearfix {{#unless @first}}hide{{/if}}">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-id="{{id}}" data-colorid="{{colorId}}" data-num="{{sizeNum}}" data-numstr="{{colorNumStr}}" data-skuid="{{skuId}}" data-goodid="{{goodsId}}">
{{name}}
... ... @@ -43,13 +39,13 @@
</ul>
{{/ sizes}}
{{#if defaultSizes}}
<!--{{#if defaultSizes}}
<ul class="size-row clearfix default-size">
{{#each defaultSizes}}
<li class="block {{#if numZero}}zero-stock{{/if}}" data-numstr="{{numStr}}">{{name}}</li>
{{/each}}
</ul>
{{/if}}
{{/if}}-->
</div>
<p>
<div class="num">
... ...
... ... @@ -8,8 +8,8 @@
<li class="head-title">验证身份</li>
<li class="po-re">
<label class="pn-label">手机号码</label>
<span class="country-code">+86</span>
<span class="phone-num">18115624066</span>
<span class="country-code">+{{area}}</span>
<span class="phone-num">{{phoneNum}}</span>
</li>
<li class="po-re">
<input id="captcha" class="input va captcha" type="text" name="captcha">
... ... @@ -21,8 +21,8 @@
</span>
</li>
<li>
<input name="area" id="area" type="hidden" value="86">
<input name="mobile" id="mobile" type="hidden" value="18115624066">
<input name="area" id="area" type="hidden" value="{{area}}">
<input name="mobile" id="mobile" type="hidden" value="{{phoneNum}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="g7ce">
<input name="refer" id="refer" type="hidden" value="">
<input id="next-step" class="btn next-step disable" type="submit" value="下一步" disabled="">
... ...
... ... @@ -34,31 +34,7 @@
{{> product/left-content}}
</div>
<div class="list-right pull-right">
{{# shopEntry}}
<div class="shop-entry clearfix">
<a class="pull-left" href="{{home}}">
<img class="logo" src="{{logo}}">
</a>
<div class="name pull-left">
<a class="shop-name" href="{{home}}">{{shopName}}</a>
<p class="sorts">
{{#each sort}}
<a href="{{href}}">{{name}}</a>
{{#unless @last}}
/
{{/unless}}
{{/each}}
</p>
</div>
<a class="entry-btn pull-right" href="{{home}}">
进入品牌店铺
<span class="iconfont">&#xe601;</span>
</a>
</div>
{{/ shopEntry}}
{{> product/shop-entry}}
{{> product/standard-content}}
... ... @@ -68,4 +44,4 @@
</div>
{{/ list}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
... ... @@ -3,9 +3,11 @@
{{# search}}
{{> layout/path-nav}}
{{> product/shop-entry}}
{{> product/standard-content}}
{{> product/latest-walk}}
{{/ search}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="new-sale-page product-page yoho-page">
{{# newSale}}
{{# saleBanner}}
<div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div>
{{/ saleBanner}}
<div class="center-content clearfix">
{{> layout/path-nav}}
{{# saleTitle}}
<div class="header-title">
{{name}}
<p class="line-through"></p>
<p class="count-wrap">
<span class="count">共{{count}}个结果</span>
</p>
</div>
{{/ saleTitle}}
<div class="list-left pull-left">
{{> product/left-content}}
</div>
<div class="list-right pull-right">
{{# newMain}}
<div class="new-banner">
<a href="{{bannerHref}}">
<img src="{{banner}}">
</a>
</div>
<div class="new-brands clearfix">
<span class="iconfont pre">&#xe607;</span>
<div class="brands-wrap">
<ul class="brands">
{{# brands}}
<li>
<a href="{{href}}">
<img src="{{logo}}">
</a>
</li>
{{/ brands}}
</ul>
</div>
<span class="iconfont next">&#xe608;</span>
</div>
<div class="new-floor-title">
<span class="date">{{date}}</span>
<span class="title">{{title}}</span>
</div>
{{/ newMain}}
{{> product/standard-content}}
</div>
</div>
{{/ newSale}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="product-search-page product-page yoho-page center-content">
{{# search}}
{{> layout/path-nav}}
{{> product/standard-content}}
{{> product/latest-walk}}
{{/ search}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -78,10 +78,21 @@
{{!-- 注册页--}}
{{#if registerPage}}
<script>
seajs.use('js/passport/reg');
seajs.use('js/passport/reg', function (reg) {
reg.init('reg');
});
</script>
{{/if}}
{{!-- 第三方登录完善信息页--}}
{{#if thirdPage}}
<script>
seajs.use('js/passport/reg', function (reg) {
reg.init('third');
});
</script>
{{/if}}
{{!-- 找回密码--}}
{{#if backPage}}
<script>
... ...
{{# shopEntry}}
<div class="shop-entry clearfix">
<a class="pull-left" href="{{home}}">
<img class="logo" src="{{logo}}">
</a>
<div class="name pull-left">
<a class="shop-name" href="{{home}}">{{shopName}}</a>
<p class="sorts">
{{#each sort}}
<a href="{{href}}">{{name}}</a>
{{#unless @last}}
/
{{/unless}}
{{/each}}
</p>
</div>
<a class="entry-btn pull-right" href="{{home}}">
进入品牌店铺
<span class="iconfont">&#xe601;</span>
</a>
</div>
{{/ shopEntry}}
... ...
... ... @@ -83,14 +83,30 @@ validateResult = [
];
//手机号ajax校验
function phoneAjaxFn(callback) {
$.ajax({
url: '/passport/register/checkmobile',
type: 'POST',
data: {
function phoneAjaxFn(page, callback) {
var url,
data;
if (page === 'reg') {
url = '/passport/register/checkmobile';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1]
}
};
} else if (page === 'third') {
url = '/passport/autouserinfo/bindCheck';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1],
openId: 1,
sourceType: 'QQ'
};
}
$.ajax({
url: url,
type: 'POST',
data: data
}).then(function(data) {
switch (data.code) {
case 200:
... ... @@ -108,10 +124,17 @@ function phoneAjaxFn(callback) {
}
//图形验证码ajax校验
function picCaptchaAjaxFn(callback) {
function picCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/piccaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkPicCode';
}
$.ajax({
type: 'POST',
url: '/passport/register/piccaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -123,7 +146,7 @@ function picCaptchaAjaxFn(callback) {
validateResult[1].message = '';
validateResult[1].status = true;
break;
case 404:
case 400:
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
break;
... ... @@ -133,10 +156,17 @@ function picCaptchaAjaxFn(callback) {
}
//短信验证码ajax校验
function msgCaptchaAjaxFn(callback) {
function msgCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/msgcaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkBindMsg';
}
$.ajax({
type: 'POST',
url: '/passport/register/msgcaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -148,7 +178,7 @@ function msgCaptchaAjaxFn(callback) {
validateResult[2].message = '';
validateResult[2].status = true;
break;
case 404:
case 400:
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
break;
... ... @@ -159,7 +189,7 @@ function msgCaptchaAjaxFn(callback) {
}
// 验证
function validateRule($element, callback) {
function validateRule(page, $element, callback) {
var val = $.trim($element.val()),
regionCode;
... ... @@ -181,7 +211,7 @@ function validateRule($element, callback) {
callback();
} else {
phoneAjaxFn(callback);
phoneAjaxFn(page, callback);
}
//图形验证码校验
... ... @@ -200,7 +230,7 @@ function validateRule($element, callback) {
// 并且手机号正确
if (validateResult[0].status) {
picCaptchaAjaxFn(callback);
picCaptchaAjaxFn(page, callback);
} else {
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
... ... @@ -226,7 +256,7 @@ function validateRule($element, callback) {
// 并且图形验证码正确
if (validateResult[1].status) {
msgCaptchaAjaxFn(callback);
msgCaptchaAjaxFn(page, callback);
} else {
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
... ... @@ -379,140 +409,169 @@ function pwdFn($obj) {
// 失去焦点时开始校验
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
$registerPage.find('.va').keyup(function() {
// ( ▼-▼ )注册页和信息完善页面接口不同
exports.init = function(page) {
$registerPage.find('.va').keyup(function() {
var j,
statusLen = 0,
vLen = validateResult.length,
$that = $(this);
var j,
statusLen = 0,
vLen = validateResult.length,
$that = $(this);
validateRule($(this), function() {
showErrTip(); // 显示错误提示
showBorder(); // 显示红色边框
validateRule(page, $(this), function() {
showErrTip(); // 显示错误提示
showBorder(); // 显示红色边框
// 如果validateResult中有4个status为true表示验证通过
for (j = 0; j < vLen; j++) {
// 如果validateResult中有4个status为true表示验证通过
for (j = 0; j < vLen; j++) {
if (validateResult[j].status) {
if (validateResult[j].status) {
statusLen++;
}
}
statusLen++;
}
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
}
}
// 图形验证通过时,发送短信按钮可点击
if (validateResult[1].status) {
$sendCaptcha.removeClass('disable');
} else {
$sendCaptcha.addClass('disable');
}
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
}
//图形验证通过时,发送短信按钮可点击 end
// 图形验证通过时,发送短信按钮可点击
if (validateResult[1].status) {
$sendCaptcha.removeClass('disable');
} else {
$sendCaptcha.addClass('disable');
}
});
//图形验证通过时,发送短信按钮可点击 end
// 如果是密码则校验强度
if (($that).hasClass('pwd')) {
pwdFn($that);
}
}).blur(function() {
});
/*validateRule($(this), function() {
showErrTip();
showBorder(); // 显示红色边框
});*/
});
// 如果是密码则校验强度
if (($that).hasClass('pwd')) {
pwdFn($that);
}
$regionSelect.change(function() {
}).blur(function() {
$region.text('+' + $('#region').val());
/*validateRule($(this), function() {
showErrTip();
showBorder(); // 显示红色边框
});*/
});
validateRule($pn, showErrTip); //验证
});
$regionSelect.change(function() {
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 10,
t;
$region.text('+' + $('#region').val());
if ($(this).hasClass('disable')) {
return;
}
validateRule(page, $pn, showErrTip); //验证
});
//todo ajax
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 20,
t,
url;
t = setInterval(function() {
if (timeResidue <= 0) {
$sendCaptcha.removeClass('disable').val('获取短信验证码');
clearInterval(t);
if ($(this).hasClass('disable')) {
return;
}
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
}, 1000);
});
//form表单提交
$registerBtn.click(function() {
if ($(this).hasClass('disable')) {
return;
} else {
if (page === 'reg') {
url = '/passport/register/sendBindMsg';
} else if (page === 'third') {
url = '/passport/autouserinfo/sendBindMsg';
}
//ajax提交
//todo ajax 发送验证码
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
url: url,
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
captcha: $ca.val(),
code: $mc.val(),
password: $pwd.val()
code: $ca.val()
}
}).then(function(data) {
if (data.code === 200) {
t = setInterval(function() {
if (timeResidue <= 0) {
$sendCaptcha.removeClass('disable').val('获取短信验证码');
clearInterval(t);
return;
}
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
}, 1000);
}
});
});
var time = 0,
t,
refer = data.href;
//ajax表单提交
$registerBtn.click(function() {
t = setTimeout(function() {
time++;
}, 1000);
var url;
if (page === 'reg') {
url = '/passport/register/mobileregister';
} else if (page === 'third') {
url = '/passport/autouserinfo/bindMobile';
}
if ($(this).hasClass('disable')) {
return;
} else {
//ajax提交
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
url: url,
data: {
session: data.session
area: $region.text().split('+')[1],
mobile: $pn.val(),
captcha: $ca.val(),
code: $mc.val(),
password: $pwd.val()
}
}).then(function(data) {
if (data.code === 200 && t < 3) {
var time = 0,
t,
refer = data.href;
t = setTimeout(function() {
time++;
}, 1000);
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
data: {
session: data.session
}
}).then(function(data) {
if (data.code === 200 && t < 3) {
clearInterval(t);
location.href = refer;
}
});
if (t >= 3) {
clearInterval(t);
location.href = refer;
}
});
if (t >= 3) {
clearInterval(t);
location.href = refer;
}
});
}
});
});
}
});
$('.change-captcha').click(function() {
var time = new Date(),
$captchaImg = $('.captcha-img'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$('.change-captcha').click(function() {
var time = new Date(),
$captchaImg = $('.captcha-img'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
});
\ No newline at end of file
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
});
};
\ No newline at end of file
... ...
... ... @@ -149,66 +149,5 @@
}
}
.shop-entry {
position: relative;
background: #f5f7f6;
border: 1px solid #eaeceb;
padding: 12px 15px;
margin-bottom: 10px;
.logo {
width: 80px;
height: 50px;
}
.name {
margin-left: 10px;
}
.shop-name {
font-size: 16px;
color: #222;
line-height: 26px;
}
.sorts {
color: #999;
font-size: 12px;
line-height: 18px;
a {
color: #999;
}
}
.entry-btn {
position: absolute;
right: 15px;
top: 50%;
width: 110px;
height: 32px;
line-height: 32px;
margin-top: -16px;
background: #222;
text-align: center;
color: #fff;
font-size: 12px;
.iconfont {
font-size: 12px;
}
}
}
.goods-container {
height: auto;
padding: 25px 0 0 0;
position: relative;
width: 970px + 10px;//每列增加右边距
.good-info {
width: 235px;
}
}
}
\ No newline at end of file
@import "shop-entry";
}
... ...
... ... @@ -13,6 +13,8 @@
position: relative;
width: 1150px + 10px;//每列增加右边距
}
@import "shop-entry";
}
... ... @@ -40,4 +42,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
.shop-entry {
position: relative;
background: #f5f7f6;
border: 1px solid #eaeceb;
padding: 12px 15px;
margin-bottom: 10px;
.logo {
width: 80px;
height: 50px;
}
.name {
margin-left: 10px;
}
.shop-name {
font-size: 16px;
color: #222;
line-height: 26px;
}
.sorts {
color: #999;
font-size: 12px;
line-height: 18px;
a {
color: #999;
}
}
.entry-btn {
position: absolute;
right: 15px;
top: 50%;
width: 110px;
height: 32px;
line-height: 32px;
margin-top: -16px;
background: #222;
text-align: center;
color: #fff;
font-size: 12px;
.iconfont {
font-size: 12px;
}
}
}
.goods-container {
height: auto;
padding: 25px 0 0 0;
position: relative;
width: 970px + 10px;//每列增加右边距
.good-info {
width: 235px;
}
}
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.3.3"
application.version = "1.3.4"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.3.3"
application.version = "1.3.4"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.3.3"
application.version = "1.3.4"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.3.3"
application.version = "1.3.4"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货 | 潮流购物逛不停"
... ...
... ... @@ -73,7 +73,7 @@ class Bootstrap extends Bootstrap_Abstract
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
... ...
... ... @@ -28,8 +28,7 @@ class BrandsModel {
* @param $options array
* @return array
*/
public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId) {
public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId,$node) {
// 调用商品搜索接口
$data = SearchData::searchElasticByCondition($condition);
... ... @@ -68,9 +67,16 @@ class BrandsModel {
//获取品牌系列数据
$adNav = self::getAdNav($condition['brand']);
$data['list']['leftContent'][] = array('picLink' => $adNav);
//获取静态内容(20141219-100447)
if($node){
$nodeContent = HelperSearch::formatNodeContent($node);
$data['list']['leftContent'][]['picLink']['list'] = $nodeContent;
}
return $data;
}
/**
* 获取品牌首页banner条
... ... @@ -89,52 +95,29 @@ class BrandsModel {
$bannerImg = Helpers::getImageUrl($bannerImg['data']['banner'], '', 150);
}
// 根据品牌Id获取品牌(简介)、收藏
if (isset($uid)) {
$intro = BrandData::getBrandIntro($brandId, $uid);
}
$intro = BrandData::getBrandIntro($brandId, $uid);
$is_favorite = false;
$logo = false;
$shopName = false;
do {
if (!isset($intro['data'])) {
break;
}
if(isset($intro['data'])){
// 获取是否收藏
if ($intro['data']['is_favorite'] == 'Y') {
$is_favorite = true;
} elseif ($intro['data']['is_favorite'] == 'N') {
$is_favorite = false;
}
// 获取品牌logo
$logo = Helpers::getImageUrl($intro['data']['brand_ico'], 80, 50);
// 获取品牌名
self::$shopName = $intro['data']['brand_name'];
} while (false);
self::$shopName = $intro['data']['brand_name'];
}
// 返回banner数据
return array(
'brandBanner' => array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
),
'shopEntry' => array(
'home' => self::$home,
'logo' => $logo,
'shopName' => self::$shopName,
'sort' => array(
array(
'href' => '',
'name' => 'T恤'
),
array(
'href' => '',
'name' => '卫衣'
)
)
)
);
'brandBanner' => array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
)
);
}
//获取品牌系列数据
... ... @@ -148,6 +131,8 @@ class BrandsModel {
$result['list'][$key]['src'] = $value['brand_sort_ico'];
}
}
$result['picTitle'] = '经典系列';
return $result;
}
... ...
<?php
namespace Product;
use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Plugin\HelperSearch;
use Plugin\Images;
/**
* sale首页模板数据模型
*
*/
class SaleModel
{
public static function getSaleSearchData($params, $options, $specialInfo)
{
$data = SearchData::searchElasticByCondition($params);
if (isset($data['code']) && $data['code'] === 200) {
//获取分类列表数据
$classes = WebProduct::getClassesData();
if (isset($classes['code']) && $classes['code'] === 200) {
$data['data']['filter']['group_sort'] = $classes['data']['sort'];
}
//用户浏览记录
// 组织模板数据
$list = HelperSearch::getList($data, $options);
//删除面包屑导航数据
unset($list['pathNav']);
$data = array(
//初始化js
'productListPage' => true,
'newSale' => $list
);
} else {
$data = array();
}
//组织sale数据
if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) {
$banner = json_decode($specialInfo['data']['banner_img'], true);
foreach ($banner as $k => $v) {
$v['img'] = Images::getSourceUrl($v['img'], 'couponImg');
$specialInfo['data']['banner'][] = $v;
}
$special = $specialInfo['data'];
}
//Sale首页 banner数据
$data['newSale']['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['newSale']['saleBanner']['img'] = $special['banner'][0]['img'];
$data['newSale']['saleTitle']['name'] = '全部商品';
$data['newSale']['saleTitle']['count'] = $data['newSale']['totalCount'];
//获取广告位数据
$nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
$data['newSale']['leftContent'][]['picLink']['list'] = $nodeContent;
return $data;
}
}
... ...
... ... @@ -60,6 +60,42 @@ class SearchModel
}
/**
* 搜索页面获取搜索数据
* @param $condition
* @param $options
* @return array
*/
public static function searchData($condition, $options){
$data = self::getSearchData($condition, $options);
//过滤频道
if (isset($condition['gender'])) {
unset($data['list']['filters']['channel']);
}
//过滤品牌
if (isset($condition['brand'])) {
unset($data['list']['filters']['brand']);
}
//过滤价格
if (isset($condition['price'])) {
unset($data['list']['filters']['price']);
unset($data['list']['filters']['customPrice']);
}
//过滤颜色
if (isset($condition['color'])) {
unset($data['list']['filters']['color']);
}
//过滤风格
if (isset($condition['style'])) {
unset($data['list']['filters']['seniorChose']);
}
//过滤尺码
if (isset($condition['size'])) {
unset($data['list']['filters']['size']);
}
return $data;
}
/**
* 根据product_sn查询产品图片信息
* @param $product_sn
* @param $options
... ...
... ... @@ -44,13 +44,13 @@ class AutouserinfoController extends AbstractAction
//整合
$data = array(
'registerPage' => true,
'thirdPage' => true,
'simpleHeader' => $simpleHeader,
'passport' => array(
'actionUrl' => Helpers::url('/autouserinfo/bind'),
'region' => RegData::getAreasData(),
'location' => '+86',
'captchaUrl' => Helpers::url('/passport/images?t=' . time()),
'captchaUrl' => '/passport/images?t=1449799445',
'itemUrl' => Helpers::url('/help/?category_id=9'),
'referUrl' => $refer,
'skipUrl' => SITE_MAIN,
... ...
... ... @@ -55,6 +55,7 @@ class BackController extends WebAction
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile);
$this->setSession('phoneNum', $phoneNum);
$this->setSession('area', $area);
if($data['code'] == 200) {
$this->redirect('verification');
}
... ... @@ -159,12 +160,20 @@ class BackController extends WebAction
* 手机验证
*/
public function verificationAction() {
$phoneNum = $this->getSession('phoneNum');
$area = $this->getSession('area');
// if(empty($phoneNum)) {
// $this->redirect('index');
// }
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'vertificationPage' => true,
'verification' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'phoneNum' => $phoneNum,
'area' => $area,
'countrys' => array()
)
);
... ...
<?php
use Action\WebAction;
use Product\BrandsModel;
use LibModels\Web\Product\BrandData;
class IndexController extends WebAction
{
... ... @@ -20,6 +19,7 @@ class IndexController extends WebAction
$brandInfo = BrandData::getBrandLogoByDomain($domain);
if(!empty($brandInfo['data']) && $brandInfo['code'] === 200){
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false;
}else{
$this->go(SITE_MAIN);
}
... ... @@ -54,6 +54,7 @@ class IndexController extends WebAction
}
//传品牌ID参数
$condition['brand'] = $brandId;
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1));
$condition['gender'] = $gender;
... ... @@ -92,7 +93,7 @@ class IndexController extends WebAction
$params = $condition + $_GET;
$params = array_filter($params);
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId);
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
//渲染模板
... ...
... ... @@ -858,17 +858,29 @@ class Index1Controller extends AbstractAction
),
array(
'picLink' => array(
'title' => 'AAAA',
'list' => array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
array(
'title' => 'AAAA',
'list' => array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
)
)
),
array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
)
)
)
)
),
array(
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\SaleData;
/**
* sale页
*
*/
class SaleController extends WebAction
{
public function indexAction()
{
//获取专区ID
$specialsaleId = $this->param('specialsaleId');
$specialInfo = SaleData::getSpecial($specialsaleId);
$special = $specialInfo['data'];
//获取促销ID
$promotion = $this->param('promotion');
//专区ID和促销ID都为空时,跳转到主页
if (empty($specialsaleId) && empty($promotion)) {
$this->go(SITE_MAIN);
}
/* 过滤请求参数 */
$condition = array();
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as &$value) {
$value = rawurldecode($value);
}
}
//传品牌ID参数
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
//传促销id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
}else{
$condition['promotion'] = $promotion;
}
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender'] == '2,3' ? 2 : 1));
$condition['gender'] = $gender;
//每页显示商品数
if (!isset($condition['viewNum']) || empty($condition['viewNum'])) {
$condition['viewNum'] = 59;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 59;
}
//每行显示的商品数量
if (!isset($condition['rowNum']) || empty($condition['rowNum'])) {
$condition['rowNum'] = 5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
$condition['needFilter'] = 1;
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' => $condition['rowNum'],
'viewNum' => $condition['viewNum'] - 1,
'specialsale_id' => 'Y'
);
$params = $condition + $_GET;
$params['attribute_not'] = 2;
$params = array_filter($params);
$data = Product\SaleModel::getSaleSearchData($params, $options, $specialInfo);
$cate = array('boys', 'girls', 'kids', 'lifestyle');
$this->setWebNavHeader($cate[$gender - 1]);
//渲染模板
$this->_view->display('new-sale', $data);
}
}
... ...
<?php
use Action\WebAction;
use Product\SearchModel;
class SearchController extends WebAction
{
public function indexAction()
{
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_VALIDATE_INT,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//字符转码
foreach($condition as $key => $val){
$condition[$key] = rawurldecode($val);
}
//关键词
$condition['query'] = '鞋';
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
$condition['gender'] = $gender;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//自定义搜索价格
if (isset($condition['price']) || !empty($condition['price'])) {
$price = explode(',', $condition['price']);
if (!$price[0]) {
$price[0] = 0;
}
if ($price[1]) {
$price[1] = 99999;
}
$condition['price'] = implode(',', $price);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
$condition['attribute_not'] = 2;
/*sale*/
//默认排序
if (!isset($condition['order']) || empty($condition['order'])) {
$condition['order'] = 's_n_desc';
}
if (!isset($condition['p_d']) || empty($condition['p_d'])) {
$condition['p_d'] = '0,0.9';
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum'],
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$searchData = SearchModel::searchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$data = array(
'searchListPage' => true,
);
$data['search'] = $searchData['list'];
$this->_view->display('search', $data);
}
}
\ No newline at end of file
... ...