Authored by biao

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

... ... @@ -34,6 +34,7 @@ class AbstractAction extends Controller_Abstract
protected $_uid = 0;
protected $_uname = '';
protected $_vip;
protected $_useSession = true;
/**
* 存放模板数据
... ... @@ -53,16 +54,20 @@ class AbstractAction extends Controller_Abstract
switch (APPLICATION_ENV) {
case 'production': // 生产
$this->_view->assign('rlsEnv', true);
$this->_useSession = true;
break;
case 'preview': // 预览
$this->_view->assign('preEnv', true);
$this->_useSession = true;
break;
case 'testing': // 测试
$this->_view->assign('testEnv', true);
$this->_useSession = true;
break;
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
$this->_useSession = false;
break;
}
}
... ... @@ -261,7 +266,9 @@ class AbstractAction extends Controller_Abstract
*/
public function setSession($name, $value)
{
Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value);
if ($this->_useSession) {
Session::start('yohobuy_session', null, 'yohobuy.com')->__set($name, $value);
}
}
/**
... ... @@ -272,7 +279,11 @@ class AbstractAction extends Controller_Abstract
*/
public function getSession($name)
{
return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name);
if ($this->_useSession) {
return Session::start('yohobuy_session', null, 'yohobuy.com')->__get($name);
} else {
return '';
}
}
/**
... ... @@ -283,26 +294,27 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid($useSession = false)
{
// @todo
$useSession = false;
// 控制是否启用SESSION
if (!$this->_useSession) {
$useSession = false;
}
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$uid = 0;
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$uid = $cookieList[1];
if ($useSession) {
$token = $this->getSession('_TOKEN');
if ($token === Helpers::makeToken($cookieList[1])) {
$this->_uid = $cookieList[1];
}
} else {
$this->_uid = $cookieList[1];
}
$this->_uname = $cookieList[0];
$this->_vip = $cookieList[2];
}
// 服务端比较
if ($useSession && $uid) {
$token = $this->getSession('_TOKEN');
if ($token === Helpers::makeToken($uid)) {
$this->_uid = $uid;
}
}
}
}
return $this->_uid;
... ...
... ... @@ -2,7 +2,7 @@
/**
* 有货相关接口类
*
*
* @name Yohobuy
* @package library/Api
* @copyright yoho.inc
... ... @@ -35,8 +35,8 @@ class Yohobuy
/**
* 私钥列表
*
* @var array
*
* @var array
*/
private static $privateKeyList = array(
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
... ... @@ -84,7 +84,7 @@ class Yohobuy
/**
* 取得公共的参数
*
*
* @return array
*/
public static function param()
... ... @@ -103,7 +103,7 @@ class Yohobuy
/**
* 构建URL
*
*
* @param string $url
* @param array $data
* @return string
... ... @@ -179,7 +179,7 @@ class Yohobuy
/**
* post提交数据
*
*
* @param string $url 接口URL
* @param array $data 参数列表
* @param bool $returnJson 控制是否返回json格式数据
... ... @@ -231,7 +231,7 @@ class Yohobuy
/**
* 批量调用接口
*
*
* @param array $urlList 接口列表
* @param array $options CURL设置项
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
... ... @@ -335,7 +335,7 @@ class Yohobuy
/**
* rpc调用远程服务(YAR)
*
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @param string $uri
* @param string $method
... ... @@ -384,7 +384,7 @@ class Yohobuy
/**
* 并行(异步)调用远程服务
*
*
* @see http://php.net/manual/zh/class.yar-concurrent-client.php
* @param string $uri
* @param string $method
... ...
... ... @@ -76,15 +76,4 @@ class LoginData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 登出SESSION会话
*
* @param string $token 会话
* @return array
*/
public static function signoutSession($token)
{
return Yohobuy::get( Helpers::logoutSession($token) );
}
}
... ...
... ... @@ -42,7 +42,7 @@ class ListProcess
$products = array();
foreach ($data as $value) {
$products[] = Helpers::formatProduct($value, true, true, true);
$products[] = Helpers::formatProduct($value, true, true, true, 235, 314);
}
return $products;
... ...
... ... @@ -607,7 +607,7 @@ class Helpers
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
. '&sign=' . md5($uid . 'Js8Yn0!EwPM45-ws') . '&uid=' . $uid . '&go=' . $refer;
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
/**
... ... @@ -620,10 +620,10 @@ class Helpers
* @param string $callback 回调方法名
* @return string
*/
public static function logoutSession($token, $callback = 'call')
public static function logoutSession($token, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback
. '&sign=' . md5('Js8Yn0!EwPM45-ws') . '&token=' . $token;
. '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer;
}
}
... ...
... ... @@ -12,7 +12,9 @@ var orderId = $('#order-detail').data('id');
var optHammer;
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//订单删除
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
... ...
... ... @@ -58,13 +58,17 @@ function getOrders(option) {
if (opt.page === 1) {
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'));
lazyLoad($curContainer.find('.lazy'), {
try_again_css: 'order-failure'
});
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
try_again_css: 'order-failure'
});
}
window.rePosFooter(); //重新计算底部位置
... ... @@ -78,7 +82,9 @@ function getOrders(option) {
});
}
lazyLoad();
lazyLoad({
try_again_css: 'order-failure'
});
//初始化导航
(function() {
... ...
... ... @@ -21,7 +21,7 @@
"yoho.iswiper": "3.0.1",
"iscroll": "5.1.2",
"import-style": "1.0.0",
"yoho.lazyload": "1.1.2",
"yoho.lazyload": "1.1.3",
"yoho.handlebars": "3.0.3",
"yoho.hammer": "2.0.4"
},
... ...
.order-failure {
background-image: image-url('lazy-failure/order-good.jpg');
background-size: 100%;
}
\ No newline at end of file
... ...
... ... @@ -16,7 +16,7 @@
background-color: #FFF;
border-radius: 30rem / $pxConvertRem;
padding: 0 32rem / $pxConvertRem 0 52rem / $pxConvertRem;
a {
width: 100%;
height: 60rem / $pxConvertRem;
... ... @@ -77,6 +77,14 @@
.hot-brands {
padding-top: 178rem / $pxConvertRem;
.floor-header {
padding: 0;
}
.brands-swiper {
border-top: 0;
}
}
.hot-brand {
... ... @@ -194,7 +202,7 @@
.con {
padding-top: 10rem / $pxConvertRem;
}
.search-result {
padding-top: 176rem / $pxConvertRem;
}
... ...
... ... @@ -61,14 +61,14 @@
.brand:nth-child(5n) {
border-right: none;
}
.more {
float: left;
width: 317rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
a {
display: block;
width: 100%;
... ... @@ -109,6 +109,7 @@
}
img {
display: inline-block;
max-width: 100%;
max-height: 100%;
vertical-align: middle;
... ... @@ -132,4 +133,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
... ... @@ -143,6 +143,7 @@ a {
@import "layout/footer";
@import "layout/footer_tab";
@import "good";
@import "lazy-failure";
@import "filter";
@import "loading";
@import "passport/index";
... ...
... ... @@ -48,8 +48,7 @@ $basicBtnC:#eb0313;
//padding: pxToRem(20px) pxToRem(12px);
padding: pxToRem(6px) 3%;
width: 49.9%;
border-bottom: pxToRem(4px) solid #fff;
border-right: pxToRem(4px) solid #fff;
border: 1px solid #fff;
font-size: pxToRem(24px);
background-color: $tableCellC;
word-wrap: break-word;
... ... @@ -69,8 +68,7 @@ $basicBtnC:#eb0313;
width: 49.9%;
background-color: $tableCellC;
box-sizing: border-box;
border-bottom: 1px solid #fff;
border-right: 1px solid #fff;
border: 1px solid #fff;
width: 49.9%;
height: 100%;
float: left;
... ...
<div class="hot-brands">
{{^ brandPage}}
{{> home/floor_header}}
{{/ brandPage}}
{{> home/floor_header}}
<div class="brands-swiper">
<ul class="brands-list swiper-wrapper clearfix">
{{# list}}
... ...
... ... @@ -201,7 +201,7 @@ class UserModel
$datas[] = $product;
}
!empty($datas) && $result['hasFavProduct'] = $datas;
} else if ($page > 1 && isset($favProduct['code']) && $favProduct['code'] === 500) {
} else if ($page > 1 && (!$favProduct || (isset($favProduct['code']) && $favProduct['code'] === 500))) {
$result['end'] = true;
}
... ... @@ -259,7 +259,7 @@ class UserModel
$datas[] = $brand;
}
!empty($datas) && $result['hasFavBrand'] = $datas;
} else if ($page > 1 && isset($favBrand['code']) && $favBrand['code'] === 500) {
} else if ($page > 1 && (!$favBrand || (isset($favBrand['code']) && $favBrand['code'] === 500))) {
$result['end'] = true;
}
... ...
... ... @@ -213,7 +213,7 @@ class ListModel
}
// 调用接口查询数据
$brandLogo = BrandData::getBrandLogoByDomain($domain);
$brandLogo = BrandData::getBrandLogoByDomain($domain);
// 处理返回的数据
if (isset($brandLogo['data'])) {
$result = array(
... ...
... ... @@ -78,7 +78,7 @@ class LoginController extends AbstractAction
$refer = $this->server('HTTP_REFERER', SITE_MAIN);
$token = $this->get('token');
if (!empty($token)) {
LoginData::signoutSession($token);
$this->go( Helpers::logoutSession($token, $refer) );
}
$this->go($refer);
... ...
... ... @@ -217,7 +217,7 @@ class IndexController extends AbstractAction
// 右下角的购物车链接
$data['goodList']['cartUrl'] = Helpers::url('/cart/index/index', null);
//$data['goodList'] += $condition;
$data['goodList'] += $condition;
$data['pageFooter'] = true;
if ($title === '') {
... ...