Authored by whb

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

@@ -30,6 +30,7 @@ class FavoriteData { @@ -30,6 +30,7 @@ class FavoriteData {
30 */ 30 */
31 public static function addUidProductFav($uid, $productSkn) 31 public static function addUidProductFav($uid, $productSkn)
32 { 32 {
  33 + //echo Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE;exit;
33 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'addUidProductFav', array($uid, $productSkn)); 34 return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'addUidProductFav', array($uid, $productSkn));
34 } 35 }
35 36
@@ -45,6 +46,18 @@ class FavoriteData { @@ -45,6 +46,18 @@ class FavoriteData {
45 } 46 }
46 47
47 /** 48 /**
  49 + * 根据uid和商品的skn收藏或取消收藏商品
  50 + * @param $uid
  51 + * @param $productSkn
  52 + * @return bool
  53 + */
  54 + public static function changeFavoriteProduct($uid, $productSkn)
  55 + {
  56 + //echo Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE;exit;
  57 + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_PRODUCT_FAVORITE, 'toggleProduct', array($uid, $productSkn));
  58 + }
  59 +
  60 + /**
48 * 根据uid和商品的skn添加或取消收藏品牌 61 * 根据uid和商品的skn添加或取消收藏品牌
49 * @param $uid 62 * @param $uid
50 * @param $productSkn 63 * @param $productSkn
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 {{/ registerHref}} 29 {{/ registerHref}}
30 </li> 30 </li>
31 <li class="tool-options"> 31 <li class="tool-options">
32 - <span>MY有货</span> 32 + <span><a href="{{userCenter}}">MY有货</a></span>
33 <i class="options-icon down iconfont">&#xe604;</i> 33 <i class="options-icon down iconfont">&#xe604;</i>
34 <i class="options-icon up iconfont">&#xe603;</i> 34 <i class="options-icon up iconfont">&#xe603;</i>
35 <div class="tool-select"> 35 <div class="tool-select">
@@ -174,7 +174,7 @@ $goodInfoMain.on('click', '.col-btn', function() { @@ -174,7 +174,7 @@ $goodInfoMain.on('click', '.col-btn', function() {
174 url: '/product/list/changeFavorite', 174 url: '/product/list/changeFavorite',
175 data: { 175 data: {
176 skn: $this.closest('.good-info').data('skn'), 176 skn: $this.closest('.good-info').data('skn'),
177 - isFavorite: !$this.hasClass('coled') 177 + isFavorite: $this.hasClass('coled')
178 } 178 }
179 }).then(function(res) { 179 }).then(function(res) {
180 if (res.code === 200) { 180 if (res.code === 200) {
@@ -187,19 +187,20 @@ $goodInfoMain.on('click', '.col-btn', function() { @@ -187,19 +187,20 @@ $goodInfoMain.on('click', '.col-btn', function() {
187 187
188 // 左侧导航 188 // 左侧导航
189 $productListNav.click(function(event) { 189 $productListNav.click(function(event) {
  190 + var $this = $(this);
190 191
191 - if (!$(event.target).hasClass('product-list-nav')) { 192 + if (!$this.hasClass('product-list-nav')) {
192 return; 193 return;
193 } 194 }
194 195
195 - if ($(this).hasClass('active')) { 196 + if ($this.hasClass('active')) {
196 197
197 - $(this).find('.sort-child-list').stop(true, true).slideUp(); 198 + $this.find('.sort-child-list').stop(true, true).slideUp();
198 199
199 } else { 200 } else {
200 201
201 - $(this).find('.sort-child-list').stop(true, true).slideDown(); 202 + $this.find('.sort-child-list').stop(true, true).slideDown();
202 } 203 }
203 204
204 - $(this).toggleClass('active'); 205 + $this.toggleClass('active');
205 }); 206 });
@@ -30,13 +30,15 @@ class PassportModel @@ -30,13 +30,15 @@ class PassportModel
30 public static function getSimpleHeader() 30 public static function getSimpleHeader()
31 { 31 {
32 //拼接简单头部 32 //拼接简单头部
  33 + $radomNum = time();
33 $tool = array( 34 $tool = array(
34 - 'favoriteHref' => Helpers::url('/home/favorite?t=' . time()), //我的收藏链接  
35 - 'couponHref' => Helpers::url('/home/coupons?t=' . time()), //我的优惠券链接  
36 - 'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接 35 + 'favoriteHref' => Helpers::url('/home/favorite?t=' . $radomNum), //我的收藏链接
  36 + 'couponHref' => Helpers::url('/home/coupons?t=' . $radomNum), //我的优惠券链接
  37 + 'orderHref' => Helpers::url('/home/orders?t=' . $radomNum), //订单中心连接
  38 + 'userCenter' => Helpers::url('/home?t=' . $radomNum),
37 'helpHref' => Helpers::url('/help'), 39 'helpHref' => Helpers::url('/help'),
38 ); 40 );
39 - $tool += array( 41 + $tool+=array(
40 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传 42 'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
41 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传 43 'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
42 ); 44 );
@@ -111,7 +113,7 @@ class PassportModel @@ -111,7 +113,7 @@ class PassportModel
111 $ret = current($data['data']); 113 $ret = current($data['data']);
112 } 114 }
113 } 115 }
114 - return array(); 116 + return $ret;
115 } 117 }
116 118
117 /** 119 /**
@@ -75,8 +75,17 @@ class BrandsModel @@ -75,8 +75,17 @@ class BrandsModel
75 } 75 }
76 76
77 //根据品牌域名处理相关品牌参数 77 //根据品牌域名处理相关品牌参数
78 - public static function getBrandByDomain($domain, $fields) 78 + public static function getBrandByDomain($domain, $type)
79 { 79 {
  80 + switch ($type) {
  81 + case 1:
  82 + $fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';
  83 + break;
  84 + case 2:
  85 + $fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';
  86 + default:
  87 + break;
  88 + }
80 $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields); 89 $brandInfo = BrandData::getBrandLogoByDomain($domain, $fields);
81 $result = array(); 90 $result = array();
82 if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) { 91 if (!empty($brandInfo['data']) && $brandInfo['code'] == 200) {
@@ -21,10 +21,18 @@ class LoginController extends WebAction @@ -21,10 +21,18 @@ class LoginController extends WebAction
21 $this->setSession('_LOGIN_EXPIRE', time() + 1800); 21 $this->setSession('_LOGIN_EXPIRE', time() + 1800);
22 22
23 //登录后跳转页面 23 //登录后跳转页面
24 - $refer = empty($_SERVER["HTTP_REFERER"]) ? '' : $_SERVER["HTTP_REFERER"]; 24 + $getRefer = $this->get('refer');
  25 + $httpRefer = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
  26 + $refer = $getRefer ? $getRefer : $httpRefer;
  27 + //检查refre是否为绝对路径,补www.yohobuy.com
  28 + if (!strstr($refer, 'http')) {
  29 + $refer = SITE_MAIN . $refer;
  30 + }
  31 +
25 if (!empty($refer)) { 32 if (!empty($refer)) {
26 $this->setCookie('refer', $refer); 33 $this->setCookie('refer', $refer);
27 } 34 }
  35 +
28 $simpleHeader = PassportModel::getSimpleHeader(); 36 $simpleHeader = PassportModel::getSimpleHeader();
29 //获取登陆页左侧资源 37 //获取登陆页左侧资源
30 $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE); 38 $cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
@@ -62,7 +70,7 @@ class LoginController extends WebAction @@ -62,7 +70,7 @@ class LoginController extends WebAction
62 */ 70 */
63 public function authAction() 71 public function authAction()
64 { 72 {
65 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 73 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
66 do { 74 do {
67 /* 判断是不是AJAX请求 */ 75 /* 判断是不是AJAX请求 */
68 if (!$this->isAjax()) { 76 if (!$this->isAjax()) {
@@ -101,18 +109,17 @@ class LoginController extends WebAction @@ -101,18 +109,17 @@ class LoginController extends WebAction
101 $ip = Helpers::getClientIp(); 109 $ip = Helpers::getClientIp();
102 $ipKey = md5('ip_signin_' . $ip); 110 $ipKey = md5('ip_signin_' . $ip);
103 $accountKey = md5('account_signin_' . $account); 111 $accountKey = md5('account_signin_' . $account);
104 - if(!Cache::get($ipKey)){ 112 + if (!Cache::get($ipKey)) {
105 Cache::set($ipKey, 0); 113 Cache::set($ipKey, 0);
106 } 114 }
107 - if(!Cache::get($accountKey)){ 115 + if (!Cache::get($accountKey)) {
108 Cache::set($accountKey, 0); 116 Cache::set($accountKey, 0);
109 } 117 }
110 - Cache::increment($accountKey, 1, 0, 1800);  
111 Cache::increment($ipKey, 1, 0, 3600); 118 Cache::increment($ipKey, 1, 0, 3600);
112 $accountTimes = Cache::get($accountKey); 119 $accountTimes = Cache::get($accountKey);
113 $ipTimes = Cache::get($ipKey); 120 $ipTimes = Cache::get($ipKey);
114 if ($accountTimes > 10) { 121 if ($accountTimes > 10) {
115 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 122 + $data = array('code' => 400, 'message' => '您的账号已被暂时锁定,请稍后再试', 'data' => '');
116 break; 123 break;
117 } 124 }
118 if ($ipTimes > 100) { 125 if ($ipTimes > 100) {
@@ -121,7 +128,8 @@ class LoginController extends WebAction @@ -121,7 +128,8 @@ class LoginController extends WebAction
121 } 128 }
122 $data = LoginData::signin($area, $account, $password, $shoppingKey); 129 $data = LoginData::signin($area, $account, $password, $shoppingKey);
123 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) { 130 if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['uid'])) {
124 - $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否忘记密码?', 'data' => ''); 131 + Cache::increment($accountKey, 1, 0, 1800);
  132 + $data = array('code' => 400, 'message' => '您输入的密码及账户名不匹配,是否<a href="'.Helpers::url('/passport/back/index').'" target="_blank">忘记密码?</a>', 'data' => '');
125 break; 133 break;
126 } 134 }
127 135
@@ -18,8 +18,8 @@ class IndexController extends WebAction @@ -18,8 +18,8 @@ class IndexController extends WebAction
18 $this->go(SITE_MAIN); 18 $this->go(SITE_MAIN);
19 } 19 }
20 //根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页 20 //根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
21 - $fields = 'id,brand_name,brand_name_cn,brand_name_en,brand_domain,brand_alif,brand_banner,brand_ico,static_content_code';  
22 - $result = BrandsModel::getBrandByDomain($domain, $fields);//TODO 21 + $type = 1;
  22 + $result = BrandsModel::getBrandByDomain($domain, $type);
23 if (!$result) { 23 if (!$result) {
24 $this->go(SITE_MAIN); 24 $this->go(SITE_MAIN);
25 } 25 }
@@ -55,7 +55,9 @@ class IndexController extends WebAction @@ -55,7 +55,9 @@ class IndexController extends WebAction
55 'searchListPage' => true, 55 'searchListPage' => true,
56 'list' => $data 56 'list' => $data
57 ); 57 );
58 - //TODO 58 + $this->setTitle('潮流商品搜索 | YOHO!有货');
  59 + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
  60 + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
59 $this->setWebNavHeader(); 61 $this->setWebNavHeader();
60 //渲染模板 62 //渲染模板
61 $this->_view->display('list',$data); 63 $this->_view->display('list',$data);
@@ -73,8 +75,8 @@ class IndexController extends WebAction @@ -73,8 +75,8 @@ class IndexController extends WebAction
73 75
74 76
75 //根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO 77 //根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
76 - $fields = 'id,brand_name,brand_name_cn,brand_banner,brand_ico,brand_intro';  
77 - $result = BrandsModel::getBrandByDomain($domain, $fields); 78 + $type = 2;
  79 + $result = BrandsModel::getBrandByDomain($domain, $type);
78 if (!$result) { 80 if (!$result) {
79 $this->go(SITE_MAIN); 81 $this->go(SITE_MAIN);
80 } 82 }
@@ -112,16 +114,28 @@ class IndexController extends WebAction @@ -112,16 +114,28 @@ class IndexController extends WebAction
112 if (!$this->isAjax()) { 114 if (!$this->isAjax()) {
113 return; 115 return;
114 } 116 }
115 - //$uid = $this->post('uid');TODO  
116 - 117 + $result = array(
  118 + 'code' => '400',
  119 + 'message' => 'operation failed'
  120 + );
  121 + $uid = $this->getUid();
117 $brandId = $this->post('brandId'); 122 $brandId = $this->post('brandId');
118 - if ($uid && $brandId) {  
119 - //调用接口收藏或取消收藏  
120 - $result = FavoriteData::changeFavoriteBrand($uid, $brandId);  
121 - if (isset($result['code']) && $result['code'] == 200) {  
122 - $this ->echoJson($result);  
123 - }//TODO  
124 - } 123 + do{
  124 + if (!$uid) {
  125 + $result = array(
  126 + 'code' => '403',
  127 + 'message' => 'uid is null'
  128 + );
  129 + break;
  130 + }
  131 + if ($uid && $brandId) {
  132 + //调用接口收藏或取消收藏
  133 + $result = FavoriteData::changeFavoriteBrand($uid, $brandId);
  134 + break;
  135 + }
  136 + }while(false);
  137 +
  138 + $this->echoJson($result);
125 } 139 }
126 140
127 /** 141 /**
@@ -26,6 +26,9 @@ class ListController extends WebAction @@ -26,6 +26,9 @@ class ListController extends WebAction
26 'productListPage' => true, 26 'productListPage' => true,
27 'list' => $indexData 27 'list' => $indexData
28 ); 28 );
  29 + $this->setTitle('潮流商品搜索 | YOHO!有货');
  30 + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
  31 + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
29 $this->setWebNavHeader(); 32 $this->setWebNavHeader();
30 $this->_view->display('list', $data); 33 $this->_view->display('list', $data);
31 } 34 }
@@ -45,11 +48,11 @@ class ListController extends WebAction @@ -45,11 +48,11 @@ class ListController extends WebAction
45 $newData = NewModel::getNewSearchData($condition, $options); 48 $newData = NewModel::getNewSearchData($condition, $options);
46 $data = array( 49 $data = array(
47 'productListPage' => true, 50 'productListPage' => true,
48 - 'newSale' => $newData,  
49 - 'title' => '潮流商品搜索 | YOHO!有货',  
50 - 'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',  
51 - 'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜' 51 + 'newSale' => $newData
52 ); 52 );
  53 + $this->setTitle('潮流商品搜索 | YOHO!有货');
  54 + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
  55 + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
53 $this->setWebNavHeader(); 56 $this->setWebNavHeader();
54 //渲染模板 57 //渲染模板
55 $this->_view->display('new-sale', $data); 58 $this->_view->display('new-sale', $data);
@@ -75,11 +78,11 @@ class ListController extends WebAction @@ -75,11 +78,11 @@ class ListController extends WebAction
75 $data = array( 78 $data = array(
76 //初始化js 79 //初始化js
77 'productListPage' => true, 80 'productListPage' => true,
78 - 'list' => $list,  
79 - 'title' => '潮流商品搜索 | YOHO!有货',  
80 - 'keywords' => 'Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流',  
81 - 'description' => '潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜' 81 + 'list' => $list
82 ); 82 );
  83 + $this->setTitle('潮流商品搜索 | YOHO!有货');
  84 + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
  85 + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
83 $this->setWebNavHeader(); 86 $this->setWebNavHeader();
84 $this->_view->display('list', $data); 87 $this->_view->display('list', $data);
85 } 88 }
@@ -100,7 +103,6 @@ class ListController extends WebAction @@ -100,7 +103,6 @@ class ListController extends WebAction
100 } 103 }
101 $productSkn = $this->post('skn'); 104 $productSkn = $this->post('skn');
102 $uid = $this->getUid(); 105 $uid = $this->getUid();
103 -  
104 if (!$productSkn) { 106 if (!$productSkn) {
105 $this ->echoJson($res); 107 $this ->echoJson($res);
106 return ; 108 return ;
@@ -143,10 +145,10 @@ class ListController extends WebAction @@ -143,10 +145,10 @@ class ListController extends WebAction
143 public function changeFavoriteAction() 145 public function changeFavoriteAction()
144 { 146 {
145 $result = array( 147 $result = array(
146 - 'code'=>400 148 + 'code' => 400,
  149 + 'message' => 'operation failed'
147 ); 150 );
148 if (!$this->isAjax()) { 151 if (!$this->isAjax()) {
149 - $this->echoJson($resut);  
150 return; 152 return;
151 } 153 }
152 $productSkn = $this->post('skn'); 154 $productSkn = $this->post('skn');
@@ -154,10 +156,17 @@ class ListController extends WebAction @@ -154,10 +156,17 @@ class ListController extends WebAction
154 $uid = $this->getUid(); 156 $uid = $this->getUid();
155 157
156 do { 158 do {
157 - if (!$productSkn && !$uid) { 159 + if (!$uid) {
  160 + $result = array(
  161 + 'code' => '403',
  162 + 'message' => 'uid is null'
  163 + );
  164 + break;
  165 + }
  166 + if (!isset($productSkn)) {
158 break; 167 break;
159 } 168 }
160 - if ($isFavorite) { 169 + if ($isFavorite == 'true') {
161 $result = FavoriteData::delUidProductFav($uid, $productSkn); 170 $result = FavoriteData::delUidProductFav($uid, $productSkn);
162 break; 171 break;
163 }else{ 172 }else{
@@ -56,6 +56,9 @@ class SaleController extends WebAction @@ -56,6 +56,9 @@ class SaleController extends WebAction
56 'productListPage' => true, 56 'productListPage' => true,
57 'newSale' => $saleData 57 'newSale' => $saleData
58 ); 58 );
  59 + $this->setTitle('潮流商品搜索 | YOHO!有货');
  60 + $this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
  61 + $this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
59 $this->setWebNavHeader(); 62 $this->setWebNavHeader();
60 //渲染模板 63 //渲染模板
61 $this->_view->display('new-sale', $data); 64 $this->_view->display('new-sale', $data);