Authored by Rock Zhang

Merge branch 'feature/wap/girlsday' into develop/wap

@@ -12,6 +12,14 @@ @@ -12,6 +12,14 @@
12 </div> 12 </div>
13 {{/if}} 13 {{/if}}
14 14
  15 +{{#if offShelveGoods}}
  16 + <div class="invalid-goods">
  17 + {{# offShelveGoods}}
  18 + {{> cart/good}}
  19 + {{/ offShelveGoods}}
  20 + </div>
  21 +{{/if}}
  22 +
15 {{#if freebieOrAdvanceBuy}} 23 {{#if freebieOrAdvanceBuy}}
16 <ul class="freebie-and-advance-buy"> 24 <ul class="freebie-and-advance-buy">
17 {{#if freebie}} 25 {{#if freebie}}
  1 +<?php
  2 +
  3 +namespace Cuxiao;
  4 +use LibModels\Wap\Cuxiao\ActivityData;
  5 +
  6 +/**
  7 + * Created by PhpStorm.
  8 + * User: DELL
  9 + * Date: 2016/2/25
  10 + * Time: 15:11
  11 + *
  12 + * @name XinshiliModel
  13 + * @package models/Cuxiao
  14 + * @author Gtskk(tttt6399998@126.com)
  15 + */
  16 +class XinshiliModel
  17 +{
  18 + /**
  19 + * 获取领券活动结果
  20 + *
  21 + * @param int $uid 用户id
  22 + * @param int $actId 活动id
  23 + * @return array
  24 + */
  25 + public static function getXinshiliCoupon($uid, $actId)
  26 + {
  27 + $result = array('code' => 201);
  28 +
  29 + do {
  30 + if (empty($uid) || empty($actId)) {
  31 + break;
  32 + }
  33 +
  34 + $result = ActivityData::getCouponAll($uid, $actId);
  35 + if (!$result) {
  36 + $result = array('code' => 201);
  37 + break;
  38 + }
  39 +
  40 + if (intval($result['code']) === 200) {
  41 + self::sendMessage($uid, '【优惠券】您有4张春潮新势力优惠券', '尊敬的客户:恭喜您成功获得4张春潮新势力优惠券 !您可以在个人中心查看优惠券详情。');
  42 + }
  43 + } while (false);
  44 +
  45 + return $result;
  46 + }
  47 +
  48 + /**
  49 + * 发送站内信
  50 + *
  51 + * @param int $uid 用户ID
  52 + * @param string $title 站内信标题
  53 + * @param string $content 站内信内容
  54 + */
  55 + private static function sendMessage($uid, $title, $content)
  56 + {
  57 + try {
  58 + ActivityData::message($uid, $title, $content);
  59 + } catch (Exception $e) {
  60 + // do nothing
  61 + }
  62 + }
  63 +}
1 <?php 1 <?php
2 2
3 use Action\HuodongAction; 3 use Action\HuodongAction;
  4 +use Cuxiao\XinshiliModel;
4 use Plugin\Helpers; 5 use Plugin\Helpers;
5 6
6 /** 7 /**
7 - * 元宵抽签活动 8 + * 新势力领券活动
8 */ 9 */
9 class XinshiliController extends HuodongAction 10 class XinshiliController extends HuodongAction
10 { 11 {
11 - // const STATIC_FILE = 'http://localhost:2222/1.0.1';  
12 - const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili/1.0.1'; 12 + // const STATIC_FILE = 'http://localhost:2222/1.0.2';
  13 + const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016xinshili/1.0.2';
  14 +
13 15
14 /** 16 /**
15 - * 元宵抽签 17 + * 检测登录状态
  18 + *
  19 + * @return int
  20 + */
  21 + private function getLoggedUid()
  22 + {
  23 + if ($this->_isApp) {
  24 + $uid = $this->get('uid');
  25 + } else {
  26 + $uid = $this->getUid();
  27 + }
  28 +
  29 + return $uid;
  30 + }
  31 +
  32 + /**
  33 + * 判断是否登陆
  34 + */
  35 + private function checkLogin()
  36 + {
  37 + $playUrl = Helpers::url('/cuxiao/xinshili/index');
  38 +
  39 + $uid = $this->getLoggedUid();
  40 + if (!$uid) {
  41 + if (!$this->_isApp) {
  42 + $this->go(Helpers::url('/signin.html', array('refer' => $playUrl), 'default'));
  43 + } else {
  44 + $playUrlEncode = strtr($playUrl, array('/' => '\\/'));
  45 + $this->go($playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}');
  46 + }
  47 + }
  48 + }
  49 +
  50 + /**
  51 + * 领券活动页面控制器
16 */ 52 */
17 public function indexAction() 53 public function indexAction()
18 { 54 {
  55 + $this->checkLogin();
  56 +
  57 + //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作
  58 + $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}';
  59 +
19 $this->_view->display('index', array( 60 $this->_view->display('index', array(
20 - 'staticTitle' => '新势力', 61 + 'staticTitle' => 'YOHO!BUY有货【春潮新势力】',
21 'staticFile' => self::STATIC_FILE, 62 'staticFile' => self::STATIC_FILE,
22 'staticJS' => array( 63 'staticJS' => array(
23 'home.js' 64 'home.js'
24 ), 65 ),
25 - 'couponUrl' => '', // 个人中心优惠券地址 66 + 'couponUrl' => $myCouponUrl, // 个人中心优惠券地址
26 'banner' => array( 67 'banner' => array(
27 'img' => '', 68 'img' => '',
28 - 'url' => '' 69 + 'url' => 'http://feature.yoho.cn/0302/0302APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】","url":"http://feature.yoho.cn/0302/0302APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"386"},"param":{"share_id":"386"}}'
29 ), 70 ),
30 - 'weixinUrl' => '', // 微信关注地址  
31 - 'appUrl' => '', // APP 下载地址  
32 - 'shareTitle' => '新势力',  
33 - 'shareDesc' => '新势力领券', 71 + 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址
  72 + 'appUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr', // APP 下载地址
  73 + 'shareTitle' => 'YOHO!BUY有货【春潮新势力】火力全开!350元优惠券限时派送中',
  74 + 'shareDesc' => 'Wake up!Boys & Girls!一起来YOHO!玩潮流!',
34 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/02/19/16/02dbd38c84eccf1097b7e240452f0de856.png', 75 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/02/19/16/02dbd38c84eccf1097b7e240452f0de856.png',
35 - 'shareLink' => Helpers::url('/cuxiao/yuanxiao/index') 76 + 'shareLink' => Helpers::url('/cuxiao/xinshili/index')
36 )); 77 ));
37 } 78 }
38 79
  80 + /**
  81 + * 领券接口
  82 + */
  83 + public function sendCouponAction()
  84 + {
  85 + $result = array('code' => 201);
  86 +
  87 + do {
  88 + if (!$this->isAjax()) {
  89 + break;
  90 + }
  91 +
  92 + $activityId = $this->getActivityId();
  93 + $uid = $this->getLoggedUid();
  94 + $result = XinshiliModel::getXinshiliCoupon($uid, $activityId);
  95 + } while (false);
  96 +
  97 + $this->echoJson($result);
  98 + }
  99 +
  100 + /**
  101 + * 根据环境来获取活动ID
  102 + *
  103 + * @return int
  104 + */
  105 + private function getActivityId()
  106 + {
  107 + // 设置环境变量
  108 + switch (APPLICATION_ENV) {
  109 + case 'production': // 生产
  110 + return 506;
  111 + case 'preview': // 预览
  112 + case 'testing': // 测试
  113 + case 'develop': // 开发
  114 + default:
  115 + return 488;
  116 + }
  117 + }
  118 +
39 } 119 }
  1 +[memcached]
  2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  5 +
  6 +[redis]
  7 +servers.hosts=127.0.0.1:6379
1 [memcached] 1 [memcached]
2 -master.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111  
3 -slave.hosts=192.168.166.16:12112,192.168.166.17:12112,192.168.166.18:12112  
4 -session.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111 2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
5 5
6 [redis] 6 [redis]
7 servers.hosts=127.0.0.1:6379 7 servers.hosts=127.0.0.1:6379
@@ -78,6 +78,8 @@ class Bootstrap extends Bootstrap_Abstract @@ -78,6 +78,8 @@ class Bootstrap extends Bootstrap_Abstract
78 case 'm': // 老版(到频道选择) 78 case 'm': // 老版(到频道选择)
79 case 'buy': // 测试环境的域名, 以后可去掉 79 case 'buy': // 测试环境的域名, 以后可去掉
80 case 'login': // 登录 80 case 'login': // 登录
  81 + case 'm20160224': // AWS TEST
  82 + case 'login20160224': // AWS TEST
81 break; 83 break;
82 case 'new': // 原新版(到男生首页) 84 case 'new': // 原新版(到男生首页)
83 $controller = 'Boys'; 85 $controller = 'Boys';
@@ -773,7 +773,7 @@ class CartModel @@ -773,7 +773,7 @@ class CartModel
773 773
774 do { 774 do {
775 // 数据为空时返回空的标志 775 // 数据为空时返回空的标志
776 - if (empty($data['goods_list']) && empty($data['sold_out_goods_list'])) { 776 + if (empty($data['goods_list']) && empty($data['sold_out_goods_list']) && empty($data['off_shelves_goods_list'])) {
777 break; 777 break;
778 } 778 }
779 779
@@ -800,6 +800,12 @@ class CartModel @@ -800,6 +800,12 @@ class CartModel
800 $result['notValidGoods'] = $notValidGoods; 800 $result['notValidGoods'] = $notValidGoods;
801 } 801 }
802 802
  803 + // 下架的商品列表
  804 + $offShelveGoods = Helpers::formatCartGoods($data['off_shelves_goods_list'], $isAdvanceCart, false);
  805 + if (!empty($offShelveGoods)) {
  806 + $result['offShelveGoods'] = $offShelveGoods;
  807 + }
  808 +
803 // 赠品和加价购商品 809 // 赠品和加价购商品
804 if (count($data['gift_list']) || count($data['price_gift'])) { 810 if (count($data['gift_list']) || count($data['price_gift'])) {
805 $result['freebieOrAdvanceBuy'] = true; 811 $result['freebieOrAdvanceBuy'] = true;
@@ -195,7 +195,7 @@ class DetailModel @@ -195,7 +195,7 @@ class DetailModel
195 195
196 // 商品的尺码列表 196 // 商品的尺码列表
197 $colorStorageGroup[ $value['productSkc'] ] = array(); 197 $colorStorageGroup[ $value['productSkc'] ] = array();
198 - if (isset($value['goodsSizeBoList'])) { 198 + if (isset($value['goodsSizeBoList']) && !empty($value['goodsSizeBoList'])) {
199 $sizeName = ''; 199 $sizeName = '';
200 foreach ($value['goodsSizeBoList'] as $size) { 200 foreach ($value['goodsSizeBoList'] as $size) {
201 $sizeList[ $value['productSkc'] ][] = array( 201 $sizeList[ $value['productSkc'] ][] = array(
  1 +[memcached]
  2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  5 +
  6 +[redis]
  7 +servers.hosts=127.0.0.1:6379
1 [memcached] 1 [memcached]
2 -master.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111  
3 -slave.hosts=192.168.166.16:12112,192.168.166.17:12112,192.168.166.18:12112  
4 -session.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111 2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
5 5
6 [redis] 6 [redis]
7 servers.hosts=127.0.0.1:6379 7 servers.hosts=127.0.0.1:6379
  1 +<?php
  2 +
  3 +use Yaf\Application;
  4 +
  5 +define('SITE_MAIN', 'http://m.yohobuy.com'); // 网站主域名
  6 +define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
  7 +define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
  8 +define('SUB_DOMAIN', '.m.yohobuy.com'); // 子域名后缀
  9 +define('USE_CACHE', true); // 缓存的开关
  10 +define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
  11 +define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
  12 +defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
  13 +
  14 +$application = new Application(APPLICATION_PATH . '/configs/application.production.ini');
  15 +$application->bootstrap()->run();
@@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
2 2
3 use Yaf\Application; 3 use Yaf\Application;
4 4
5 -define('SITE_MAIN', 'http://m.yohobuy.com'); // 网站主域名 5 +define('SITE_MAIN', 'http://m20160224.yohobuy.com'); // 网站主域名
6 define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名 6 define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
7 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域 7 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
8 -define('SUB_DOMAIN', '.m.yohobuy.com'); // 子域名后缀 8 +define('SUB_DOMAIN', '.m20160224.yohobuy.com'); // 子域名后缀
9 define('USE_CACHE', true); // 缓存的开关 9 define('USE_CACHE', true); // 缓存的开关
10 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录 10 define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
11 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录 11 define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
  1 +5m7GaQanwdmT2Bw7/iBKqZlYr+yKphtGeMh7y7Oro+4=
@@ -78,6 +78,8 @@ class Bootstrap extends Bootstrap_Abstract @@ -78,6 +78,8 @@ class Bootstrap extends Bootstrap_Abstract
78 case 'new': // 原新版 78 case 'new': // 原新版
79 case 'dev': // 开发环境 79 case 'dev': // 开发环境
80 case 'web': 80 case 'web':
  81 + case 'www20160224': // AWS TEST
  82 + case 'new20160224': // AWS TEST
81 break; 83 break;
82 case 'search': // 搜索 84 case 'search': // 搜索
83 $module = 'Product'; 85 $module = 'Product';
  1 +[memcached]
  2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  5 +
  6 +[redis]
  7 +servers.hosts=127.0.0.1:6379
1 [memcached] 1 [memcached]
2 -master.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111  
3 -slave.hosts=192.168.166.16:12112,192.168.166.17:12112,192.168.166.18:12112  
4 -session.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111 2 +master.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
  3 +slave.hosts=172.31.22.1:12112,172.31.20.56:12112,172.31.31.146:12112
  4 +session.hosts=172.31.22.1:12111,172.31.20.56:12111,172.31.31.146:12111
5 5
6 [redis] 6 [redis]
7 servers.hosts=127.0.0.1:6379 7 servers.hosts=127.0.0.1:6379
  1 +[memcached]
  2 +master.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111
  3 +slave.hosts=192.168.166.16:12112,192.168.166.17:12112,192.168.166.18:12112
  4 +session.hosts=192.168.166.16:12111,192.168.166.17:12111,192.168.166.18:12111
  5 +
  6 +[redis]
  7 +servers.hosts=127.0.0.1:6379
  1 +<?php
  2 +use Yaf\Application;
  3 +
  4 +define('SITE_MAIN', 'http://www.yohobuy.com'); // 网站主域名
  5 +define('OLD_MAIN', 'http://www.yohobuy.com'); // 网站旧域名
  6 +define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
  7 +define('SUB_DOMAIN', '.yohobuy.com'); // 子域名后缀
  8 +define('USE_CACHE', true); // 缓存的开关
  9 +define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
  10 +define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
  11 +defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
  12 +
  13 +$application = new Application(APPLICATION_PATH . '/configs/application.production.ini');
  14 +$application->bootstrap()->run();
1 <?php 1 <?php
2 use Yaf\Application; 2 use Yaf\Application;
3 3
4 -define('SITE_MAIN', 'http://www.yohobuy.com'); // 网站主域名 4 +define('SITE_MAIN', 'http://www20160224.yohobuy.com'); // 网站主域名
5 define('OLD_MAIN', 'http://www.yohobuy.com'); // 网站旧域名 5 define('OLD_MAIN', 'http://www.yohobuy.com'); // 网站旧域名
6 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域 6 define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
7 define('SUB_DOMAIN', '.yohobuy.com'); // 子域名后缀 7 define('SUB_DOMAIN', '.yohobuy.com'); // 子域名后缀