Authored by Rock Zhang

Merge branch 'java-api' into test

Conflicts:
	library/Api/Yohobuy.php
	yohobuy/m.yohobuy.com/application/controllers/Home.php
framework @ e9d066dd
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
... ...
... ... @@ -382,23 +382,27 @@ class AbstractAction extends Controller_Abstract
$header['navHome'] = $homeUrl . '?go=1&t=' . time();
}
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
case 1:
$header['boys'] = true;
break;
case 2:
$header['girls'] = true;
break;
case 3:
$header['kids'] = true;
break;
case 4:
$header['lifeStyle'] = true;
break;
}
}
$this->_view->assign('pageHeader', $header);
}
/**
... ...
... ... @@ -26,7 +26,7 @@ class UserData
public static function userData($uid)
{
$param = array();
$param['uid'] = 10064;
$param['uid'] = $uid;
return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER . 'ProfilesRest/getUserprofile', $param);
}
... ... @@ -232,6 +232,7 @@ class UserData
*/
public static function yohoCoinData($uid, $page = 1, $limit = 10)
{
$param = array();
$param['uid'] = $uid;
/*$param['limit'] = 10;
$param['page'] = 1;*/
... ... @@ -249,7 +250,7 @@ class UserData
*/
public static function couponData($uid, $status)
{
$param = Yohobuy::param();
$param = array();
$param['uid'] = $uid;
$param['status'] = $status;
... ...
... ... @@ -28,10 +28,8 @@ function editAddress(data) {
$addressForm.find('[name="area_code"]').val(data.areaCode || '');
$addressForm.find('[name="area"]').val(data.area || '');
$addressForm.find('[name="address"]').val(data.address || '');
$footer.hide();
$editAddressPage.show();
// $addressForm.find('[name="address"]').blur();
// $addressForm.find('[name="consignee"]').focus();
}
$confim.on('touchend', '.cancel', function() {
... ...
.my-address-page {
position: absolute;
bottom: 0;
top: pxToRem(90px);
width: 100%;
background: #f0f0f0;
padding-bottom: pxToRem(20px);
.address-item {
padding: pxToRem(20px) pxToRem(30px);
... ... @@ -41,6 +39,7 @@
.add-address {
display: block;
margin-top: pxToRem(30px);
margin-bottom: pxToRem(30px);
font-size: pxToRem(32px);
line-height: pxToRem(88px);
color: #444;
... ...
... ... @@ -31,7 +31,7 @@
height: 180rem / $pxConvertRem;
overflow: hidden;
margin: 20rem / $pxConvertRem auto;
background: url('../img/me/employ/employ.jpg') top center no-repeat;
background: image-url('me/employ/employ.jpg') top center no-repeat;
background-size: 100% 100%;
color: #fff;
span{
... ...
.my-page {
color: #444;
background: #f0f0f0;
padding-bottom: pxToRem(20px);
a {
color: #444;
... ...
... ... @@ -13,7 +13,7 @@
}
.swiper-container {
padding: pxToRem(20px) 0;
padding: pxToRem(30px) 0 pxToRem(20px);
width: 100%;
height: pxToRem(252px);
overflow: hidden;
... ...
... ... @@ -8,40 +8,7 @@
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list">
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
{{> home/favorite_product_list}}
</ul>
{{^ hasFavProduct}}
... ... @@ -50,43 +17,7 @@
{{/ hasFavProduct}}
</div>
<div class="fav-type">
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
{{> home/favorite_brand_list}}
{{^ hasFavBrand}}
<span class="fav-null">您暂无收藏任何品牌</span>
... ...
{{> home/favorite_brand_list}}
\ No newline at end of file
... ...
{{> home/favorite_product_list}}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@
<span class="user-avatar" data-avatar="{{head_ico}}"></span>
<span class="username">{{profile_name}}</span>
{{#vip_info}}
<span class="vip-icon vip-{{next_level}}"></span>
<span class="vip-icon vip-{{cur_level}}"></span>
{{/vip_info}}
<div class="iconfont more-icon">&#xe604;</div>
</a>
... ...
{{> layout/header}}
<div class="personal-details">
<ul>
<li><span>头像</span><span><i class="head-portrait"><span class="user-avatar" data-avatar="{{ head_ico }}"></span></i></span></li>
<li><span>昵称</span><span>{{ username }}</span></li>
<li><span>头像</span><span><i class="head-portrait"><img class="user-avatar" src="{{ head_ico }}"></i></span></li>
<li><span>昵称</span><span>{{ nickname }}</span></li>
<li><span>性别</span><span>{{ gender }}</span></li>
<li><span>生日</span><span>{{ birthday }}</span></li>
<li><span>会员等级</span>
... ...
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
\ No newline at end of file
... ...
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
<form class="edit-address">
<input type="hidden" name="id" value="">
<label class="username">
收件人
收件人姓名
<input type="text" name="consignee" value="">
</label>
<label class="mobile">
... ...
<div class="recommend-for-you">
<div class="recommend-for-you hide">
</div>
\ No newline at end of file
... ...
... ... @@ -25,12 +25,13 @@ class HomeController extends AbstractAction
*/
public function init() {
// 检查用户是否登录, 未登录则跳转到登录页
// @todo 为了方便测试,支持传uid参数
$uid = $this->getUid();
if (!$uid) {
// $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
}
// @todo 为了方便测试,支持传uid参数
$this->_uid = $this->getUid();
/*if (!$uid) {
$uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
}*/
$action = $this->getRequest()->getActionName();
if (!$this->_uid && $action !== 'index' && !$this->isAjax()) {
$this->go(Helpers::url('/signin.html'));
... ... @@ -61,7 +62,7 @@ class HomeController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$data['recommendForYou'] = UserModel::getPreferenceData($channel);
}
$this->_view->display('index', $data);
}
... ... @@ -95,7 +96,7 @@ class HomeController extends AbstractAction
$tab = $this->get('tab', '');
$favProducts = UserModel::getFavProductData($this->_uid);
$favProducts = UserModel::getFavProductData($this->_uid, 1, 10);
$favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
$data = array(
... ... @@ -116,6 +117,44 @@ class HomeController extends AbstractAction
}
/**
* 用户收藏的商品数据获取接口
*/
public function favProductAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavProductData($this->_uid, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_product', $result);
}
}
/**
* 用户收藏的品牌数据获取接口
*/
public function favBrandAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_brand', $result);
}
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction() {
... ... @@ -189,7 +228,6 @@ class HomeController extends AbstractAction
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$coupons = array(
'couponsUrl' => array(
'used' => UserModel::getCouponData($this->_uid, 0),
... ... @@ -207,7 +245,7 @@ class HomeController extends AbstractAction
* 暂时使用老的,因后面APP、PC、WAP会进行一次改版
*/
public function messageAction() {
$page = $this->get('page', 0);
$page = $this->get('page', 1);
$size = $this->get('size', 10);
$messages = UserModel::getMessageData($this->_uid, $page, $size);
... ... @@ -296,7 +334,9 @@ class HomeController extends AbstractAction
}
}
//在线客服
/**
* 在线客服
*/
public function onlineServiceAction() {
// 设置网站标题
$this->setTitle('在线客服');
... ... @@ -311,7 +351,9 @@ class HomeController extends AbstractAction
));
}
//在线客服-具体详情
/**
* 在线客服-具体详情
*/
public function onlineServiceDetailAction() {
$service = array();
$cateId = $this->get('cateId', 0);
... ... @@ -392,7 +434,6 @@ class HomeController extends AbstractAction
* 异步上传图片
*/
public function suggestimgUploadAction() {
//$filename = $this->post('filename', '');
$result = UserModel::saveSuggestImg('fileData');
$this->echoJson($result);
... ... @@ -477,8 +518,12 @@ class HomeController extends AbstractAction
));
}
//ajax请求订单页面
public function getOrdersAction() {
/**
* ajax请求订单页面
*/
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -487,6 +532,7 @@ class HomeController extends AbstractAction
$type = $this->get('type', 1);
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $this->_uid);
/* 如果取不到订单数据时,分两种情况:
... ... @@ -510,9 +556,7 @@ class HomeController extends AbstractAction
/*
* 我的订单-取消订单
*/
public function cancelOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -530,7 +574,6 @@ class HomeController extends AbstractAction
/*
* 我的订单-删除订单
*/
public function delOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
... ... @@ -558,7 +601,6 @@ class HomeController extends AbstractAction
/*
* 我的订单-随便逛逛链接获取
*/
private function strollAction() {
//获取性别、频道数据
$gender = Helpers::getGenderByCookie();
... ...
... ... @@ -184,14 +184,16 @@ class UserModel
* 处理用户收藏的商品数据
*
* @param int $uid 用户ID
* @param int $page 第几页
* @param int $limit 限制读取的数目,默认10
* @return array|mixed 处理之后的收藏的商品数据
*/
public static function getFavProductData($uid)
public static function getFavProductData($uid, $page, $limit)
{
$result = array();
// 调用接口获取用户收藏的商品数据
$favProduct = UserData::favoriteProductData($uid);
$favProduct = UserData::favoriteProductData($uid, $page, $limit);
// 处理用户收藏的商品数据
if (isset($favProduct['list']) && !empty($favProduct['list'])) {
... ...