Authored by 周少峰

Merge branch 'hotfix/async-header' into release/5.1

... ... @@ -1528,7 +1528,6 @@ function actionVipInfo(_data) {
function actionLoginInfo() {
$.getData('//www.yohobuy.com/common/passport', '', function(_data) {
if (_data && _data.result !== -1) {
actionLoginState(_data); // 更改登录状态
actionVipInfo(_data); //获得vip;
} else {
window.setCookie('_UID', '', {
... ... @@ -1548,11 +1547,16 @@ function actionProfileName(){
var profileName = getProfileName();
var uid = getUid();
var info = {
profileName:profileName,
result: 1
};
if(!uid || !profileName){
return;
info.result = -1;
}
actionLoginState({profileName:profileName, result:'1'})
actionLoginState(info);
}
/**
... ...
... ... @@ -103,11 +103,18 @@ function actionLoginInfo() {
var uid = getUid(), //eslint-disable-line
profileName = getProfileName(); // eslint-disable-line
if (uid === 0) {
return;
var info = {
random: $.now(),
profileName: profileName
};
if (uid !== 0) {
info.result = 1;
} else {
info.result = -1;
}
setLoginStatus({random: $.now(), profileName: profileName});
setLoginStatus(info);
}());
... ...
... ... @@ -36,11 +36,11 @@ class CommonController extends WebAction
// 首页资源品牌,采用内存存储
$key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
// array('logoBrand'=>'','moreBrand'=>'')
$data = Cache::get($key,'master');
if(empty($data)) {//从slave取数据
$data = Cache::get($key, 'master');
if (empty($data)) {//从slave取数据
$data = Cache::get($key, 'slave');
}
} while (false);
$this->echoJson($data);
... ... @@ -68,8 +68,8 @@ class CommonController extends WebAction
HomeModel::COOKIE_NAME_LIFESTYLE
);
$channel = $this->post('type', '');
$pageIndex = (int) $this->post('pageIndex', 0);
$pageCount = (int) $this->post('pageCount', 8);
$pageIndex = (int)$this->post('pageIndex', 0);
$pageCount = (int)$this->post('pageCount', 8);
if (!in_array($channel, $channels)) {
break;
}
... ... @@ -94,7 +94,7 @@ class CommonController extends WebAction
'goods' => $data
);
$data = array();
} while (false);
$this->echoJson($result);
... ... @@ -102,7 +102,7 @@ class CommonController extends WebAction
/**
* 获取资源位banner
*
*
* @return jsonp
*/
public function getbannerAction()
... ... @@ -111,7 +111,7 @@ class CommonController extends WebAction
$callback = $this->get('callback', '');
$width = $this->get('width', '');
$height = $this->get('height', '');
$data = IndexData::getResourceData($contentCode);
if (empty($data['data'])) {
return $this->helpJsonCallbackResult($callback, 200, '没有数据', '');
... ... @@ -138,7 +138,7 @@ class CommonController extends WebAction
/**
* 获取邮件订阅
*
*
* @return jsonp
*/
public function emailsubscriberAction()
... ... @@ -155,13 +155,13 @@ class CommonController extends WebAction
if (isset($data['code']) && $data['code'] === 200) {
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], array('result' => 1));
}
} while(false);
} while (false);
return $this->helpJsonCallbackResult($callback, 403, '订阅失败', '');
}
/**
* 意见反馈
*
*
* @return jsonp
*/
public function suggestfeedbackAction()
... ... @@ -267,7 +267,7 @@ class CommonController extends WebAction
//个人资料
$userInfo['profileName'] = $apiInfo['profile']['profile_name'];
$userInfo['headIco'] = isset($apiInfo['profile']['head_ico']) && !empty($apiInfo['profile']['head_ico']) ? Helpers::getImageUrl($apiInfo['profile']['head_ico'], 100 ,100) : '';
$userInfo['headIco'] = isset($apiInfo['profile']['head_ico']) && !empty($apiInfo['profile']['head_ico']) ? Helpers::getImageUrl($apiInfo['profile']['head_ico'], 63, 63) : '';
//VIP信息
$userInfo['curLevel'] = $apiInfo['profile']['vip_info']['cur_level'];
$userInfo['curTitle'] = $apiInfo['profile']['vip_info']['title'];
... ... @@ -309,12 +309,12 @@ class CommonController extends WebAction
)));
}
} while(false);
} while (false);
if (empty($userInfo)) {
$this->helpJsonCallbackResult($callback, 403,'User info', '');
$this->helpJsonCallbackResult($callback, 403, 'User info', '');
} else {
$this->helpJsonCallbackResult($callback, 200,'User info', $userInfo);
$this->helpJsonCallbackResult($callback, 200, 'User info', $userInfo);
}
}
... ... @@ -335,12 +335,12 @@ class CommonController extends WebAction
}
foreach ($productInfo as $val) {
$sknArray = explode('-', $val);
$skn[]= $sknArray[0];
$skn[] = $sknArray[0];
}
$skn = array_slice($skn, 0 ,$limit);
$skn = array_slice($skn, 0, $limit);
$result = SearchModel::historyProduct($skn, $limit);
} while(false);
$this->helpJsonCallbackResult($callback, 200,'User info', $result);
} while (false);
$this->helpJsonCallbackResult($callback, 200, 'User info', $result);
}
/**
... ... @@ -353,7 +353,7 @@ class CommonController extends WebAction
$uid = $this->getUid(true);
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = CartModel::shoppingCart($uid, $shoppingKey);
$this->helpJsonCallbackResult($callback, 200,'shoppingCart', $result);
$this->helpJsonCallbackResult($callback, 200, 'shoppingCart', $result);
}
/**
... ... @@ -374,13 +374,13 @@ class CommonController extends WebAction
$this->helpJsonCallbackResult($callback, $result['code'], $result['message'], '');
}
}
/**
* 选择支付时,时间间隔校验插入
*/
/**
* 选择支付时,时间间隔校验插入
*/
public function addPaymentIntervalAction()
{
$data = array('code'=>400,'message'=>'','data'=>'');
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
if (!$this->isAjax()) {
... ... @@ -388,16 +388,16 @@ class CommonController extends WebAction
}
$uid = $this->getUid(TRUE);
$orderCode = $this->get('orderCode','');
$payment = $this->get('payment',0);
$orderCode = $this->get('orderCode', '');
$payment = $this->get('payment', 0);
if (!$uid || !$orderCode || !$payment) {
break;
}
$res = CartData::savePrePayInfo($uid, $orderCode, $payment);
$data = array('code'=>$res['code'],'message'=>$res['message'],'data'=>$res['data']);
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => $res['data']);
} while (false);
$this->echoJson($data);
... ...