|
|
<?php
|
|
|
|
|
|
use Action\HuodongAction;
|
|
|
use Index\UserModel;
|
|
|
use Plugin\Helpers;
|
|
|
use LibModels\Wap\Cuxiao\ActivityData;
|
|
|
use Api\Yohobuy;
|
|
|
|
|
|
/**
|
|
|
* 元宵抽签活动
|
...
|
...
|
@@ -15,8 +14,68 @@ class YuanxiaoController extends HuodongAction |
|
|
*/
|
|
|
public function indexAction()
|
|
|
{
|
|
|
$this->_view->display('index', array(
|
|
|
'staticTitle' => '元宵抽签'
|
|
|
//获取登录者ID,未登录返回false
|
|
|
$uid = $this->getLoggedUid();
|
|
|
if (!$uid || !is_numeric($uid)) {
|
|
|
//未登录的用户访问,跳转到登录页面。并且在登陆后跳转回本页面
|
|
|
$this->go(Helpers::url('/signin.html', array('refer' => Helpers::url('/cuxiao/newyear/coupon')), 'default'));
|
|
|
}
|
|
|
|
|
|
// 该变量用来控制和显示页面的弹出提示
|
|
|
$showPopupFlag = '0';
|
|
|
|
|
|
$userData = UserModel::getUserProfileData($uid);
|
|
|
|
|
|
$result = array();
|
|
|
if (isset($result['code'])) {
|
|
|
switch (intval($result['code'])) {
|
|
|
case 200: // 领取成功, 发送站内信消息
|
|
|
$showPopupFlag = '0';
|
|
|
$this->sendMessage($uid, '【优惠券】您有1000元套券', '尊敬的客户:恭喜您成功获得1000元套券 !您可以在个人中心的交易管理中查看‘我的优惠券’。');
|
|
|
break;
|
|
|
case 201: // 已领取过, 提示重复领券
|
|
|
$showPopupFlag = '1';
|
|
|
break;
|
|
|
default: // 领取失败, 提示领券失败
|
|
|
$showPopupFlag = '2';
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$this->_view->display('coupon', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货新年寻宝大作战',
|
|
|
'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享
|
|
|
'shareLink' => 'http://feature.yoho.cn/2016lishifeng/index.html',
|
|
|
'shareTitle' => 'YOHO!BUY有货新年寻宝大作战,千元利是等你赢!',
|
|
|
'shareDesc' => 'YOHO!BUY有货,全球800+潮流品牌每日上新!',
|
|
|
'shareImg' => 'http://img12.static.yhbimg.com/couponImg/2015/12/30/12/02008a9724b898dee56852de9f1a3978bf.jpg',
|
|
|
'showPopupFlag' => $showPopupFlag,
|
|
|
'useData' => $userData,
|
|
|
'bannerUrl_1' => 'http://m.yohobuy.com/boys?openby:yohobuy={"action":"go.home","params":{"channel":"1"}}',
|
|
|
'bannerUrl_2' => 'http://m.yohobuy.com/girls?openby:yohobuy={"action":"go.home","params":{"channel":"2"}}',
|
|
|
'bannerUrl_3' => 'http://m.yohobuy.com/kids?openby:yohobuy={"action":"go.home","params":{"channel":"3"}}',
|
|
|
'bannerUrl_4' => 'http://m.yohobuy.com/lifestyle?openby:yohobuy={"action":"go.home","params":{"channel":"4"}}',
|
|
|
'playAgain' => 'http://feature.yoho.cn/2016lishifeng/index.html',
|
|
|
'appUrl_1' => 'http://www.yohoshow.com/about/index/yohobuyqr',
|
|
|
'appUrl_2' => 'http://www.yohoshow.com/about/index/yohoboysqr',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检测登录状态
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getLoggedUid()
|
|
|
{
|
|
|
// 判断是否是应用访问, 拼接APP需要的URL参数
|
|
|
$this->_isApp = (null !== $this->get('app_version') || null !== $this->get('uid'));
|
|
|
if ($this->_isApp) {
|
|
|
$uid = $this->get('uid');
|
|
|
} else {
|
|
|
$uid = $this->getUid();
|
|
|
}
|
|
|
|
|
|
return $uid;
|
|
|
}
|
|
|
} |
...
|
...
|
|