Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
12 changed files
with
158 additions
and
47 deletions
@@ -15,17 +15,30 @@ class GradeData | @@ -15,17 +15,30 @@ class GradeData | ||
15 | /** | 15 | /** |
16 | * 获取会员等级数据 | 16 | * 获取会员等级数据 |
17 | * @param string $yh_channel 频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他 | 17 | * @param string $yh_channel 频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他 |
18 | + * @param strint $gender 用户性别 | ||
18 | * @param string $uid 用户id | 19 | * @param string $uid 用户id |
19 | * @return array 接口返回的会员等级数据 | 20 | * @return array 接口返回的会员等级数据 |
20 | */ | 21 | */ |
21 | - public function getGradeData($channel, $uid) { | ||
22 | - | 22 | + public function getGradeData($gender,$channel, $uid) { |
23 | + $urlList = array(); | ||
24 | + //获取会员等级数据 | ||
23 | $param = Yohobuy::param(); | 25 | $param = Yohobuy::param(); |
24 | $param['yh_channel'] = $channel; | 26 | $param['yh_channel'] = $channel; |
25 | $param['uid'] = $uid; | 27 | $param['uid'] = $uid; |
26 | $param['method'] = 'app.Passport.vip'; | 28 | $param['method'] = 'app.Passport.vip'; |
27 | $param['client_secret'] = Sign::getSign($param); | 29 | $param['client_secret'] = Sign::getSign($param); |
28 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 30 | + $urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param); |
31 | + | ||
32 | + //获取用户基本信息数据(用来得到username) | ||
33 | + $param = Yohobuy::param(); | ||
34 | + $param['gender'] = $gender; | ||
35 | + $param['uid'] = $uid; | ||
36 | + $param['yh_channel'] = $channel; | ||
37 | + $param['method'] = 'app.passport.profile'; | ||
38 | + $param['client_secret'] = Sign::getSign($param); | ||
39 | + $urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param); | ||
40 | + | ||
41 | + return Yohobuy::getMulti($urlList); | ||
29 | } | 42 | } |
30 | 43 | ||
31 | /** | 44 | /** |
@@ -44,18 +57,4 @@ class GradeData | @@ -44,18 +57,4 @@ class GradeData | ||
44 | return Yohobuy::get(Yohobuy::API_URL, $param); | 57 | return Yohobuy::get(Yohobuy::API_URL, $param); |
45 | } | 58 | } |
46 | 59 | ||
47 | - /** | ||
48 | - * 获取用户基本信息数据 | ||
49 | - */ | ||
50 | - public function getUserProfileData($gender, $uid, $channel) { | ||
51 | - $param = Yohobuy::param(); | ||
52 | - $param['gender'] = $gender; | ||
53 | - $param['uid'] = $uid; | ||
54 | - $param['yh_channel'] = $channel; | ||
55 | - $param['method'] = 'app.passport.profile'; | ||
56 | - $param['client_secret'] = Sign::getSign($param); | ||
57 | - | ||
58 | - return Yohobuy::get("http://api.open.yohobuy.com/",$param); | ||
59 | - } | ||
60 | - | ||
61 | } | 60 | } |
library/LibModels/Wap/Home/OrderData.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace LibModels\Wap\Home; | ||
4 | + | ||
5 | +use Api\Yohobuy; | ||
6 | +use Api\Sign; | ||
7 | +/* | ||
8 | + * To change this license header, choose License Headers in Project Properties. | ||
9 | + * To change this template file, choose Tools | Templates | ||
10 | + * and open the template in the editor. | ||
11 | + */ | ||
12 | + | ||
13 | +/** | ||
14 | + * Description of OrderData | ||
15 | + * | ||
16 | + * @author Administrator | ||
17 | + */ | ||
18 | +class OrderData | ||
19 | +{ | ||
20 | + /* | ||
21 | + * 获取订单数据 | ||
22 | + * To change this template file, choose Tools | Templates | ||
23 | + * and open the template in the editor. | ||
24 | + */ | ||
25 | + public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){ | ||
26 | + $param = Yohobuy::param(); | ||
27 | + $param['gender'] = $gender; | ||
28 | + $param['limit'] = $limit; | ||
29 | + $param['method'] = 'app.SpaceOrders.get'; | ||
30 | + $param['page'] = $page; | ||
31 | + $param['type'] = $type; | ||
32 | + $param['uid'] = $uid; | ||
33 | + $param['yh_channel'] = $yh_channel; | ||
34 | + $param['client_secret'] = Sign::getSign($param); | ||
35 | + print_r($param); | ||
36 | + return Yohobuy::get(Yohobuy::API_URL,$param); | ||
37 | + } | ||
38 | +} |
static/img/me/employ/rank-t.png
0 → 100644
2.27 KB
static/img/me/employ/rank.png
0 → 100644
2.58 KB
1 | var $ = require('jquery'), | 1 | var $ = require('jquery'), |
2 | - Hammer = require('yoho.hammer'); | ||
3 | - | ||
4 | -Swiper = require('yoho.iswiper'), | ||
5 | -lazyLoad = require('yoho.lazyload'); | 2 | + Hammer = require('yoho.hammer'), |
3 | + Swiper = require('yoho.iswiper'), | ||
4 | + lazyLoad = require('yoho.lazyload'); | ||
6 | 5 | ||
7 | var page = 1, | 6 | var page = 1, |
8 | winH, | 7 | winH, |
9 | hotnav, | 8 | hotnav, |
9 | + listTop, | ||
10 | + navSwiper, | ||
11 | + notab=0, | ||
10 | sort = '', | 12 | sort = '', |
11 | id = ''; | 13 | id = ''; |
12 | 14 | ||
13 | -function hotrank(page, sort, tab_id) { | 15 | +function hotrank(page, sort, tabId, notab) { |
14 | $.ajax({ | 16 | $.ajax({ |
15 | type: 'GET', | 17 | type: 'GET', |
16 | url: '/product/newsale/selectHotrank', | 18 | url: '/product/newsale/selectHotrank', |
@@ -18,15 +20,22 @@ function hotrank(page, sort, tab_id) { | @@ -18,15 +20,22 @@ function hotrank(page, sort, tab_id) { | ||
18 | data: { | 20 | data: { |
19 | page: page, | 21 | page: page, |
20 | sort: sort, | 22 | sort: sort, |
21 | - tab_id: tab_id | 23 | + tab_id: tabId, |
24 | + notab: notab | ||
22 | }, | 25 | }, |
23 | success: function(data) { | 26 | success: function(data) { |
24 | if (page === 1) { | 27 | if (page === 1) { |
25 | - $('#hotRank').html(''); | 28 | + $('.rank-main').html(''); |
26 | } | 29 | } |
30 | + console.log(notab); | ||
31 | + if (notab === 1) { | ||
32 | + $('.rank-main').append(data); | ||
33 | + } else { | ||
27 | $('#hotRank').append(data); | 34 | $('#hotRank').append(data); |
35 | + } | ||
28 | lazyLoad($('img.lazy')); | 36 | lazyLoad($('img.lazy')); |
29 | $('#yoho-footer').css('position', 'static'); | 37 | $('#yoho-footer').css('position', 'static'); |
38 | + $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top'); | ||
30 | navSwiper = new Swiper('.s-goods-nav', { | 39 | navSwiper = new Swiper('.s-goods-nav', { |
31 | grabCursor: true, | 40 | grabCursor: true, |
32 | slidesPerView: 'auto', | 41 | slidesPerView: 'auto', |
@@ -38,9 +47,12 @@ function hotrank(page, sort, tab_id) { | @@ -38,9 +47,12 @@ function hotrank(page, sort, tab_id) { | ||
38 | $('.s-goods-nav .nav-item').each(function(index) { | 47 | $('.s-goods-nav .nav-item').each(function(index) { |
39 | hotnav = new Hammer($('.s-goods-nav .nav-item')[index]); | 48 | hotnav = new Hammer($('.s-goods-nav .nav-item')[index]); |
40 | hotnav.on('tap', function(e) { | 49 | hotnav.on('tap', function(e) { |
41 | - id = $('.s-goods-nav .nav-item').eq(index).data('id'), | ||
42 | - sort = parseInt($('.s-goods-nav .nav-item').eq(index).data('sort').split('=')[1]); | ||
43 | - hotrank(page, sort, id); | 50 | + var navItme = $('.s-goods-nav .nav-item').eq(index); |
51 | + | ||
52 | + id = navItme.data('id') ? navItme.data('id') : ''; | ||
53 | + page = 1; | ||
54 | + notab = 1; | ||
55 | + hotrank(page, sort, id, notab); | ||
44 | }); | 56 | }); |
45 | }); | 57 | }); |
46 | } | 58 | } |
@@ -55,7 +67,8 @@ $(window).scroll(function () { | @@ -55,7 +67,8 @@ $(window).scroll(function () { | ||
55 | return; | 67 | return; |
56 | } | 68 | } |
57 | page = 2; | 69 | page = 2; |
58 | - hotrank(page, sort, id); | 70 | + notab = 1; |
71 | + hotrank(page, sort, id, notab); | ||
59 | 72 | ||
60 | }); | 73 | }); |
61 | -hotrank(page, sort, id); | 74 | +hotrank(page, sort, id, notab); |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | width: 100%; | 2 | width: 100%; |
3 | height: auto; | 3 | height: auto; |
4 | overflow: hidden; | 4 | overflow: hidden; |
5 | + margin-top: 20rem / $pxConvertRem; | ||
5 | background-color:#fff; | 6 | background-color:#fff; |
6 | border-bottom:1px solid #e0e0e0; | 7 | border-bottom:1px solid #e0e0e0; |
7 | ul{ | 8 | ul{ |
@@ -38,12 +38,12 @@ | @@ -38,12 +38,12 @@ | ||
38 | text-align: center; | 38 | text-align: center; |
39 | font-size: 22rem / $pxConvertRem; | 39 | font-size: 22rem / $pxConvertRem; |
40 | color: #fff; | 40 | color: #fff; |
41 | - // background: image-url("sale-icon/rank.png") no-repeat; | 41 | + background: url("../img/me/employ/rank.png") no-repeat; |
42 | background-position: center top; | 42 | background-position: center top; |
43 | background-size: auto 100%; | 43 | background-size: auto 100%; |
44 | 44 | ||
45 | &.top { | 45 | &.top { |
46 | - // background: image-url("sale-icon/rank-t.png") no-repeat; | 46 | + background: url("../img/me/employ/rank-t.png") no-repeat; |
47 | background-position: center top; | 47 | background-position: center top; |
48 | background-size: 100%; | 48 | background-size: 100%; |
49 | line-height: 58rem / $pxConvertRem; | 49 | line-height: 58rem / $pxConvertRem; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="float-layer hide" id="float-layer-app"> | 2 | <div class="float-layer hide" id="float-layer-app"> |
3 | <div class="float-layer-left"> | 3 | <div class="float-layer-left"> |
4 | <span class="yoho-icon iconfont"></span> | 4 | <span class="yoho-icon iconfont"></span> |
5 | - <p>新用户首单减10元</p> | 5 | + <p>新用户送千元礼包</p> |
6 | </div> | 6 | </div> |
7 | <a href="javascript:void(0);" id="float-layer-close" > | 7 | <a href="javascript:void(0);" id="float-layer-close" > |
8 | <i class="close-icon iconfont"></i> | 8 | <i class="close-icon iconfont"></i> |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use home\GradeModel; | 4 | use home\GradeModel; |
5 | +use home\OrderModel; | ||
5 | use Plugin\Helpers; | 6 | use Plugin\Helpers; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -161,14 +162,18 @@ class HomeController extends AbstractAction | @@ -161,14 +162,18 @@ class HomeController extends AbstractAction | ||
161 | */ | 162 | */ |
162 | public function couponsAction() | 163 | public function couponsAction() |
163 | { | 164 | { |
164 | - // $uid = $this->getUid(); | ||
165 | 165 | ||
166 | - $uid = 967016; | 166 | + $this->setTitle('优惠券'); |
167 | + $this->setNavHeader('优惠券', true, SITE_MAIN); | ||
168 | + // $uid = $this->getUid(); | ||
169 | + $uid = 8826435; | ||
167 | $status = $this->get('status', 0); | 170 | $status = $this->get('status', 0); |
168 | $coupons = array( | 171 | $coupons = array( |
169 | 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), | 172 | 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), |
170 | 'couponsPage' => true | 173 | 'couponsPage' => true |
171 | ); | 174 | ); |
175 | + | ||
176 | + print_r($coupons); | ||
172 | $this->_view->display('coupons', $coupons); | 177 | $this->_view->display('coupons', $coupons); |
173 | 178 | ||
174 | } | 179 | } |
@@ -353,4 +358,31 @@ class HomeController extends AbstractAction | @@ -353,4 +358,31 @@ class HomeController extends AbstractAction | ||
353 | $this -> _view -> display('privilege',$data); | 358 | $this -> _view -> display('privilege',$data); |
354 | } | 359 | } |
355 | 360 | ||
361 | + /* | ||
362 | + *我的订单页面 | ||
363 | + */ | ||
364 | + public function orderAction(){ | ||
365 | + | ||
366 | + do{ | ||
367 | + //判断是不是ajax请求 | ||
368 | +// if(!$this -> isAjax()){ | ||
369 | +// break; | ||
370 | +// } | ||
371 | + //判断参数是否有效 | ||
372 | + $type = $this -> get('type',1); | ||
373 | + $page = $this -> get('page',1); | ||
374 | + $limit = $this -> get('limit',10); | ||
375 | + $gender = Helpers::getGenderByCookie(); | ||
376 | + $yh_channel = $this -> get('yh_channel',1); | ||
377 | + $uid = $this -> getUid(); | ||
378 | + if(!empty($type) && !is_numeric($type)){ | ||
379 | + break; | ||
380 | + } | ||
381 | + //$data = OrderModel::getOrder(); | ||
382 | + $data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid); | ||
383 | + //print_r($data); | ||
384 | + } | ||
385 | + while(false); | ||
386 | + //$this -> _view -> display('order',$data); | ||
387 | + } | ||
356 | } | 388 | } |
@@ -26,10 +26,8 @@ class GradeModel | @@ -26,10 +26,8 @@ class GradeModel | ||
26 | } | 26 | } |
27 | } | 27 | } |
28 | //调用接口获取数据 | 28 | //调用接口获取数据 |
29 | - $data = GradeData::getGradeData($channel, $uid); | ||
30 | - | ||
31 | - if (isset($data['code']) && $data['code'] === 200 && isset($data['data'])) { | ||
32 | - switch (intval($data['data']['current_vip_level'])) { | 29 | + $data = GradeData::getGradeData($gender,$channel, $uid); |
30 | + switch (intval($data['grade']['current_vip_level'])) { | ||
33 | case 0://普通会员 | 31 | case 0://普通会员 |
34 | $result['vipGrade']['vip0'] = true; | 32 | $result['vipGrade']['vip0'] = true; |
35 | break; | 33 | break; |
@@ -45,24 +43,24 @@ class GradeModel | @@ -45,24 +43,24 @@ class GradeModel | ||
45 | } | 43 | } |
46 | 44 | ||
47 | //今年总消费 | 45 | //今年总消费 |
48 | - $result['vipGrade']['costOfThisYear'] = $data['data']['current_year_cost']; | 46 | + $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost']; |
49 | //升级下一等级会员的进度; | 47 | //升级下一等级会员的进度; |
50 | - $result['vipGrade']['percent'] = 100*(round($data['data']['current_total_cost'] / $data['data']['next_need_cost'], 2)); | 48 | + $result['vipGrade']['percent'] = 100*(round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2)); |
51 | //距离升级所需消费金额 | 49 | //距离升级所需消费金额 |
52 | 50 | ||
53 | - if ($data['data']['current_vip_level'] != 3) { | ||
54 | - $result['vipGrade']['costGap'] = $data['data']['upgrade_need_cost']; | 51 | + if ($data['grade']['current_vip_level'] != 3) { |
52 | + $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost']; | ||
55 | } | 53 | } |
56 | //消费总计 | 54 | //消费总计 |
57 | - $result['vipGrade']['sumCost'] = $data['data']['current_total_cost']; | 55 | + $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost']; |
58 | //username 调用获取用户基本信息数据,获得username; | 56 | //username 调用获取用户基本信息数据,获得username; |
59 | - $userProfile = GradeData::getUserProfileData($gender,$uid,$channel); | ||
60 | - $result['vipGrade']['name'] = $userProfile['data']['username']; | 57 | + //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); |
58 | + $result['vipGrade']['name'] = $data['userProfile']['username']; | ||
61 | //跳转url(会员特权详情) | 59 | //跳转url(会员特权详情) |
62 | $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null); | 60 | $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null); |
63 | //当前vip等级享受的特权 | 61 | //当前vip等级享受的特权 |
64 | - $result['vipGrade']['privilege'] = $data['data']['enjoy_preferential']; | ||
65 | - } | 62 | + $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential']; |
63 | + | ||
66 | 64 | ||
67 | if (USE_CACHE) { | 65 | if (USE_CACHE) { |
68 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. | 66 | // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. |
1 | +<?php | ||
2 | + | ||
3 | + namespace home; | ||
4 | + | ||
5 | + use LibModels\Wap\Home\OrderData; | ||
6 | +/* | ||
7 | + * To change this license header, choose License Headers in Project Properties. | ||
8 | + * To change this template file, choose Tools | Templates | ||
9 | + * and open the template in the editor. | ||
10 | + */ | ||
11 | + | ||
12 | +/** | ||
13 | + * Description of Order | ||
14 | + * | ||
15 | + */ | ||
16 | +class OrderModel | ||
17 | +{ | ||
18 | + | ||
19 | + /** | ||
20 | + * 订单相关数据处理 | ||
21 | + */ | ||
22 | + public function getOrder($type = 1,$page = 1,$limit,$gender,$yh_channel,$uid){ | ||
23 | + | ||
24 | + $data = OrderData::getOrderData($type,$page,$limit,$gender,$yh_channel,$uid); | ||
25 | + | ||
26 | + return $data; | ||
27 | + } | ||
28 | + | ||
29 | +} |
@@ -41,6 +41,7 @@ class BrandController extends AbstractAction | @@ -41,6 +41,7 @@ class BrandController extends AbstractAction | ||
41 | } | 41 | } |
42 | 42 | ||
43 | // 渲染模板 | 43 | // 渲染模板 |
44 | + print_r(Category\BrandModel::getBrandByChannel($channel)); | ||
44 | $this->_view->display('index', Category\BrandModel::getBrandByChannel($channel)); | 45 | $this->_view->display('index', Category\BrandModel::getBrandByChannel($channel)); |
45 | } | 46 | } |
46 | 47 |
-
Please register or login to post a comment