Authored by whb

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

... ... @@ -30,6 +30,7 @@ class FavoriteData {
*/
public static function addUidProductFav($uid, $productSkn)
{
//echo Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE;exit;
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'addUidProductFav', array($uid, $productSkn));
}
... ... @@ -45,6 +46,18 @@ class FavoriteData {
}
/**
* 根据uid和商品的skn收藏或取消收藏商品
* @param $uid
* @param $productSkn
* @return bool
*/
public static function changeFavoriteProduct($uid, $productSkn)
{
//echo Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE;exit;
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleProduct', array($uid, $productSkn));
}
/**
* 根据uid和商品的skn添加或取消收藏品牌
* @param $uid
* @param $productSkn
... ...
... ... @@ -29,7 +29,7 @@
{{/ registerHref}}
</li>
<li class="tool-options">
<span>MY有货</span>
<span><a href="{{userCenter}}">MY有货</a></span>
<i class="options-icon down iconfont">&#xe604;</i>
<i class="options-icon up iconfont">&#xe603;</i>
<div class="tool-select">
... ...
... ... @@ -174,7 +174,7 @@ $goodInfoMain.on('click', '.col-btn', function() {
url: '/product/list/changeFavorite',
data: {
skn: $this.closest('.good-info').data('skn'),
isFavorite: !$this.hasClass('coled')
isFavorite: $this.hasClass('coled')
}
}).then(function(res) {
if (res.code === 200) {
... ... @@ -187,19 +187,20 @@ $goodInfoMain.on('click', '.col-btn', function() {
// 左侧导航
$productListNav.click(function(event) {
var $this = $(this);
if (!$(event.target).hasClass('product-list-nav')) {
if (!$this.hasClass('product-list-nav')) {
return;
}
if ($(this).hasClass('active')) {
if ($this.hasClass('active')) {
$(this).find('.sort-child-list').stop(true, true).slideUp();
$this.find('.sort-child-list').stop(true, true).slideUp();
} else {
$(this).find('.sort-child-list').stop(true, true).slideDown();
$this.find('.sort-child-list').stop(true, true).slideDown();
}
$(this).toggleClass('active');
$this.toggleClass('active');
});
... ...
... ... @@ -30,13 +30,15 @@ class PassportModel
public static function getSimpleHeader()
{
//拼接简单头部
$radomNum = time();
$tool = array(
'favoriteHref' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接
'couponHref' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接
'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接
'favoriteHref' => Helpers::url('/home/favorite?t=' . $radomNum), //我的收藏链接
'couponHref' => Helpers::url('/home/coupons?t=' . $radomNum), //我的优惠券链接
'orderHref' => Helpers::url('/home/orders?t=' . $radomNum), //订单中心连接
'userCenter' => Helpers::url('/home?t=' . $radomNum),
'helpHref' => Helpers::url('/help'),
);
$tool += array(
$tool+=array(
'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
);
... ... @@ -111,7 +113,7 @@ class PassportModel
$ret = current($data['data']);
}
}
return array();
return $ret;
}
/**
... ...
... ... @@ -75,8 +75,17 @@ class BrandsModel
}
//根据品牌域名处理相关品牌参数
public static function getBrandByDomain($domain, $fields)
public static function getBrandByDomain($domain, $type)
{
switch ($type) {
case 1:
$fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
break;
case 2:
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
default:
break;
}
$brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
$result = array();
if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
... ...
... ... @@ -21,10 +21,18 @@ class LoginController extends WebAction
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
//登录后跳转页面
$refer = empty($_SERVER["HTTP_REFERER"]) ? '' : $_SERVER["HTTP_REFERER"];
$getRefer = $this->get('refer');
$httpRefer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
$refer = $getRefer ? $getRefer : $httpRefer;
//检查refre是否为绝对路径,补www.yohobuy.com
if (!strstr($refer, 'http')) {
$refer = SITE_MAIN . $refer;
}
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
$simpleHeader = PassportModel::getSimpleHeader();
//获取登陆页左侧资源
$cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
... ... @@ -62,7 +70,7 @@ class LoginController extends WebAction
*/
public function authAction()
{
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
... ... @@ -101,18 +109,17 @@ class LoginController extends WebAction
$ip = Helpers::getClientIp();
$ipKey = md5('ip_signin_' . $ip);
$accountKey = md5('account_signin_' . $account);
if(!Cache::get($ipKey)){
if (!Cache::get($ipKey)) {
Cache::set($ipKey, 0);
}
if(!Cache::get($accountKey)){
if (!Cache::get($accountKey)) {
Cache::set($accountKey, 0);
}
Cache::increment($accountKey, 1, 0, 1800);
Cache::increment($ipKey, 1, 0, 3600);
$accountTimes = Cache::get($accountKey);
$ipTimes = Cache::get($ipKey);
if ($accountTimes > 10) {
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
$data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
break;
}
if ($ipTimes > 100) {
... ... @@ -121,7 +128,8 @@ class LoginController extends WebAction
}
$data = LoginData::signin($area, $account, $password, $shoppingKey);
if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => '');
Cache::increment($accountKey, 1, 0, 1800);
$data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
break;
}
... ...
... ... @@ -18,8 +18,8 @@ class IndexController extends WebAction
$this->go(SITE_MAIN);
}
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
$result = BrandsModel::getBrandByDomain($domain, $fields);//TODO
$type = 1;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
... ... @@ -55,7 +55,9 @@ class IndexController extends WebAction
'searchListPage' => true,
'list' => $data
);
//TODO
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
... ... @@ -73,8 +75,8 @@ class IndexController extends WebAction
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
$fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
$result = BrandsModel::getBrandByDomain($domain, $fields);
$type = 2;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
... ... @@ -112,16 +114,28 @@ class IndexController extends WebAction
if (!$this->isAjax()) {
return;
}
//$uid = $this->post('uid');TODO
$result = array(
'code' => '400',
'message' => 'operation failed'
);
$uid = $this->getUid();
$brandId = $this->post('brandId');
do{
if (!$uid) {
$result = array(
'code' => '403',
'message' => 'uid is null'
);
break;
}
if ($uid && $brandId) {
//调用接口收藏或取消收藏
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
if (isset($result['code']) && $result['code'] == 200) {
$this ->echoJson($result);
}//TODO
break;
}
}while(false);
$this->echoJson($result);
}
/**
... ...
... ... @@ -26,6 +26,9 @@ class ListController extends WebAction
'productListPage' => true,
'list' => $indexData
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
$this->_view->display('list', $data);
}
... ... @@ -45,11 +48,11 @@ class ListController extends WebAction
$newData = NewModel::getNewSearchData($condition, $options);
$data = array(
'productListPage' => true,
'newSale' => $newData,
'title' => '潮流商品搜索 | YOHO!有货',
'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',
'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
'newSale' => $newData
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
... ... @@ -75,11 +78,11 @@ class ListController extends WebAction
$data = array(
//初始化js
'productListPage' => true,
'list' => $list,
'title' => '潮流商品搜索 | YOHO!有货',
'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',
'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
'list' => $list
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
$this->_view->display('list', $data);
}
... ... @@ -100,7 +103,6 @@ class ListController extends WebAction
}
$productSkn = $this->post('skn');
$uid = $this->getUid();
if (!$productSkn) {
$this ->echoJson($res);
return ;
... ... @@ -143,10 +145,10 @@ class ListController extends WebAction
public function changeFavoriteAction()
{
$result = array(
'code'=>400
'code' => 400,
'message' => 'operation failed'
);
if (!$this->isAjax()) {
$this->echoJson($resut);
return;
}
$productSkn = $this->post('skn');
... ... @@ -154,10 +156,17 @@ class ListController extends WebAction
$uid = $this->getUid();
do {
if (!$productSkn && !$uid) {
if (!$uid) {
$result = array(
'code' => '403',
'message' => 'uid is null'
);
break;
}
if (!isset($productSkn)) {
break;
}
if ($isFavorite) {
if ($isFavorite == 'true') {
$result = FavoriteData::delUidProductFav($uid, $productSkn);
break;
}else{
... ...
... ... @@ -56,6 +56,9 @@ class SaleController extends WebAction
'productListPage' => true,
'newSale' => $saleData
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('new-sale', $data);
... ...