Authored by 毕凯

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

... ... @@ -7,6 +7,7 @@ use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\SearchData;
use Api\Yohobuy;
use Api\Sign;
use Index\HomeModel;
/**
* 搜索辅助类
*/
... ... @@ -31,7 +32,7 @@ class HelperSearch
private static function setListNav()
{
$options = self::$options;
$cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
$channel = HomeModel::getSwitchChannel();
if (isset($options['brandName']) && !empty($options['brandName'])) {
$initNav = $options['brandNameEn'] . $options['brandNameCn'];
}else{
... ... @@ -39,7 +40,7 @@ class HelperSearch
}
self::$listNav[0] = array(
'href' => '',
'name' => strtoupper($cookieChannel).'首页'
'name' => strtoupper($channel).'首页'
);
self::$listNav[1] = array(
'href' => '',
... ...
... ... @@ -799,7 +799,12 @@ class Helpers
*/
public static function syncUserSession($uid, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/index?callback=' . $callback
if(APPLICATION_ENV == 'production') {
$domain = 'http://mapi.yohobuy.com';
} else {
$domain = 'http://m1.yohobuy.com';
}
return $domain.'/Passport/session/index?callback=' . $callback
. '&sign=' . md5(md5($uid . 'Js8Yn0!EwPM45-ws')) . '&uid=' . $uid . '&go=' . $refer;
}
... ... @@ -815,7 +820,12 @@ class Helpers
*/
public static function logoutSession($token, $refer = '', $callback = 'call')
{
return 'http://mapi.yohobuy.com/Passport/session/logout?callback=' . $callback
if(APPLICATION_ENV == 'production') {
$domain = 'http://mapi.yohobuy.com';
} else {
$domain = 'http://m1.yohobuy.com';
}
return $domain.'/Passport/session/logout?callback=' . $callback
. '&sign=' . md5(md5('Js8Yn0!EwPM45-ws')) . '&token=' . $token . '&go=' . $refer;
}
... ...
... ... @@ -68,7 +68,7 @@ function closeMask() {
if ($target.hasClass('mask') || $target.hasClass('backdrop')) {
$('#alreayregist').hide();
}
})
});
}
function nextStep() {
... ...
... ... @@ -6,4 +6,96 @@ if ($('.simple-header').size() > 0) {
}).on('mouseleave', function() {
$(this).find('.tool-select').fadeOut();
});
}
\ No newline at end of file
}
/**
* 格式化用户名
* @return {[type]} [description]
*/
function formatUsernName(userName) {
var name,
char,
_num = 0,
_length = 0,
t;
for (t = 0; t < userName.length; t++) {
char = userName.substr(t, 1);
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
_length += 2;
} else {
_length += 1;
}
}
if (_length <= 10) {
name = userName;
} else {
_num = 0;
name = '';
for (t = 0; t < userName.length; t++) {
if (_num < 10) {
char = userName.substr(t, 1);
if (char !== '*') {
if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
_num += 2;
} else {
_num += 1;
}
}
name += char;
}
}
if (name.length < userName.length) {
name += '...';
}
}
return name;
}
/**
* 设置简单头部登陆状态
* @return {[type]} [description]
*/
function setLoginStatus(_data) {
var loginHtml,
name;
if (_data && _data.href && _data.href.user) {
name = formatUsernName(_data.href.user);
loginHtml = '<span>Hi~</span><a href="">' +
name + '</a>&nbsp;<a href="' + _data.href.logout + '">[退出]</a>';
} else {
name = formatUsernName(_data.user);
loginHtml = '<span>Hi~</span><a href="">' +
name + '</a>&nbsp;<a href="http://www.yohobuy.com/signin.html">[请登录]</a>' +
'<a href="http://www.yohobuy.com/reg.html">[免费注册]</a>';
}
$('.header-tool li').eq(0).html(loginHtml);
}
/**
* 获取登录信息
* @return {[type]} [description]
*/
function actionLoginInfo() {
$.ajax({
type: 'GET',
url: '/common/getSimpleHeader',
data: {},
success: function(data) {
if (data.code === 200) {
setLoginStatus(data.data);
}
}
});
}
/**
* 初始化函数
* @return {[type]} [description]
*/
function init() {
actionLoginInfo(); //获取登录信息
}
init();
\ No newline at end of file
... ...