Merge branch 'develop/wap' into beta/wap
Showing
5 changed files
with
258 additions
and
14 deletions
1 | +{{> cuxiao/xinshili/header}} | ||
2 | + <div class="main-wrap home"> | ||
3 | + <div class="header"></div> | ||
4 | + <a class="coupon" href="{{couponUrl}}"></a> | ||
5 | + <div class="share"> | ||
6 | + 快去分享给小伙伴吧 <span class="arrow"></span> | ||
7 | + </div> | ||
8 | + <a class="banner" href="{{banner.url}}"> | ||
9 | + <img src="{{banner.img}}"> | ||
10 | + </a> | ||
11 | + {{#unless isApp}} | ||
12 | + <div class="download"> | ||
13 | + <a class="weixin" href="{{weixinUrl}}"> | ||
14 | + 关注有货微信 <span class="arrow"></span> | ||
15 | + </a> | ||
16 | + <a class="app" href="{{appUrl}}"> | ||
17 | + 下载YOHO!BUY有货APP <span class="arrow"></span> | ||
18 | + </a> | ||
19 | + </div> | ||
20 | + {{/unless}} | ||
21 | + <div class="footer"> | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + <div class="mask hide"> | ||
25 | + <div class="pengyouquan"> | ||
26 | + </div> | ||
27 | + <div class="arrow"> | ||
28 | + </div> | ||
29 | + <p> | ||
30 | + 点击右上角<br> | ||
31 | + 微信分享至朋友圈 | ||
32 | + </p> | ||
33 | + </div> | ||
34 | + <div class="tip-wrap hide"> | ||
35 | + <div class="tip hide fail"> | ||
36 | + <div class="title"> | ||
37 | + 领取失败<br> | ||
38 | + 请刷新重新领取 | ||
39 | + </div> | ||
40 | + <div class="desc"> | ||
41 | + 如多次领取失败,请联系客服人员<br> | ||
42 | + 带来不便敬请谅解 | ||
43 | + </div> | ||
44 | + <a class="button" href=""> | ||
45 | + 刷新 | ||
46 | + </a> | ||
47 | + </div> | ||
48 | + </div> | ||
49 | + | ||
50 | + <div class="tip-wrap hide"> | ||
51 | + <div class="tip hide geted"> | ||
52 | + <div class="title"> | ||
53 | + 你已领取过优惠券 | ||
54 | + </div> | ||
55 | + <div class="sub-title"> | ||
56 | + 快去分享给更多<br> | ||
57 | + 喜爱<span class="title">潮流</span>的小伙伴吧! | ||
58 | + </div> | ||
59 | + <a class="button close" href=""> | ||
60 | + 返回 | ||
61 | + </a> | ||
62 | + </div> | ||
63 | + </div> | ||
64 | + | ||
65 | + {{#if isApp}} | ||
66 | + <input type="hidden" value="{{getCouponUrl}}" id="getCouponUrl"> | ||
67 | + {{/if}} | ||
68 | +{{> cuxiao/xinshili/footer}} |
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2016/3/4 | ||
6 | + * Time: 12:18 | ||
7 | + */ | ||
8 | +namespace Cuxiao; | ||
9 | +use LibModels\Wap\Cuxiao\ActivityData; | ||
10 | + | ||
11 | +class GirldayModel | ||
12 | +{ | ||
13 | + /** | ||
14 | + * 获取领券活动结果 | ||
15 | + * | ||
16 | + * @param int $uid 用户id | ||
17 | + * @param int $actId 活动id | ||
18 | + * @return array | ||
19 | + */ | ||
20 | + public static function getGirldayCoupon($uid, $actId) | ||
21 | + { | ||
22 | + $result = array('code' => 201); | ||
23 | + | ||
24 | + do { | ||
25 | + if (empty($uid) || empty($actId)) { | ||
26 | + break; | ||
27 | + } | ||
28 | + | ||
29 | + $result = ActivityData::getCouponAll($uid, $actId); | ||
30 | + if (!$result) { | ||
31 | + $result = array('code' => 201); | ||
32 | + break; | ||
33 | + } | ||
34 | + | ||
35 | + if (intval($result['code']) === 200) { | ||
36 | + self::sendMessage($uid, '【优惠券】您有4张春潮新势力优惠券', '尊敬的客户:恭喜您成功获得4张春潮新势力优惠券 !您可以在个人中心查看优惠券详情。'); | ||
37 | + } | ||
38 | + } while (false); | ||
39 | + | ||
40 | + return $result; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * 发送站内信 | ||
45 | + * | ||
46 | + * @param int $uid 用户ID | ||
47 | + * @param string $title 站内信标题 | ||
48 | + * @param string $content 站内信内容 | ||
49 | + */ | ||
50 | + private static function sendMessage($uid, $title, $content) | ||
51 | + { | ||
52 | + try { | ||
53 | + ActivityData::message($uid, $title, $content); | ||
54 | + } catch (Exception $e) { | ||
55 | + // do nothing | ||
56 | + } | ||
57 | + } | ||
58 | +} |
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2016/3/4 | ||
6 | + * Time: 11:53 | ||
7 | + */ | ||
8 | +use Action\HuodongAction; | ||
9 | +use Cuxiao\XinshiliModel; | ||
10 | +use Plugin\Helpers; | ||
11 | + | ||
12 | +/** | ||
13 | + * | ||
14 | + */ | ||
15 | +class GirldayController extends HuodongAction | ||
16 | +{ | ||
17 | + // const STATIC_VERSION = 'http://localhost:2222/1.0.1'; | ||
18 | + const STATIC_VERSION = 'http://cdn.yoho.cn/huodong/2016xinshili-2/1.0.1'; | ||
19 | + | ||
20 | + /** | ||
21 | + * 检测登录状态 | ||
22 | + * | ||
23 | + */ | ||
24 | + private function getLoggedUid() | ||
25 | + { | ||
26 | + if ($this->_isApp) { | ||
27 | + $uid = $this->get('uid'); | ||
28 | + } else { | ||
29 | + $uid = $this->getUid(); | ||
30 | + } | ||
31 | + | ||
32 | + return $uid; | ||
33 | + } | ||
34 | + | ||
35 | + /** | ||
36 | + * 判断是否登陆 | ||
37 | + */ | ||
38 | + private function checkLogin() | ||
39 | + { | ||
40 | + $playUrl = Helpers::url('/cuxiao/girlday/index'); | ||
41 | + | ||
42 | + if (!$this->getLoggedUid()) { | ||
43 | + if (!$this->_isApp) { | ||
44 | + $this->go(Helpers::url('/signin.html', array('refer' => $playUrl), 'default')); | ||
45 | + } else { | ||
46 | + $playUrlEncode = strtr($playUrl, array('/' => '\\/')); | ||
47 | + $this->go($playUrl . '?openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' . $playUrlEncode . '","param":{"from":"app"}},"requesturl":{"url":"","param":{}},"priority":"N"}}'); | ||
48 | + } | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
53 | + * 领券活动页面控制器 | ||
54 | + */ | ||
55 | + public function indexAction() | ||
56 | + { | ||
57 | + $this->checkLogin(); | ||
58 | + | ||
59 | + //获取跳转到个人中心-我的优惠券链接,并调用接口,完成领券操作 | ||
60 | + $myCouponUrl = Helpers::url('/home/coupons', null, 'default') . '?openby:yohobuy={"action":"go.coupon"}'; | ||
61 | + | ||
62 | + $this->_view->display('index', array( | ||
63 | + 'staticTitle' => 'YOHO!BUY有货【春潮新势力】', | ||
64 | + 'staticFile' => self::STATIC_VERSION, | ||
65 | + 'staticJS' => array( | ||
66 | + 'home.js' | ||
67 | + ), | ||
68 | + 'couponUrl' => $myCouponUrl, // 个人中心优惠券地址 | ||
69 | + 'isApp' => $this->_isApp, | ||
70 | + 'getCouponUrl' => Helpers::url('/cuxiao/girlday/sendCoupon', array('uid' => $this->getLoggedUid())), | ||
71 | + 'banner' => array( | ||
72 | + 'img' => '', | ||
73 | + 'url' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】", "url":"http://feature.yoho.cn/0310/0310APPHOME/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"382"},"param":{"share_id":"382"}}' | ||
74 | + ), | ||
75 | + 'selectUrl' => 'http://m.yohobuy.com/home/coupons?openby:yohobuy={"action":"go.coupon"}', | ||
76 | + 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址 | ||
77 | + 'appUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr', // APP 下载地址 | ||
78 | + 'shareTitle' => 'YOHO!BUY有货【春潮新势力】火力全开!320元优惠券限时派送中!', | ||
79 | + 'shareDesc' => '换我做主,用新陪伴!白色情人节限时2件7折!', | ||
80 | + 'shareImg' => '', | ||
81 | + 'shareLink' => 'http://feature.yoho.cn/0310/0310APPHOME/index.html' | ||
82 | + )); | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
86 | + * 领券接口 | ||
87 | + */ | ||
88 | + public function sendCouponAction() | ||
89 | + { | ||
90 | + $result = array('code' => 201); | ||
91 | + | ||
92 | + do { | ||
93 | + if (!$this->isAjax()) { | ||
94 | + break; | ||
95 | + } | ||
96 | + | ||
97 | + $activityId = $this->getActivityId(); | ||
98 | + $uid = $this->getLoggedUid(); | ||
99 | + $result = GirldayModel::getGirldayCoupon($uid, $activityId); | ||
100 | + } while (false); | ||
101 | + | ||
102 | + $this->echoJson($result); | ||
103 | + } | ||
104 | + | ||
105 | + /** | ||
106 | + * 根据环境来获取活动ID | ||
107 | + * | ||
108 | + * @return int | ||
109 | + */ | ||
110 | + private function getActivityId() | ||
111 | + { | ||
112 | + // 设置环境变量 | ||
113 | + switch (APPLICATION_ENV) { | ||
114 | + case 'production': // 生产 | ||
115 | + return 506; | ||
116 | + case 'preview': // 预览 | ||
117 | + case 'testing': // 测试 | ||
118 | + case 'develop': // 开发 | ||
119 | + default: | ||
120 | + return 488; | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | +} |
@@ -65,7 +65,7 @@ class XinshiliController extends HuodongAction | @@ -65,7 +65,7 @@ class XinshiliController extends HuodongAction | ||
65 | 'getCouponUrl' => Helpers::url('/cuxiao/xinshili/sendCoupon', array('uid' => $this->getLoggedUid())), | 65 | 'getCouponUrl' => Helpers::url('/cuxiao/xinshili/sendCoupon', array('uid' => $this->getLoggedUid())), |
66 | 'banner' => array( | 66 | 'banner' => array( |
67 | 'img' => 'http://img01.yohoboys.com/staticimg/2016/03/04/09/019c5b6a514adee6bd2e3af9d8c28cdecb.jpg', | 67 | 'img' => 'http://img01.yohoboys.com/staticimg/2016/03/04/09/019c5b6a514adee6bd2e3af9d8c28cdecb.jpg', |
68 | - '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"}}' | 68 | + 'url' => 'http://feature.yoho.cn/0112/0112APPBRANDBOY/index.html?openby:yohobuy={"action":"go.h5","params":{"title":"YOHO!BUY有货【春潮新势力】","url":"http://feature.yoho.cn/0112/0112APPBRANDBOY/index.html?","share":"\/operations\/api\/v5\/webshare\/getShare","shareparam":{"share_id":"518"},"param":{"share_id":"518"}}' |
69 | ), | 69 | ), |
70 | 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址 | 70 | 'weixinUrl' => 'http://mp.weixin.qq.com/s?__biz=MjM5ODI5MDA4MA==&mid=201849402&idx=1&sn=c0089812f9769d82e0075f69d771f6e1#rd', // 微信关注地址 |
71 | 'appUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr', // APP 下载地址 | 71 | 'appUrl' => 'http://www.yohoshow.com/about/index/yohobuyqr', // APP 下载地址 |
@@ -238,6 +238,7 @@ class UserModel | @@ -238,6 +238,7 @@ class UserModel | ||
238 | $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . Helpers::transPrice($val['sales_price']) : false; | 238 | $product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥' . Helpers::transPrice($val['sales_price']) : false; |
239 | $product['savePrice'] = ($val['price_down'] > 0) ? '¥' . Helpers::transPrice($val['price_down']) : false; | 239 | $product['savePrice'] = ($val['price_down'] > 0) ? '¥' . Helpers::transPrice($val['price_down']) : false; |
240 | $product['sellOut'] = ($val['storage'] <= 0); | 240 | $product['sellOut'] = ($val['storage'] <= 0); |
241 | + $product['invalidGoods'] = ($val['status'] == 0); // 下架商品 | ||
241 | 242 | ||
242 | $datas[] = $product; | 243 | $datas[] = $product; |
243 | } | 244 | } |
@@ -378,9 +379,9 @@ class UserModel | @@ -378,9 +379,9 @@ class UserModel | ||
378 | $record = array(); | 379 | $record = array(); |
379 | foreach ($data as &$val) { | 380 | foreach ($data as &$val) { |
380 | // 排除下架的商品 | 381 | // 排除下架的商品 |
381 | - if ($val['status'] == 0) { | 382 | + /*if ($val['status'] == 0) { |
382 | continue; | 383 | continue; |
383 | - } | 384 | + }*/ |
384 | 385 | ||
385 | $record = array(); | 386 | $record = array(); |
386 | $record['product_name'] = $val['product_name']; | 387 | $record['product_name'] = $val['product_name']; |
@@ -389,6 +390,7 @@ class UserModel | @@ -389,6 +390,7 @@ class UserModel | ||
389 | $record['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : ''; | 390 | $record['image'] = !empty($val['image']) ? Helpers::getImageUrl($val['image'], 447, 596) : ''; |
390 | $record['sales_price'] = Helpers::transPrice($val['sales_price']); | 391 | $record['sales_price'] = Helpers::transPrice($val['sales_price']); |
391 | $record['market_price'] = ($val['market_price'] - $val['sales_price'] > 0) ? Helpers::transPrice($val['market_price']) : false; | 392 | $record['market_price'] = ($val['market_price'] - $val['sales_price'] > 0) ? Helpers::transPrice($val['market_price']) : false; |
393 | + $record['invalidGoods'] = ($val['status'] == 0); // 下架商品 | ||
392 | $record['storage'] = $val['storage']; | 394 | $record['storage'] = $val['storage']; |
393 | $allRecords[] = $record; | 395 | $allRecords[] = $record; |
394 | } | 396 | } |
@@ -552,21 +554,11 @@ class UserModel | @@ -552,21 +554,11 @@ class UserModel | ||
552 | $coupons = UserData::couponData($uid, $status, $page); | 554 | $coupons = UserData::couponData($uid, $status, $page); |
553 | 555 | ||
554 | // 没有获取到优惠券时 | 556 | // 没有获取到优惠券时 |
555 | - if (empty($coupons)) { | ||
556 | - $result['noRecord'] = true; | ||
557 | - break; | ||
558 | - } | ||
559 | - | ||
560 | - if ($page == 1 && isset($coupons['data']['total']) && $coupons['data']['total'] === 0) { | 557 | + if (empty($coupons) || empty($coupons['data'])) { |
561 | $result['noRecord'] = true; | 558 | $result['noRecord'] = true; |
562 | break; | 559 | break; |
563 | } | 560 | } |
564 | 561 | ||
565 | - // 判断是否有优惠券 | ||
566 | - if (empty($coupons['data']['info'])) { | ||
567 | - break; | ||
568 | - } | ||
569 | - | ||
570 | // 处理已使用的优惠券 | 562 | // 处理已使用的优惠券 |
571 | if ($status == 1) { | 563 | if ($status == 1) { |
572 | foreach ($coupons['data']['info'] as &$value) { | 564 | foreach ($coupons['data']['info'] as &$value) { |
@@ -574,8 +566,10 @@ class UserModel | @@ -574,8 +566,10 @@ class UserModel | ||
574 | } | 566 | } |
575 | } | 567 | } |
576 | 568 | ||
569 | + if (!empty($coupons['data']['info'])) { | ||
577 | $result['coupons'] = $coupons['data']['info']; | 570 | $result['coupons'] = $coupons['data']['info']; |
578 | } | 571 | } |
572 | + } | ||
579 | while (false); | 573 | while (false); |
580 | 574 | ||
581 | return $result; | 575 | return $result; |
-
Please register or login to post a comment