|
|
<?php
|
|
|
|
|
|
/**
|
|
|
* Created by PhpStorm.
|
|
|
* User: Administrator
|
...
|
...
|
@@ -8,61 +9,121 @@ |
|
|
use Action\HuodongWebAction;
|
|
|
use Cuxiao\GirldayModel;
|
|
|
use WebPlugin\Helpers;
|
|
|
use LibModels\Wap\Cuxiao\ActivityData;
|
|
|
use Plugin\Cache;
|
|
|
|
|
|
/**
|
|
|
* 女生节活动领券-第二波
|
|
|
* @author Administrator
|
|
|
*/
|
|
|
class GirldayController extends HuodongWebAction
|
|
|
{
|
|
|
// const STATIC_FILE = 'http://localhost:2222/1.0.3';
|
|
|
const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili-2-web/1.0.3';
|
|
|
const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili-2-web/1.0.2';
|
|
|
|
|
|
/**
|
|
|
* 检测登录状态
|
|
|
*
|
|
|
* @return int
|
|
|
* 第二波
|
|
|
*/
|
|
|
private function getLoggedUid()
|
|
|
public function indexAction()
|
|
|
{
|
|
|
if ($this->_isApp) {
|
|
|
$uid = $this->get('uid');
|
|
|
} else {
|
|
|
$uid = $this->getUid();
|
|
|
}
|
|
|
return $uid;
|
|
|
//echo
|
|
|
$this->checkLogin();
|
|
|
//获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
|
|
|
$myCouponUrl = Helpers::url('/home/coupons', null, 'default');
|
|
|
|
|
|
$this->_view->display('index', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】', // 标题
|
|
|
'staticFile' => self::STATIC_FILE,
|
|
|
'staticJS' => array(
|
|
|
'home.js'
|
|
|
),
|
|
|
'couponUrl' => $myCouponUrl, // 个人中心优惠券地址
|
|
|
'banner' => array(
|
|
|
'img' => '',
|
|
|
'url' => 'http://www.yohobuy.com/special_14548_0310PCHOME.html',
|
|
|
),
|
|
|
'selectUrl' => 'http://www.yohobuy.com/home/coupons',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断是否登录
|
|
|
* 领券活动-第三波页面控制器
|
|
|
*/
|
|
|
private function checkLogin()
|
|
|
public function girlthreeBoyAction()
|
|
|
{
|
|
|
$url = Helpers::url('/cuxiao/girlday/index');
|
|
|
$uid = $this->getLoggedUid();
|
|
|
if (!$uid) {
|
|
|
$this->go(Helpers::url('/signin.html', array('refer' => $url), 'default'));
|
|
|
}
|
|
|
$this->_view->display('girlsday-three', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
|
|
|
'staticJS' => array(
|
|
|
'main.js'
|
|
|
),
|
|
|
'jumpUrl' => 'javascript:;',
|
|
|
'pageType' => 'boy',
|
|
|
'tab' => array('us', 'bag', 'yohope', 'shoes'),
|
|
|
'isOnline' => $this->getisOnline(),
|
|
|
'shareTitle' => 'YOHO!BUY有货【春潮新势力】千万元优惠券限时派送中!',
|
|
|
'shareDesc' => '全球1000+潮牌春季上新,万款新品首发,唤醒潮流尽在有货【春潮新势力】!',
|
|
|
'shareLink' => 'http://feature.yoho.cn/0318/0318APPHOME/index.html',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 女生节第3波-女生的品牌领券
|
|
|
*/
|
|
|
public function girlthreeGirlAction()
|
|
|
{
|
|
|
$this->_view->display('girlsday-three', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
|
|
|
'staticJS' => array(
|
|
|
'main.js'
|
|
|
),
|
|
|
'jumpUrl' => 'javascript:;',
|
|
|
'pageType' => 'girl',
|
|
|
'tab' => array('us', 'huimei', 'sport', 'yohope'),
|
|
|
'isOnline' => $this->getisOnline(),
|
|
|
'shareTitle' => 'YOHO!BUY有货【春潮新势力】千万元优惠券限时派送中!',
|
|
|
'shareDesc' => '全球1000+潮牌春季上新,万款新品首发,唤醒潮流尽在有货【春潮新势力】!',
|
|
|
'shareLink' => 'http://feature.yoho.cn/0318/0318APPHOME/index.html',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据环境来获取活动ID
|
|
|
*
|
|
|
* @return int
|
|
|
* 女生节第3波-童品牌领券
|
|
|
*/
|
|
|
private function getActivityId()
|
|
|
public function girlthreeKidAction()
|
|
|
{
|
|
|
// 设置环境变量
|
|
|
switch (APPLICATION_ENV) {
|
|
|
case 'production': // 生产
|
|
|
return 528;
|
|
|
case 'preview': // 预览
|
|
|
case 'testing': // 测试
|
|
|
case 'develop': // 开发
|
|
|
default:
|
|
|
return 528; //490;
|
|
|
}
|
|
|
$this->_view->display('girlsday-three', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
|
|
|
'staticJS' => array(
|
|
|
'main.js'
|
|
|
),
|
|
|
'jumpUrl' => 'javascript:;',
|
|
|
'pageType' => 'kid',
|
|
|
// 'tab' => array('us', 'bag', 'yohope', 'shoes'),
|
|
|
'isOnline' => $this->getisOnline(),
|
|
|
'shareTitle' => 'YOHO!BUY有货【春潮新势力】千万元优惠券限时派送中!',
|
|
|
'shareDesc' => '全球1000+潮牌春季上新,万款新品首发,唤醒潮流尽在有货【春潮新势力】!',
|
|
|
'shareLink' => 'http://feature.yoho.cn/0318/0318APPHOME/index.html',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 女生节第3波-创意生活品牌领券
|
|
|
*/
|
|
|
public function girlthreeLifestyleAction()
|
|
|
{
|
|
|
$this->_view->display('girlsday-three', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
|
|
|
'staticJS' => array(
|
|
|
'main.js'
|
|
|
),
|
|
|
'jumpUrl' => 'javascript:;',
|
|
|
'pageType' => 'lifestyle',
|
|
|
'tab' => array('us', 'hot'),
|
|
|
'isOnline' => $this->getisOnline(),
|
|
|
'shareTitle' => 'YOHO!BUY有货【春潮新势力】千万元优惠券限时派送中!',
|
|
|
'shareDesc' => '全球1000+潮牌春季上新,万款新品首发,唤醒潮流尽在有货【春潮新势力】!',
|
|
|
'shareLink' => 'http://feature.yoho.cn/0318/0318APPHOME/index.html',
|
|
|
));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 领券接口
|
...
|
...
|
@@ -79,30 +140,156 @@ class GirldayController extends HuodongWebAction |
|
|
$activityId = $this->getActivityId();
|
|
|
$uid = $this->getLoggedUid();
|
|
|
$result = GirldayModel::getGirldayCoupon($uid, $activityId);
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
public function indexAction()
|
|
|
/**
|
|
|
* 领取指定的优惠券
|
|
|
*
|
|
|
* @param int activityId 活动ID
|
|
|
* @param int couponId 优惠券ID
|
|
|
* @return json
|
|
|
*/
|
|
|
public function getnamedAction()
|
|
|
{
|
|
|
$result = array('code' => 401, 'message' => '领取失败', 'data' => '');
|
|
|
|
|
|
$this->checkLogin();
|
|
|
//获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
|
|
|
$myCouponUrl = Helpers::url('/home/coupons', null, 'default');
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$this->_view->display('index', array(
|
|
|
'staticTitle' => 'YOHO!BUY有货【春潮新势力】', // 标题
|
|
|
'staticFile' => self::STATIC_FILE,
|
|
|
'staticJS' => array(
|
|
|
'home.js'
|
|
|
),
|
|
|
'couponUrl' => $myCouponUrl, // 个人中心优惠券地址
|
|
|
'banner' => array(
|
|
|
'img' => 'http://img02.yohoboys.com/staticimg/2016/03/10/10/020ea7cb1f9c2f26b14e08107f778485ff.jpg',
|
|
|
'url' => 'http://www.yohobuy.com/special_14548_0310PCHOME.html',
|
|
|
),
|
|
|
'selectUrl' => 'http://www.yohobuy.com/home/coupons',
|
|
|
));
|
|
|
/* 判断参数是否有效 */
|
|
|
$activityId = $this->getthreeActivityId();
|
|
|
$couponId = $this->post('couponId');
|
|
|
if (!is_numeric($activityId) || !is_numeric($couponId)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$uid = $this->getUid();
|
|
|
if (!$uid) {
|
|
|
$result['code'] = 400;
|
|
|
$result['message'] = '请先登录';
|
|
|
$result['data'] = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/')), 'default');
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 领取指定的优惠券操作 */
|
|
|
$result = ActivityData::getCouponNamed($uid, $activityId, $couponId);
|
|
|
if ($uid && isset($result['code']) && $result['code'] == 200) {
|
|
|
// 领取成功, 发送站内信消息
|
|
|
$couponuid = 'couponnvshengjiedisanbo' . $uid;
|
|
|
$status = Cache::get($couponuid);
|
|
|
if (!$status) {
|
|
|
$this->sendMessage($uid, '【优惠券】您已成功领取春潮新势力-品牌优惠券。', '尊敬的客户:恭喜您成功获得春潮新势力-品牌优惠券 !您可以在个人中心查看优惠券详情。');
|
|
|
Cache::set($couponuid, true, 3600 * 24 * 5);
|
|
|
}
|
|
|
}
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据环境来获取活动ID
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getActivityId()
|
|
|
{
|
|
|
// 设置环境变量
|
|
|
switch (APPLICATION_ENV) {
|
|
|
case 'production': // 生产
|
|
|
return 528;
|
|
|
case 'preview': // 预览
|
|
|
case 'testing': // 测试
|
|
|
case 'develop': // 开发
|
|
|
default:
|
|
|
return 540;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据环境来获取活动ID
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getthreeActivityId()
|
|
|
{
|
|
|
// 设置环境变量
|
|
|
switch (APPLICATION_ENV) {
|
|
|
case 'production': // 生产
|
|
|
return 544;
|
|
|
case 'preview': // 预览
|
|
|
case 'testing': // 测试
|
|
|
case 'develop': // 开发
|
|
|
default:
|
|
|
return 496;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送站内信
|
|
|
*
|
|
|
* @param int $uid 用户ID
|
|
|
*/
|
|
|
private function sendMessage($uid, $title, $content)
|
|
|
{
|
|
|
try {
|
|
|
ActivityData::message($uid, $title, $content);
|
|
|
} catch (Exception $e) {
|
|
|
// do nothing
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据环境来获取线上线下
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getisOnline()
|
|
|
{
|
|
|
// 设置环境变量
|
|
|
switch (APPLICATION_ENV) {
|
|
|
case 'production': // 生产
|
|
|
return 1;
|
|
|
case 'preview': // 预览
|
|
|
case 'testing': // 测试
|
|
|
case 'develop': // 开发
|
|
|
default:
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检测登录状态
|
|
|
*
|
|
|
* @return int
|
|
|
*/
|
|
|
private function getLoggedUid()
|
|
|
{
|
|
|
if ($this->_isApp) {
|
|
|
$uid = $this->get('uid');
|
|
|
} else {
|
|
|
$uid = $this->getUid();
|
|
|
}
|
|
|
return $uid;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断是否登录
|
|
|
*/
|
|
|
private function checkLogin()
|
|
|
{
|
|
|
$url = Helpers::url('/cuxiao/girlday/index');
|
|
|
$uid = $this->getLoggedUid();
|
|
|
if (!$uid) {
|
|
|
$this->go(Helpers::url('/signin.html', array('refer' => $url), 'default'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|