Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -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 }
  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 +}
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,
10 sort = '', 11 sort = '',
11 id = ''; 12 id = '';
12 13
13 -function hotrank(page, sort, tab_id) { 14 +function hotrank(page, sort, tabId) {
14 $.ajax({ 15 $.ajax({
15 type: 'GET', 16 type: 'GET',
16 url: '/product/newsale/selectHotrank', 17 url: '/product/newsale/selectHotrank',
@@ -18,7 +19,7 @@ function hotrank(page, sort, tab_id) { @@ -18,7 +19,7 @@ function hotrank(page, sort, tab_id) {
18 data: { 19 data: {
19 page: page, 20 page: page,
20 sort: sort, 21 sort: sort,
21 - tab_id: tab_id 22 + tab_id: tabId
22 }, 23 },
23 success: function(data) { 24 success: function(data) {
24 if (page === 1) { 25 if (page === 1) {
@@ -27,6 +28,7 @@ function hotrank(page, sort, tab_id) { @@ -27,6 +28,7 @@ function hotrank(page, sort, tab_id) {
27 $('#hotRank').append(data); 28 $('#hotRank').append(data);
28 lazyLoad($('img.lazy')); 29 lazyLoad($('img.lazy'));
29 $('#yoho-footer').css('position', 'static'); 30 $('#yoho-footer').css('position', 'static');
  31 + $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
30 navSwiper = new Swiper('.s-goods-nav', { 32 navSwiper = new Swiper('.s-goods-nav', {
31 grabCursor: true, 33 grabCursor: true,
32 slidesPerView: 'auto', 34 slidesPerView: 'auto',
@@ -38,8 +40,11 @@ function hotrank(page, sort, tab_id) { @@ -38,8 +40,11 @@ function hotrank(page, sort, tab_id) {
38 $('.s-goods-nav .nav-item').each(function(index) { 40 $('.s-goods-nav .nav-item').each(function(index) {
39 hotnav = new Hammer($('.s-goods-nav .nav-item')[index]); 41 hotnav = new Hammer($('.s-goods-nav .nav-item')[index]);
40 hotnav.on('tap', function(e) { 42 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 + var navItme = $('.s-goods-nav .nav-item').eq(index);
  44 +
  45 + id = navItme.data('id') ? navItme.data('id') : '';
  46 + sort = navItme.data('sort') ? navItme.data('sort') : '';
  47 + page = 1;
43 hotrank(page, sort, id); 48 hotrank(page, sort, id);
44 }); 49 });
45 }); 50 });
@@ -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">&#xe60d;</span> 4 <span class="yoho-icon iconfont">&#xe60d;</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">&#xe623;</i> 8 <i class="close-icon iconfont">&#xe623;</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,8 +162,10 @@ class HomeController extends AbstractAction @@ -161,8 +162,10 @@ class HomeController extends AbstractAction
161 */ 162 */
162 public function couponsAction() 163 public function couponsAction()
163 { 164 {
164 - // $uid = $this->getUid();  
165 165
  166 + $this->setTitle('优惠券');
  167 + $this->setNavHeader('优惠券', true, SITE_MAIN);
  168 + // $uid = $this->getUid();
166 $uid = 967016; 169 $uid = 967016;
167 $status = $this->get('status', 0); 170 $status = $this->get('status', 0);
168 $coupons = array( 171 $coupons = array(
@@ -316,7 +319,7 @@ class HomeController extends AbstractAction @@ -316,7 +319,7 @@ class HomeController extends AbstractAction
316 319
317 /** 320 /**
318 * 会员等级展示页 321 * 会员等级展示页
319 - */ 322 + */
320 public function gradeAction(){ 323 public function gradeAction(){
321 //设置网站seo信息 324 //设置网站seo信息
322 $this->setTitle('会员等级'); 325 $this->setTitle('会员等级');
@@ -333,7 +336,7 @@ class HomeController extends AbstractAction @@ -333,7 +336,7 @@ class HomeController extends AbstractAction
333 } 336 }
334 /* 337 /*
335 *会员特权查看页 338 *会员特权查看页
336 - */ 339 + */
337 public function preferentialAction(){ 340 public function preferentialAction(){
338 //设置网站seo信息 341 //设置网站seo信息
339 $this->setTitle('会员等级'); 342 $this->setTitle('会员等级');
@@ -346,5 +349,32 @@ class HomeController extends AbstractAction @@ -346,5 +349,32 @@ class HomeController extends AbstractAction
346 $data['pageFooter'] = true; 349 $data['pageFooter'] = true;
347 $this -> _view -> display('privilege',$data); 350 $this -> _view -> display('privilege',$data);
348 } 351 }
349 - 352 +
  353 + /*
  354 + *我的订单页面
  355 + */
  356 + public function orderAction(){
  357 +
  358 + do{
  359 + //判断是不是ajax请求
  360 +// if(!$this -> isAjax()){
  361 +// break;
  362 +// }
  363 + //判断参数是否有效
  364 + $type = $this -> get('type',1);
  365 + $page = $this -> get('page',1);
  366 + $limit = $this -> get('limit',10);
  367 + $gender = Helpers::getGenderByCookie();
  368 + $yh_channel = $this -> get('yh_channel',1);
  369 + $uid = $this -> getUid();
  370 + if(!empty($type) && !is_numeric($type)){
  371 + break;
  372 + }
  373 + //$data = OrderModel::getOrder();
  374 + $data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);
  375 + //print_r($data);
  376 + }
  377 + while(false);
  378 + //$this -> _view -> display('order',$data);
  379 + }
350 } 380 }
@@ -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