Authored by xuqi

Merge branch 'master' of http://git.dev.yoho.cn/web/yohobuywap

Showing 36 changed files with 325 additions and 7 deletions
var $tip, tipItime;
var $tip, tipItime, uid;
/* 领指定券 */
var activityId = $('#coupon-container').attr('param');
var userIsLogged = $('#coupon-container').attr('isLogged') === 'Y';
var isApp;
function GetQueryString(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null)return unescape(r[2]); return null;
}
$('.get-coupon').click(function () {
var couponId = $(this).attr('param');
isApp = $(this).attr('href') !== 'javascript:;';
isApp = GetQueryString('app_version');
if (isApp) {
uid = GetQueryString('uid');
}
if (!isNaN(activityId) && !isNaN(couponId)) {
getNamedCoupon(activityId, couponId, isApp, userIsLogged);
}
});
/* 领所有券 */
$('#get-all-coupon').click(function () {
var isApp = $(this).attr('href') !== 'javascript:;';
isApp = GetQueryString('app_version');
getAllCoupon(activityId, isApp);
});
... ... @@ -201,16 +213,14 @@ function getNamedCoupon(activityId, couponId, isApp, userIsLogged)
{
$.ajax({
type: 'POST',
url: '/cuxiao/coupon/getnamed',
url: isApp && uid ? '/cuxiao/coupon/getnamed?uid=' + uid : '/cuxiao/coupon/getnamed',
data: 'activityId=' + activityId + '&couponId=' + couponId,
success: function (data) {
setCookie('_Coupon' + activityId, null, {
expires: -2,
domain: '.m.yohobuy.com'
});
if (isApp && !userIsLogged) {
return;
}
if (data.code == 200) {
showTip('恭喜您成功领取优惠券!<br><br>稍后即会到账,请耐心等待。');
}
... ... @@ -224,6 +234,14 @@ function getNamedCoupon(activityId, couponId, isApp, userIsLogged)
});
if (isApp) {
//showTip('请先登录!');
//跳app登陆页面
if ($('.go-login').length <= 0) {
var href = location.href.split('?')[0];
var loginUrl = href + '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + href.replace(/\//g, '\\/') + '","param":{}},"requesturl":{"url":""},"priority":"N"}}';
console.log(loginUrl);
$('body').append('<a href=\'' + loginUrl + '\' ><span class="go-login"></span></a>');
}
$('.go-login').click();
} else {
location.href = decodeURIComponent(data.data);
}
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{staticTitle}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<style>
*{margin: 0;padding: 0;}
#coupon-container {width: 100%;}
#coupon-container img {width: 100%; height: auto; display: block;overflow: hidden;}
.img-box {width: 100%;position: relative;}
.img-box .href {width: 50%; height: 100%;position: absolute;top: 0;}
.img-box .href-left {left: 0}
.img-box .href-right {right: 0}
.img-box .href-center {width: 90%;height: 100%;position: absolute;top: 0;left: 5%;}
.show-more {height: 100%;width: 25%;position: absolute;top: 0;right: 10%;}
.yoho-tip {position: fixed;display: none;text-align: center;width: 70%;padding: 34px 0;top: 50%;left: 50%;margin-left: -35%;margin-top: -45px;background-color: #000;opacity: 0.9;color: #fff;font-size: 18px;border: none;border-radius: 10px;}
</style>
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
</head>
<body>
<div id="coupon-container" param="{{activityId}}" isLogged="{{isLogged}}">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/01.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/02.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/03.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/04.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/05.jpg">
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/06.jpg">
<a class="href href-center" href="{{url_mycoupon}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/07.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/08.jpg">
<a class="href href-left" href="{{url_more}}"></a>
<a class="href href-right" href="{{url_more}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/09.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12345"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12346"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/10.jpg">
<a class="href href-left" href="{{url_more}}"></a>
<a class="href href-right" href="{{url_more}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/11.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12347"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12348"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/12.jpg">
<a class="href href-left" href="{{url_1}}"></a>
<a class="href href-right" href="{{url_2}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/13.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12349"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12350"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/14.jpg">
<a class="href href-left" href="{{url_3}}"></a>
<a class="href href-right" href="{{url_4}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/15.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12351"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12352"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/16.jpg">
<a class="href href-left" href="{{url_5}}"></a>
<a class="href href-right" href="{{url_6}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/17.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12353"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="12354"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/add1.jpg">
<a class="href href-left" href="{{url_7}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/add2.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="12355"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-2.jpg">
<a class="show-more" href="{{url_help}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-3.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-3.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/26.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/27.jpg">
</div>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/jquery.min.js"></script>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/newuser/coupon2.js"></script>
</body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{{staticTitle}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<style>
*{margin: 0;padding: 0;}
#coupon-container {width: 100%;}
#coupon-container img {width: 100%; height: auto; display: block;overflow: hidden;}
.img-box {width: 100%;position: relative;}
.img-box .href {width: 50%; height: 100%;position: absolute;top: 0;}
.img-box .href-left {left: 0}
.img-box .href-right {right: 0}
.img-box .href-center {width: 90%;height: 100%;position: absolute;top: 0;left: 5%;}
.show-more {height: 100%;width: 25%;position: absolute;top: 0;right: 10%;}
.yoho-tip {position: fixed;display: none;text-align: center;width: 70%;padding: 34px 0;top: 50%;left: 50%;margin-left: -35%;margin-top: -45px;background-color: #000;opacity: 0.9;color: #fff;font-size: 18px;border: none;border-radius: 10px;}
</style>
<link rel="dns-prefetch" href="//cdn.yoho.cn">
<link rel="dns-prefetch" href="//static.yohobuy.com">
</head>
<body>
<div id="coupon-container" param="{{activityId}}" isLogged="{{isLogged}}">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/01.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/02.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/03.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/04.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/05.jpg">
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/06.jpg">
<a class="href href-center" href="{{url_mycoupon}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/07.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/08.jpg">
<a class="href href-left" href="{{url_more}}"></a>
<a class="href href-right" href="{{url_more}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/09.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22546"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="22542"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/10.jpg">
<a class="href href-left" href="{{url_more}}"></a>
<a class="href href-right" href="{{url_more}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/11.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22544"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="22548"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/12.jpg">
<a class="href href-left" href="{{url_1}}"></a>
<a class="href href-right" href="{{url_2}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/13.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22550"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="22552"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/14.jpg">
<a class="href href-left" href="{{url_3}}"></a>
<a class="href href-right" href="{{url_4}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/15.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22554"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="22556"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/16.jpg">
<a class="href href-left" href="{{url_5}}"></a>
<a class="href href-right" href="{{url_6}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/17.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22558"></span>
<span class="href href-right get-coupon" href="{{jumpUrl}}" param="22560"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/add1.jpg">
<a class="href href-left" href="{{url_7}}"></a>
</div>
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/add2.jpg">
<span class="href href-left get-coupon" href="{{jumpUrl}}" param="22562"></span>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-1.jpg">
<div class="img-box">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-2.jpg">
<a class="show-more" href="{{url_help}}"></a>
</div>
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/24-3.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/line-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-1.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-2.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/25-3.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/26.jpg">
<img src="{{jsUrl}}/cuxiao/img/newuser/160512/27.jpg">
</div>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/jquery.min.js"></script>
<script type="text/javascript" src="{{jsUrl}}/cuxiao/js/newuser/coupon2.js"></script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -680,6 +680,7 @@ class CouponController extends HuodongAction
/**
* 新客领券(第5波)2016年4月26号上线
*/
/*
public function newuser5Action()
{
// 判断是否是应用访问, 拼接APP需要的URL参数
... ... @@ -727,8 +728,58 @@ class CouponController extends HuodongAction
'url_6' => 'http://list.m.yohobuy.com/?msort=10&openby:yohobuy={"action":"go.list","params":{"msort":"10","title":"创意生活"}}'
));
}
*/
/**
* 新客领券(第6波)2016年5月13号上线
*/
public function newuser5Action()
{
// 判断是否是应用访问, 拼接APP需要的URL参数
$isApp = null !== $this->get('app_version');
$isAppLogged = true;
if ($isApp) {
$isLogged = $this->get('uid') !== null;
$isAppLogged = $this->checkIsLogin();
} else {
$isLogged = $this->getUid();
}
$urlNewuser = Helpers::url('/cuxiao/coupon/newuser5');
$urlYohope = Helpers::url('/cuxiao/coupon/yohope');
$urlHelp = Helpers::url('/cuxiao/coupon/help');
$urlMycoupon = Helpers::url('/home/coupons', null, 'default');
$urlEncode = strtr($urlNewuser, array('/' => '\\/'));
$channel = $this->get('yh_channel', '1');
switch (strval($channel)) {
case '1':
$gender = '1,3';
break;
case '2':
$gender = '2,3';
break;
default:
$gender = '1,2,3';
}
$url = Helpers::url('/boys', array(), 'default') . '?openby:yohobuy={"action":"go.home","params":{"gender":"' . $gender . '","channel":"' . $channel . '"}}';
$this->_view->display('newuser6', array(
'activityId' => 604,//627
'staticTitle' => '新人潮这看,超值惊喜等你领', // 标题
'jumpUrl' => $isAppLogged ? 'javascript:;' : $urlNewuser . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $urlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}',
'isLogged' => $isLogged ? 'Y' : 'N', // 标识是否登录
'url_mycoupon' => $urlMycoupon . '?openby:yohobuy={"action":"go.coupon"}',
'url_yohope' => $urlYohope . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlYohope . '","param":{}}}',
'url_help' => $urlHelp . '?yohobuy={"action":"go.h5","params":{"islogin":"Y","type":0,"url":"' . $urlHelp . '","param":{}}}',
'url_more' => $url,
'url_1' => 'http://list.m.yohobuy.com/?msort=1&misort=18,20,21,22,172,226&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"18,20,21,22,172,226","title":"外套"}}',
'url_2' => 'http://list.m.yohobuy.com/?msort=1&misort=12,16,257&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"12,16,257","title":"春装"}}',
'url_3' => 'http://list.m.yohobuy.com/?gender=2,3&msort=4&misort=31,32&openby:yohobuy={"action":"go.list","params":{"msort":"4","misort":"31,32","gender":"2,3","title":"裙装"}}',
'url_4' => 'http://list.m.yohobuy.com/?msort=3&misort=26,27,28&openby:yohobuy={"action":"go.list","params":{"msort":"3","misort":"26,27,28","title":"裤装"}}',
'url_5' => 'http://list.m.yohobuy.com/?msort=7,8&openby:yohobuy={"action":"go.list","params":{"msort":"7,8","title":"包配"}}',
'url_6' => 'http://list.m.yohobuy.com/?msort=10&openby:yohobuy={"action":"go.list","params":{"msort":"10","title":"创意生活"}}',
'url_7' => 'http://list.m.yohobuy.com/?msort=1&misort=12&openby:yohobuy={"action":"go.list","params":{"msort":"1","misort":"12","title":"衬衫"}}',
));
}
/**
* 新客领券YOHOPE
... ... @@ -913,9 +964,14 @@ class CouponController extends HuodongAction
/* 判断用户是否登录 */
$uid = $this->getSession(self::SESSION_UID);
if (!$uid) {
$uid = $this->getUid();
if (!$uid) {
$uid = $this->get('uid'); // session 获取不到 UID,直接获取查询字符串的 uid, 严重问题,不安全,需要修复
}
if (empty($uid)) {
$result['code'] = 400;
$result['message'] = '请先登录';
$result['data'] = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/')), 'default');
... ...