Authored by ccbikai

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

... ... @@ -15,17 +15,30 @@ class GradeData
/**
* 获取会员等级数据
* @param string $yh_channel 频道数据,1->男,2->女,3->潮童,4->创意生活,5->其他
* @param strint $gender 用户性别
* @param string $uid 用户id
* @return array 接口返回的会员等级数据
*/
public function getGradeData($channel, $uid) {
public function getGradeData($gender,$channel, $uid) {
$urlList = array();
//获取会员等级数据
$param = Yohobuy::param();
$param['yh_channel'] = $channel;
$param['uid'] = $uid;
$param['method'] = 'app.Passport.vip';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
$urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
//获取用户基本信息数据(用来得到username)
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['uid'] = $uid;
$param['yh_channel'] = $channel;
$param['method'] = 'app.passport.profile';
$param['client_secret'] = Sign::getSign($param);
$urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);
return Yohobuy::getMulti($urlList);
}
/**
... ... @@ -44,18 +57,4 @@ class GradeData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取用户基本信息数据
*/
public function getUserProfileData($gender, $uid, $channel) {
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['uid'] = $uid;
$param['yh_channel'] = $channel;
$param['method'] = 'app.passport.profile';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get("http://api.open.yohobuy.com/",$param);
}
}
... ...
<?php
namespace LibModels\Wap\Home;
use Api\Yohobuy;
use Api\Sign;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of OrderData
*
* @author Administrator
*/
class OrderData
{
/*
* 获取订单数据
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['limit'] = $limit;
$param['method'] = 'app.SpaceOrders.get';
$param['page'] = $page;
$param['type'] = $type;
$param['uid'] = $uid;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
print_r($param);
return Yohobuy::get(Yohobuy::API_URL,$param);
}
}
... ...
var $ = require('jquery'),
Hammer = require('yoho.hammer');
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
Hammer = require('yoho.hammer'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.lazyload');
var page = 1,
winH,
hotnav,
listTop,
navSwiper,
notab=0,
sort = '',
id = '';
function hotrank(page, sort, tab_id) {
function hotrank(page, sort, tabId, notab) {
$.ajax({
type: 'GET',
url: '/product/newsale/selectHotrank',
... ... @@ -18,15 +20,22 @@ function hotrank(page, sort, tab_id) {
data: {
page: page,
sort: sort,
tab_id: tab_id
tab_id: tabId,
notab: notab
},
success: function(data) {
if (page === 1) {
$('#hotRank').html('');
$('.rank-main').html('');
}
console.log(notab);
if (notab === 1) {
$('.rank-main').append(data);
} else {
$('#hotRank').append(data);
}
lazyLoad($('img.lazy'));
$('#yoho-footer').css('position', 'static');
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
navSwiper = new Swiper('.s-goods-nav', {
grabCursor: true,
slidesPerView: 'auto',
... ... @@ -38,9 +47,12 @@ function hotrank(page, sort, tab_id) {
$('.s-goods-nav .nav-item').each(function(index) {
hotnav = new Hammer($('.s-goods-nav .nav-item')[index]);
hotnav.on('tap', function(e) {
id = $('.s-goods-nav .nav-item').eq(index).data('id'),
sort = parseInt($('.s-goods-nav .nav-item').eq(index).data('sort').split('=')[1]);
hotrank(page, sort, id);
var navItme = $('.s-goods-nav .nav-item').eq(index);
id = navItme.data('id') ? navItme.data('id') : '';
page = 1;
notab = 1;
hotrank(page, sort, id, notab);
});
});
}
... ... @@ -55,7 +67,8 @@ $(window).scroll(function () {
return;
}
page = 2;
hotrank(page, sort, id);
notab = 1;
hotrank(page, sort, id, notab);
});
hotrank(page, sort, id);
hotrank(page, sort, id, notab);
... ...
... ... @@ -2,6 +2,7 @@
width: 100%;
height: auto;
overflow: hidden;
margin-top: 20rem / $pxConvertRem;
background-color:#fff;
border-bottom:1px solid #e0e0e0;
ul{
... ...
... ... @@ -38,12 +38,12 @@
text-align: center;
font-size: 22rem / $pxConvertRem;
color: #fff;
// background: image-url("sale-icon/rank.png") no-repeat;
background: url("../img/me/employ/rank.png") no-repeat;
background-position: center top;
background-size: auto 100%;
&.top {
// background: image-url("sale-icon/rank-t.png") no-repeat;
background: url("../img/me/employ/rank-t.png") no-repeat;
background-position: center top;
background-size: 100%;
line-height: 58rem / $pxConvertRem;
... ...
... ... @@ -2,7 +2,7 @@
<div class="float-layer hide" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
<p>新用户首单减10</p>
<p>新用户送千元礼包</p>
</div>
<a href="javascript:void(0);" id="float-layer-close" >
<i class="close-icon iconfont">&#xe623;</i>
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
/**
... ... @@ -161,14 +162,18 @@ class HomeController extends AbstractAction
*/
public function couponsAction()
{
// $uid = $this->getUid();
$uid = 967016;
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$status = $this->get('status', 0);
$coupons = array(
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
'couponsPage' => true
);
print_r($coupons);
$this->_view->display('coupons', $coupons);
}
... ... @@ -353,4 +358,31 @@ class HomeController extends AbstractAction
$this -> _view -> display('privilege',$data);
}
/*
*我的订单页面
*/
public function orderAction(){
do{
//判断是不是ajax请求
// if(!$this -> isAjax()){
// break;
// }
//判断参数是否有效
$type = $this -> get('type',1);
$page = $this -> get('page',1);
$limit = $this -> get('limit',10);
$gender = Helpers::getGenderByCookie();
$yh_channel = $this -> get('yh_channel',1);
$uid = $this -> getUid();
if(!empty($type) && !is_numeric($type)){
break;
}
//$data = OrderModel::getOrder();
$data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);
//print_r($data);
}
while(false);
//$this -> _view -> display('order',$data);
}
}
... ...
... ... @@ -26,10 +26,8 @@ class GradeModel
}
}
//调用接口获取数据
$data = GradeData::getGradeData($channel, $uid);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data'])) {
switch (intval($data['data']['current_vip_level'])) {
$data = GradeData::getGradeData($gender,$channel, $uid);
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
... ... @@ -45,24 +43,24 @@ class GradeModel
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['data']['current_year_cost'];
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100*(round($data['data']['current_total_cost'] / $data['data']['next_need_cost'], 2));
$result['vipGrade']['percent'] = 100*(round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['data']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['data']['upgrade_need_cost'];
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['data']['current_total_cost'];
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $userProfile['data']['username'];
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['data']['enjoy_preferential'];
}
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ...
<?php
namespace home;
use LibModels\Wap\Home\OrderData;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Order
*
*/
class OrderModel
{
/**
* 订单相关数据处理
*/
public function getOrder($type = 1,$page = 1,$limit,$gender,$yh_channel,$uid){
$data = OrderData::getOrderData($type,$page,$limit,$gender,$yh_channel,$uid);
return $data;
}
}
... ...
... ... @@ -41,6 +41,7 @@ class BrandController extends AbstractAction
}
// 渲染模板
print_r(Category\BrandModel::getBrandByChannel($channel));
$this->_view->display('index', Category\BrandModel::getBrandByChannel($channel));
}
... ...