Authored by 周少峰

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into feature/web-list

... ... @@ -329,10 +329,11 @@ class AbstractAction extends Controller_Abstract
if (!$this->_useSession) {
$useSession = false;
}
$useSession = false;
//$useSession = false;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -352,6 +353,13 @@ class AbstractAction extends Controller_Abstract
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
}
... ...
... ... @@ -67,7 +67,7 @@ class WebAction extends Controller_Abstract
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
$this->_useSession = false;
$this->_useSession = true;
break;
}
}
... ... @@ -333,9 +333,11 @@ class WebAction extends Controller_Abstract
if (!$this->_useSession) {
$useSession = false;
}
//$useSession = false;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -355,6 +357,13 @@ class WebAction extends Controller_Abstract
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
}
... ...
... ... @@ -208,7 +208,7 @@ class FloorProcess
foreach ($data['list'] as &$one) {
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
// isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type];
isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type];
}
$one['img'] = Helpers::getImageUrl($one['src'], 158, 174);
unset($one['src']);
... ...
... ... @@ -190,7 +190,7 @@ class Helpers
*/
public static function transPrice($price)
{
return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', '');
return !empty($price) ? number_format($price, 2, '.', '') : 0;
}
/**
... ... @@ -566,8 +566,8 @@ class Helpers
$arr[$key]['appearDate'] = $vo['expect_arrival_time'];
}
// 商品链接
if ($haveLink && isset($vo['product_id'])) {
$arr[$key]['link'] = self::url('/product/pro_' . $vo['product_id'] . '_' . $vo['goods_id'] . '/' . $vo['cn_alphabet'] . '.html');
if ($haveLink && isset($vo['product_skn'])) {
$arr[$key]['link'] = self::url('/product/show_' . $vo['product_skn'] . '.html');
}
// 累计购买数
$count += intval($vo['buy_number']);
... ... @@ -576,43 +576,61 @@ class Helpers
return $arr;
}
/**
/**
* 格式化购物车商品
*
* @param array $cartGoods 购物车商品列表
* @param boolean $isValid 是否是可用商品(非失效商品),默认是
* @param bool $isAdvanceCart 是否是预售购物车(和上市期有关)
* @return array 处理之后的购物车商品数据
*/
public static function formatCartGoods($cartGoods)
public static function formatCartGoods($cartGoods, $isAdvanceCart, $isValid = true)
{
$arr = array();
$oneGoods = array();
foreach ($cartGoods as $key => $value) {
$oneGoods = array();
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : '';
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['checked'] = $value['selected'] === 'Y';
$oneGoods['price'] = self::transPrice($value['last_vip_price']);
$oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price'];
$oneGoods['count'] = $value['buy_number'];
$oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']);
if ($isValid) {
// 库存不足
$oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
} else { // 失效商品
$oneGoods['inValid'] = true;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
$oneGoods['inValid'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['showCheckbox'] = true;
$oneGoods['isAdvanceBuy'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} else {
$oneGoods['showCheckbox'] = true;
}
// 上市期
if (!empty($value['expect_arrival_time'])) {
if ($isAdvanceCart && !empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet']) ) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
$oneGoods['link'] = self::url('/product/show_' . $value['product_skn'] . '.html');
$arr[$key] = $oneGoods;
}
... ... @@ -621,7 +639,7 @@ class Helpers
}
/**
* 格式化加价购商品
* 格式化加价购和赠品商品
*
* @param array $advanceGoods 加价购商品列表
* @param int $count 计商品件数
... ... @@ -633,26 +651,31 @@ class Helpers
$gift = array();
$oneGoods = array();
$number = 0;
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionId'] = $value['promotion_id'];
$gift['promotionTitle'] = $value['promotion_title'];
$number = 0;
foreach ($value['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : '';
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = $single['last_price'];
$oneGoods['marketPrice'] = $single['market_price'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['price'] = self::transPrice($single['last_price']);
$oneGoods['marketPrice'] = self::transPrice($single['market_price']);
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
$number ++;
}
$arr[] = $gift;
// 计算加价购商品数目
$count += count($value['goods_list']);
//$count += count($value['goods_list']);
$count += $number;
}
return $arr;
... ...
... ... @@ -45,7 +45,9 @@ class AlipayNotify {
$isSign = $this->getSignVeryfy($_POST, $_POST["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (! empty($_POST["notify_id"])) {$responseTxt = $this->getResponse($_POST["notify_id"]);}
if (!empty($_POST["notify_id"])) {
$responseTxt = $this->getResponse($_POST["notify_id"]);
}
//写日志记录
//if ($isSign) {
... ... @@ -57,11 +59,10 @@ class AlipayNotify {
//$log_text = "responseTxt=".$responseTxt."\n notify_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_POST);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i",$responseTxt) && $isSign) {
if (preg_match("/true$/i", $responseTxt) && $isSign) {
return true;
} else {
return false;
... ... @@ -74,15 +75,16 @@ class AlipayNotify {
* @return 验证结果
*/
function verifyReturn(){
if(empty($_GET)) {//判断POST来的数组是否为空
if (empty($_GET)) {//判断POST来的数组是否为空
return false;
}
else {
} else {
//生成签名结果
$isSign = $this->getSignVeryfy($_GET, $_GET["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (! empty($_GET["notify_id"])) {$responseTxt = $this->getResponse($_GET["notify_id"]);}
if (!empty($_GET["notify_id"])) {
$responseTxt = $this->getResponse($_GET["notify_id"]);
}
//写日志记录
//if ($isSign) {
... ... @@ -94,11 +96,10 @@ class AlipayNotify {
//$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_GET);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i",$responseTxt) && $isSign) {
if (preg_match("/true$/i", $responseTxt) && $isSign) {
return true;
} else {
return false;
... ...
... ... @@ -55,7 +55,7 @@ class Call extends Factory
try
{
$token = $this->renn->getTokenFromTokenEndpoint('code', $keys, TokenType::Bearer);
$token = $this->renn->getTokenFromTokenEndpoint('code', $keys, \TokenType::Bearer);
// 返回数组格式的信息
$token = $this->renn->getTokens();
... ... @@ -84,7 +84,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['token_type']) ? $token['token_type'] : \TokenType::Bearer, $token['access_token'], isset($token['refresh_token']) ? $token['refresh_token'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ... @@ -130,7 +130,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ... @@ -178,7 +178,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ...
... ... @@ -191,7 +191,7 @@ function reMarginFooter(fixedElement) {
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas-debug.js', '_yas');
(function() {
var uid = getUid();
... ... @@ -201,7 +201,7 @@ function reMarginFooter(fixedElement) {
window._ozuid = uid;//暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', uid, '', '');
}
}());
... ...
... ... @@ -238,16 +238,16 @@ function search(opt) {
if (window._yas) {
switch (navType) {
case 'newest':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.new-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.new-goods .good-info .good-detail-img .good-thumb'));
break;
case 'price':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.price-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.price-goods .good-info .good-detail-img .good-thumb'));
break;
case 'discount':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.discount-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.discount-goods .good-info .good-detail-img .good-thumb'));
break;
}
}
... ...
... ... @@ -12,7 +12,18 @@
<!-- [if (gte IE 6)&(lte IE 8)>
<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
{{#if rlsEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
{{/if}}
{{#if preEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
{{/if}}
{{#if testEnv}}
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index.css">
{{/if}}
{{#if devEnv}}
<link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css">
{{/if}}
</head>
<body>
{{# simpleHeader}}
... ...
... ... @@ -3990,14 +3990,30 @@ validateResult = [
];
//手机号ajax校验
function phoneAjaxFn(callback) {
$.ajax({
url: '/passport/register/checkmobile',
type: 'POST',
data: {
function phoneAjaxFn(page, callback) {
var url,
data;
if (page === 'reg') {
url = '/passport/register/checkmobile';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1]
};
} else if (page === 'third') {
url = '/passport/autouserinfo/bindCheck';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1],
openId: 1,
sourceType: 'QQ'
};
}
$.ajax({
url: url,
type: 'POST',
data: data
}).then(function(data) {
switch (data.code) {
case 200:
... ... @@ -4015,10 +4031,17 @@ function phoneAjaxFn(callback) {
}
//图形验证码ajax校验
function picCaptchaAjaxFn(callback) {
function picCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/piccaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkPicCode';
}
$.ajax({
type: 'POST',
url: '/passport/register/piccaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -4030,7 +4053,7 @@ function picCaptchaAjaxFn(callback) {
validateResult[1].message = '';
validateResult[1].status = true;
break;
case 404:
case 400:
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
break;
... ... @@ -4040,10 +4063,17 @@ function picCaptchaAjaxFn(callback) {
}
//短信验证码ajax校验
function msgCaptchaAjaxFn(callback) {
function msgCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/msgcaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkBindMsg';
}
$.ajax({
type: 'POST',
url: '/passport/register/msgcaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -4055,7 +4085,7 @@ function msgCaptchaAjaxFn(callback) {
validateResult[2].message = '';
validateResult[2].status = true;
break;
case 404:
case 400:
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
break;
... ... @@ -4066,7 +4096,7 @@ function msgCaptchaAjaxFn(callback) {
}
// 验证
function validateRule($element, callback) {
function validateRule(page, $element, callback) {
var val = $.trim($element.val()),
regionCode;
... ... @@ -4088,7 +4118,7 @@ function validateRule($element, callback) {
callback();
} else {
phoneAjaxFn(callback);
phoneAjaxFn(page, callback);
}
//图形验证码校验
... ... @@ -4107,7 +4137,7 @@ function validateRule($element, callback) {
// 并且手机号正确
if (validateResult[0].status) {
picCaptchaAjaxFn(callback);
picCaptchaAjaxFn(page, callback);
} else {
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
... ... @@ -4133,7 +4163,7 @@ function validateRule($element, callback) {
// 并且图形验证码正确
if (validateResult[1].status) {
msgCaptchaAjaxFn(callback);
msgCaptchaAjaxFn(page, callback);
} else {
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
... ... @@ -4286,14 +4316,16 @@ function pwdFn($obj) {
// 失去焦点时开始校验
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
$registerPage.find('.va').keyup(function() {
// ( ▼-▼ )注册页和信息完善页面接口不同
exports.init = function(page) {
$registerPage.find('.va').keyup(function() {
var j,
statusLen = 0,
vLen = validateResult.length,
$that = $(this);
validateRule($(this), function() {
validateRule(page, $(this), function() {
showErrTip(); // 显示错误提示
showBorder(); // 显示红色边框
... ... @@ -4329,32 +4361,48 @@ $registerPage.find('.va').keyup(function() {
pwdFn($that);
}
}).blur(function() {
}).blur(function() {
/*validateRule($(this), function() {
showErrTip();
showBorder(); // 显示红色边框
});*/
});
});
$regionSelect.change(function() {
$regionSelect.change(function() {
$region.text('+' + $('#region').val());
validateRule($pn, showErrTip); //验证
});
validateRule(page, $pn, showErrTip); //验证
});
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 10,
t;
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 20,
t,
url;
if ($(this).hasClass('disable')) {
return;
}
//todo ajax
if (page === 'reg') {
url = '/passport/register/sendBindMsg';
} else if (page === 'third') {
url = '/passport/autouserinfo/sendBindMsg';
}
//todo ajax 发送验证码
$.ajax({
type: 'POST',
url: url,
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
code: $ca.val()
}
}).then(function(data) {
if (data.code === 200) {
t = setInterval(function() {
if (timeResidue <= 0) {
$sendCaptcha.removeClass('disable').val('获取短信验证码');
... ... @@ -4363,10 +4411,20 @@ $sendCaptcha.click(function() {
}
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
}, 1000);
});
}
});
});
//ajax表单提交
$registerBtn.click(function() {
//form表单提交
$registerBtn.click(function() {
var url;
if (page === 'reg') {
url = '/passport/register/mobileregister';
} else if (page === 'third') {
url = '/passport/autouserinfo/bindMobile';
}
if ($(this).hasClass('disable')) {
return;
... ... @@ -4375,7 +4433,7 @@ $registerBtn.click(function() {
//ajax提交
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
url: url,
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
... ... @@ -4414,15 +4472,16 @@ $registerBtn.click(function() {
});
}
});
});
$('.change-captcha').click(function() {
$('.change-captcha').click(function() {
var time = new Date(),
$captchaImg = $('.captcha-img'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
});
});
};
});
define("js/passport/mail-phone-regx", [], function(require, exports, module){
/**
... ... @@ -4828,6 +4887,8 @@ var checkbox = {
unchecked: '&#xe613;'
};
var authing = false;
var emailAcTime;
require("jquery.placeholder");
... ... @@ -4843,7 +4904,7 @@ function validateAccount() {
if (/^[0-9]+$/.test(account)) {
//如果是纯数字,则作为手机号码处理
if (mailPhoneRegx.phoneRegx['+' + $countryCodeHide.val()].test(account)) {
if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) {
pass = true;
} else {
pass = false;
... ... @@ -4894,6 +4955,7 @@ function validatePassword() {
$passwordTip.removeClass('hide').children('em').text(err);
$password.addClass('error');
}
return pass;
}
//验证
... ... @@ -5051,8 +5113,30 @@ $('.va').on('focus', function() {
$('#login-btn').on('click', function() {
var pass = validate();
if (pass) {
$('#login-form').submit();
if (pass && authing === false) {
authing = true;
$.ajax({
url: '/passport/login/auth',
type: 'POST',
data: {
areaCode: $countryCodeHide.val().replace('+', ''),
account: $.trim($account.val()),
password: $.trim($password.val())
},
success: function(data) {
if (data.code === 400) {
$passwordTip.removeClass('hide').children('em').text(data.message);
$password.addClass('error');
return;
} else {
location.href = data.data.href;
}
},
complete: function() {
authing = false;
}
});
}
});
});
... ...
This diff could not be displayed because it is too large.
... ... @@ -538,18 +538,19 @@ exports.init = function(page) {
var time = 0,
t,
refer = data.href;
refer;
if (data.code === 200) {
refer = data.data.href;
t = setTimeout(function() {
time++;
}, 1000);
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
data: {
session: data.session
}
type: 'GET',
url: data.data.session
}).then(function(data) {
if (data.code === 200 && t < 3) {
... ... @@ -562,6 +563,11 @@ exports.init = function(page) {
clearInterval(t);
location.href = refer;
}
} else {
//todo
console.log('网络超时~');
}
});
}
... ...
... ... @@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction
'actionUrl' => Helpers::url('/autouserinfo/bind'),
'region' => RegData::getAreasData(),
'location' => '+86',
'captchaUrl' => '/passport/images?t=1449799445',
'captchaUrl' => Helpers::url('/passport/images?t=' . time()),
'itemUrl' => Helpers::url('/help/?category_id=9'),
'referUrl' => $refer,
'skipUrl' => SITE_MAIN,
... ... @@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction
public function userInfoAction()
{
//获取用户
$uid = $this->getUid(true);
$uid = $this->getUid(false);
$nickname = $this->get('nickname');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
... ... @@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$phoneNum = trim($this->post('mobile'));
$openId = trim($this->post('openId'));
$areaCode = trim($this->post('areaCode', '86'));
$areaCode = trim($this->post('area', '86'));
$sourceType = trim($this->post('sourceType'));
... ... @@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$verifyCode = trim($this->post('verifyCode'));
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//检测验证码不正确
if (!PassportModel::verifyCode($verifyCode)) {
$data['code'] = 402;
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
... ... @@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction
/*
* 校验图形验证码
*/
public function checkPicCodeAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
... ... @@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction
if (!$this->isAjax()) {
break;
}
$verifyCode = $phoneNum = trim($this->post('verifyCode'));
$verifyCode = trim($this->post('verifyCode'));
$picFlag = PassportModel::verifyCode($verifyCode);
if ($picFlag) {
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
... ... @@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
... ... @@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode', '86'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area', '86'));
$openId = trim($this->post('openId'));
$sourceType = trim($this->post('sourceType'));
$code = trim($this->post('code')); //短信验证码
... ...
... ... @@ -73,15 +73,40 @@ class RegisterController extends WebAction
}
/**
* 校验并发送验证码
* 校验图形验证码
*
* @return json
*/
public function piccaptchaAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$verifyCode = trim($this->post('verifyCode'));
$picFlag = PassportModel::verifyCode($verifyCode);
if ($picFlag) {
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
}
else {
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
}
}
while (false);
$this->echoJson($data);
}
/**
* 发送短信验证码
*/
public function sendBindMsgAction(){
$mobile = trim($this->post('mobile'), ' ');
$area = intval(trim($this->post('area'), ' '));
$verifyCode = strtolower(trim($this->post('code'),' '));
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));
$data = array('code' => 400, 'message' => '', 'data' => '');
do
{
... ... @@ -91,13 +116,14 @@ class RegisterController extends WebAction
}
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
$code = 400;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//检测验证码不正确
if(!PassportModel::verifyCode($verifyCode)) {
$data['message'] = '验证码不正确';
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
//发送代码
... ... @@ -119,7 +145,32 @@ class RegisterController extends WebAction
public function msgcaptchaAction()
{
$this->echoJson(array('code'=>200));
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['message'] = '手机号码格式不正确';
break;
}
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
if (!isset($data['code'])) {
break;
}
}
while (false);
$this->echoJson($data);
}
/**
... ... @@ -130,7 +181,7 @@ class RegisterController extends WebAction
{
$mobile = trim($this->post('mobile'), ' ');//mobile
$area = intval(trim($this->post('area'), ' '));//area
$verifyCode = strtolower(trim($this->post('captcha'),' '));//captcha
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));//图形验证码
$code = trim($this->post('code'),'');//code
$password = $this->post('password');
$url = '/passport/register/index';
... ... @@ -156,18 +207,18 @@ class RegisterController extends WebAction
$data['message'] = '密码不正确';
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code']) || $data['code'] != 200) {
$data['message'] = '验证码错误';
break;
}
$effective_time = $this->getSession('effective_time');
if($effective_time < time() || empty($effective_time))
{
$data['message'] = '注册超时';
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code']) || $data['code'] != 200) {
$data['message'] = '验证码错误';
break;
}
/*手机注册*/
$data = RegData::regMobile($area, $mobile, $password);
if (!isset($data['code']) || $data['code'] != 200) {
... ...
... ... @@ -13,13 +13,15 @@ class SaleController extends WebAction
public function indexAction()
{
//获取专区ID
$specialsaleId = $this->param('specialsaleId');
$specialsaleId = $this->get('specialsale_id');
$specialInfo = SaleData::getSpecial($specialsaleId);
if(isset($specialInfo['data'])) {
$special = $specialInfo['data'];
} else {
$special = array();
}
//获取促销ID
$promotion = $this->param('promotion');
$promotion = $this->get('promotion');
//专区ID和促销ID都为空时,跳转到主页
if (empty($specialsaleId) && empty($promotion)) {
$this->go(SITE_MAIN);
... ...