Authored by hf

fixes bug to merge develop codes

Showing 46 changed files with 445 additions and 233 deletions
... ... @@ -16,6 +16,7 @@ use Yaf\Controller_Abstract;
use Yaf\Dispatcher;
use Plugin\Cache;
use Plugin\Helpers;
use Hood\Session;
class AbstractAction extends Controller_Abstract
{
... ... @@ -100,8 +101,8 @@ class AbstractAction extends Controller_Abstract
{
return $this->_request->getParam($key, $default);
}
/**
/**
* 封装一下获取服务器的参数
*
* @param String $key
... ... @@ -245,6 +246,28 @@ class AbstractAction extends Controller_Abstract
}
/**
* 设置Session
*
* @param string $name 名称
* @param mixed $value 值
* @return void
*/
public function setSession($name, $value)
{
Session::start('yohobuy_session')->__set($name, $value);
}
/**
* 获取Session
*
* @param string $name 名称
*/
public function getSession($name)
{
Session::start('yohobuy_session')->__get($name);
}
/**
* 获取当前登录的用户ID
*
* @return int
... ... @@ -340,11 +363,11 @@ class AbstractAction extends Controller_Abstract
if (!empty($homeUrl)) {
$header['navHome'] = $homeUrl . '?go=1';
}
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
default:
default:
case 1:
$header['boys'] = true;
break;
... ...
... ... @@ -26,7 +26,7 @@ class OptData
*/
public static function favoriteBrand($uid, $id, $opt = 'ok')
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id) );
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
}
/**
... ... @@ -40,9 +40,9 @@ class OptData
public static function favoriteProduct($uid, $skn, $opt = 'ok')
{
if ($opt === 'cancel') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn) );
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn));
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn) );
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn));
}
}
... ... @@ -57,9 +57,26 @@ class OptData
public static function praiseArticle($udid, $id, $opt = 'ok')
{
if ($opt === 'cancel') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid) );
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid));
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid) );
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid));
}
}
/**
* 逛资讯收藏/取消收藏 (APP里调用)
*
* @param int $udid 唯一客户端标识
* @param int $id 唯一资讯的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function collectArticle($uid, $id, $opt = 'ok')
{
if ($opt === 'cancel') {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'cancelFavorite', array($id, $uid));
} else {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'setFavorite', array($id, $uid));
}
}
... ...
... ... @@ -106,6 +106,7 @@ class PlusstarData
* @param string $gender $gender "1,3"表示男, "2,3"表示女
* @param int $uid 用户ID
* @param string $udid cookie记录唯一标识
* @param bool $isApp 判断是不是APP访问
* @return array(
* "getBrandInfo" => array(品牌详情信息),
* "getUidBrandFav" => false,
... ... @@ -114,7 +115,7 @@ class PlusstarData
* "getUidProductFav" => array(用户是否收藏新品)
* )
*/
public static function brandInfo($id, $gender, $uid, $udid = null)
public static function brandInfo($id, $gender, $uid, $udid = null, $isApp = false)
{
$result = array();
$result['getBrandInfo'] = array();
... ... @@ -177,7 +178,7 @@ class PlusstarData
}
// 商品信息列表
$result['getNewProduct'][$i] = Helpers::formatProduct($value);
$result['getNewProduct'][$i] = Helpers::formatProduct($value, true, true, true, 235, 314, $isApp);
// 用户是否收藏该商品
$skn = $value['product_skn'];
... ...
... ... @@ -61,7 +61,7 @@ class ListProcess
$filters = array('classify' => array());
// 返回数据中有没有gender时要添加gender
// $data['gender'] = array('2,3'=>'GIRLS','1,3'=>'BOYS');
$data['gender'] = array('2,3'=>'GIRLS','1,3'=>'BOYS');
$num = 1;
foreach ($data as $key => $val) {
... ...
... ... @@ -177,9 +177,10 @@ class Helpers
* @param bool $showSale 控制是否显示SALE图标
* @param int $width 图片的宽度
* @param int $height 图片的高度
* @param bool $isApp 判断是不是APP访问
* @return array | false
*/
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388)
public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388, $isApp = false)
{
// 商品信息有问题,则不显示
if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
... ... @@ -207,6 +208,11 @@ class Helpers
$result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_'
. $productData['goods_list'][0]['goods_id']
. '/' . $productData['cn_alphabet'] . '.html';
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if ($isApp) {
$result['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'.$productData['product_skn'].'}}';
}
if ($showTags) {
$result['tags'] = array();
... ... @@ -229,9 +235,10 @@ class Helpers
* @param bool $showTag 是否显示左上角标签
* @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接
* @param bool $showAuthor 控制是否显示作者信息
* @param int $uid 当前登录的用户ID
* @return array | false
*/
public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true)
public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true, $uid = null)
{
// 资讯ID不存在,则不显示
if (!isset($articleData['id'])) {
... ... @@ -252,7 +259,7 @@ class Helpers
if ($isApp) {
$result['collect'] = array();
$result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y';
$result['collect']['url'] = $articleData['url'];
$result['collect']['url'] = !empty($uid) ? 'javascript:;' : strtr($articleData['url'], array('"islogin":"N"' => '"islogin":"Y"'));
}
// 点赞
else {
... ...
... ... @@ -11,21 +11,16 @@ var $ = require('jquery'),
var swiper,
$fixTitleBar,
$brandText,
$brandHref,
$brandList = $('.brand-list');
var searchH = $('.newbrand-search').outerHeight(),
headerH = $('.yoho-header').outerHeight(),
brandSwipe = parseInt(searchH) + parseInt(headerH) - 1,
searchArray = [];
minBrandListTop;
var brandsData,
$keyword,
clearTextHammer,
removeHistory,
searchList,
yohoHistory;
clearTextHammer;
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
... ... @@ -42,13 +37,15 @@ $('.yoho-header').css({
});
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
$fixTitleBar.hide();
$fixTitleBar.css({
position: 'fixed',
top: brandSwipe
}).hide();
minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() + $('.banner-top').outerHeight();
$('.brand-list').last().append($fixTitleBar);
$(window).scroll(function() {
var scrTop = $(window).scrollTop(),
minBrandListTop = brandSwipe + $('.hot-brand').outerHeight() +
$('.banner-top').outerHeight();
var scrTop = $(window).scrollTop();
if ($brandList.eq(0).offset().top < minBrandListTop) {
$fixTitleBar.hide();
... ... @@ -59,9 +56,7 @@ $(window).scroll(function() {
if (scrTop >= offTop) {
$fixTitleBar.css({
display: 'block',
position: 'fixed',
top: brandSwipe
display: 'block'
}).find('h2').html($(this).find('.title-bar').text());
}
... ... @@ -70,10 +65,12 @@ $(window).scroll(function() {
function rightBarBindClick() {
$('#right-bar .con').find('b').unbind().on('touchstart', function(e) {
var index = $(this).index();
var index = $(this).index(),
top;
if ($('.bar-' + index).size() > 0) {
document.body.scrollTop = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
top = parseInt($('.bar-' + index)[0].offsetTop) - parseInt(brandSwipe - 1);
$(document).scrollTop(top);
}
e.stopPropagation();
});
... ... @@ -146,21 +143,6 @@ function searchResult() {
if (Object.keys(result).length > 0) {
rightBarBindClick();
}
$('.search-result .brand-list p').each(function (index) {
searchList = new Hammer($('.search-result .brand-list p').eq(index)[0]);
searchList.on('tap', function() {
$brandText = $('.search-result .brand-list p').eq(index).find('a').html();
$brandHref = $('.search-result .brand-list p').eq(index).find('a').attr('href');
if (localStorage.getItem('yohoHistory')) {
yohoHistory = localStorage.getItem('yohoHistory');
searchArray.push(yohoHistory);
}
if (searchArray.toString().split($brandText).length < 2) {
searchArray.push('{"searchName":"' + $brandText + '","searchHref":"' + $brandText + '"}');
}
localStorage.setItem('yohoHistory', searchArray);
});
});
}
if ($('.brand-search-page').length) {
... ... @@ -168,7 +150,6 @@ if ($('.brand-search-page').length) {
$keyword = $('#keyword');
$keyword.on('input', function() {
$('.history').css('display', 'none');
if ($keyword.val().length) {
searchResult();
$(this).closest('.search-box').css('width', '11.25rem');
... ... @@ -182,6 +163,7 @@ if ($('.brand-search-page').length) {
clearTextHammer = new Hammer($('.clear-text')[0]);
clearTextHammer.on('tap', function(e) {
e.preventDefault();
$('.search-result').html('');
$('#keyword').val('').trigger('input');
e.srcEvent.stopPropagation();
});
... ... @@ -189,18 +171,4 @@ if ($('.brand-search-page').length) {
$('form.search-box').on('submit', function() {
return false;
});
if (localStorage && localStorage.getItem('yohoHistory')) {
yohoHistory = $.parseJSON('[' + localStorage.getItem('yohoHistory') + ']');
if (yohoHistory) {
$.each(yohoHistory, function(index, content) {
$('<a href="' + content.searchHref + '">' + content.searchName + '</a>').appendTo('.historyList');
});
}
}
removeHistory = new Hammer($('.removeHistory')[0]);
removeHistory.on('tap', function(e) {
$('.historyList').html(' ');
localStorage.clear();
});
}
... ...
... ... @@ -94,6 +94,8 @@ function thumbTouchEvt(e) {
scrollTop: $coBlock.offset().top
}, 400);
}
myScroll.refresh();
}
if (isIphone) {
... ...
... ... @@ -5,16 +5,16 @@
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
var tip = require('../plugin/tip');
var loading = require('../plugin/loading');
var $loadMoreInfo = $('#load-more-info');
var $loading = $(''),
$noMore = $('');
$noMore = $('');
var searching = false;
... ... @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) {
$infos.each(function() {
var $this = $(this),
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
$title[0].mlellipsis(2);
$text[0].mlellipsis(2);
... ... @@ -51,9 +51,10 @@ function initInfosEvt($container) {
cHammer.on('tap', function(e) {
var $this = $(e.target),
opt = 'ok',
$likeBtn,
$info;
opt = 'ok',
$likeBtn,
$collectBtn,
$info;
$likeBtn = $this.closest('.like-btn');
if ($likeBtn.length > 0) {
... ... @@ -84,6 +85,34 @@ function initInfosEvt($container) {
}
});
}
// 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!
$collectBtn = $this.closest('.collect-btn');
if ($collectBtn.length > 0) {
if ($collectBtn.hasClass('collected')) {
opt = 'cancel';
}
$info = $this.closest('.guang-info');
$.ajax({
type: 'POST',
url: '/guang/opt/collectArticle',
data: {
id: $info.data('id'),
opt: opt
},
success: function(data) {
if (data.code && data.code === 200) {
//切换收藏状态
$collectBtn.toggleClass('collected');
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
}
});
setLazyLoadAndMellipsis($container.find('.guang-info'));
... ...
... ... @@ -26,7 +26,7 @@ var requestFrame,
$logotrans = $('.home-header .logo'),
isen = true;
var navHammer, mobileWrapHammer;
var navHammer;
require('./maybe-like');
... ... @@ -53,23 +53,18 @@ navHammer.on('tap', function(event) {
function hideSideBar() {
if ($mobileWrap.hasClass('menu-open')) {
$mobileWrap.removeClass('menu-open');
$overlay.css('opacity', 0);
$('.overlay').hide();
$('.sub-nav').removeClass('show');
$sideNav.removeClass('on');
$('body').css({
height: 'auto',
overflow: 'auto'
});
setTimeout(function() {
$('.overlay').hide();
}, 300);
}
}
mobileWrapHammer = new Hammer($('.mobile-wrap')[0]);
mobileWrapHammer.on('tap', function(e) {
$('.overlay').on('touchend', function(e) {
hideSideBar();
e.srcEvent.stopPropagation();
return false;
});
... ... @@ -210,3 +205,9 @@ function tsAnimate() {
}
setTimeout(tsAnimate, 3000);
// 底部留出tab 的高度
$('#yoho-footer').css({
'margin-bottom': '2.5rem'
});
... ...
... ... @@ -12,7 +12,6 @@ var $ = require('jquery'),
var navHammer,
winH = $(window).height(),
loadMoreH = $('#load-more').height(),
$goodList = $('#goods-list'),
searching = false,
page = 0,
... ... @@ -140,7 +139,7 @@ $('.maybe-like p').on('touchstart', function (e) {
//srcoll to load more
$(window).scroll(function () {
if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {
if ($(window).scrollTop() + winH >= $(document).height()) {
search();
}
});
\ No newline at end of file
... ...
... ... @@ -53,4 +53,5 @@ $('.no-search').on('touchend', function() {
hideBigSearch();
});
window.rePosFooter && window.rePosFooter();
// 底部计算有误
// window.rePosFooter && window.rePosFooter();
... ...
... ... @@ -31,6 +31,8 @@ var defaultOpt = {
gender: $('#gender').val(),
brand: $('#brand').val(),
sort: $('#sort').val(),
msort: $('#msort').val(),
misort: $('#misort').val(),
color: $('#color').val(),
size: $('#size').val(),
price: $('#price').val(),
... ...
... ... @@ -29,6 +29,8 @@ var defaultOpt = {
gender: $('#gender').val(),
brand: $('#brand').val(),
sort: $('#sort').val(),
msort: $('#msort').val(),
misort: $('#misort').val(),
color: $('#color').val(),
size: $('#size').val(),
price: $('#price').val(),
... ...
... ... @@ -32,6 +32,8 @@ var defaultOpt = {
gender: $('#gender').val(),
brand: $('#brand').val(),
sort: $('#sort').val(),
msort: $('#msort').val(),
misort: $('#misort').val(),
color: $('#color').val(),
size: $('#size').val(),
price: $('#price').val(),
... ...
... ... @@ -13,7 +13,7 @@ $.ajax({
url: '/cart/index/count',
success: function(data) {
if (data.code === 200) {
$cart.find('.cart-count').html(data.data.cart_good_count).removeClass('hide');
$cart.find('.cart-count').html(data.data.cart_goods_count).removeClass('hide');
}
}
});
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@
padding: 14rem / $pxConvertRem 3.125%;
background-color: #f8f8f8;
left: 0;
top: 88rem / $pxConvertRem;
top: 90rem / $pxConvertRem;
position: fixed;
z-index: 2;
... ... @@ -55,11 +55,14 @@
right: -74rem / $pxConvertRem;
font-size: 32rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
color: #666;
color: #bdbdbd;
}
.cancel-btn {
display: inline;
color: #bdbdbd;
font-size: 32rem / $pxConvertRem;
vertical-align: middle;
}
.clear-text {
... ... @@ -86,9 +89,15 @@
.img-box {
display: table-cell;
vertical-align: middle;
width: 100%;
text-align: center;
width: 158rem / $pxConvertRem;
height: 158rem / $pxConvertRem;
}
img {
max-width: 140rem / $pxConvertRem;
max-height: 140rem / $pxConvertRem;
}
}
}
}
... ... @@ -132,15 +141,15 @@
display: inline-block;
margin-top: -4rem / $pxConvertRem;
margin-left: 24rem / $pxConvertRem;
width: 58rem / $pxConvertRem;
height: 38rem / $pxConvertRem;
width: 108rem / $pxConvertRem;
height: 42rem / $pxConvertRem;
text-align: center;
vertical-align: middle;
font-size: 18rem / $pxConvertRem;
line-height: 38rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
line-height: 44rem / $pxConvertRem;
color: #fff;
border-radius: 50rem / $pxConvertRem;
;
@include scale(.8)
}
.icon-hot {
... ... @@ -186,49 +195,4 @@
padding-top: 176rem / $pxConvertRem;
}
.history{
width: 100%;
height: auto;
overflow: hidden;
position: absolute;
left: 0;
top: 176rem / $pxConvertRem;
> h6{
width: 100%;
height: 88rem / $pxConvertRem;
line-height: 88rem / $pxConvertRem;
color: #999;
text-indent: .6rem;
font-size: 36em / $pxConvertRem;
}
.historyList{
width: 100%;
height: auto;
overflow: hidden;
display: block;
> a{
width: auto;
height: 58rem / $pxConvertRem;
overflow: hidden;
line-height: 58rem / $pxConvertRem;
margin: 0 0 20rem / $pxConvertRem .6rem;
padding: 0 20rem / $pxConvertRem;
float: left;
background-color:#f8f8f8;
color: #444;
}
}
> span{
width: auto;
height: 68rem / $pxConvertRem;
overflow: hidden;
display: inline-block;
line-height: 68rem / $pxConvertRem;
border:1px solid #e6e6e6;
padding: 0 28rem / $pxConvertRem;
font-size: 48em / $pxConvertRem;
margin-left: .6rem;
color: #000;
}
}
}
... ...
... ... @@ -44,7 +44,7 @@
.collect-btn {
margin-left: 20rem / $pxConvertRem;
&.collected {
color: #444;
color: #D62927;
}
}
}
... ...
... ... @@ -11,11 +11,16 @@
}
}
.classify-list {
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}
.classify-list > li {
float: left;
width: 212rem / $pxConvertRem;
height: 192rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
border-right: 1px solid #e0e0e0;
}
... ...
... ... @@ -17,14 +17,15 @@
overflow: hidden;
.brand-logo {
width: 100%;
display: table-cell;
width: 158rem / $pxConvertRem;
height: 128rem / $pxConvertRem;
line-height: 128rem / $pxConvertRem;
text-align: center;
font-size: 0;
vertical-align: middle;
img {
vertical-align: middle;
max-width: 100%;
max-height: 100%;
}
... ...
... ... @@ -26,7 +26,6 @@
right: 0;
bottom: 0;
background: #000;
opacity: 0;
z-index: 4;
@include transition(opacity 1s);
}
... ...
.maybe-like {
position: relative;
background: #fff;
padding-left: 15rem / $pxConvertRem;
border-top: 1px solid #ccc;
// border-bottom: 1px solid #ccc;
margin-top: 30rem / $pxConvertRem;
&:before {
content: '';
position: absolute;
border-top: 1px solid #ccc;
left: 0;
top: 80rem / $pxConvertRem;
width: 640rem / $pxConvertRem;
height: 0;
}
.title {
height: 104rem / $pxConvertRem;
font-size: 38rem / $pxConvertRem;
... ...
... ... @@ -2,4 +2,5 @@
display: block;
width: 100%;
height: 198rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
}
\ No newline at end of file
... ...
... ... @@ -36,8 +36,9 @@
height: 44px;
text-align: center;
color: #fff;
background-image: linear-gradient(#323232, #0f0f0f);
border-radius: 10px;
@include background(linear-gradient(#323232, #0f0f0f));
// background-image: linear-gradient(#323232, #0f0f0f);
}
}
... ...
... ... @@ -98,7 +98,7 @@
min-height: 800rem / $pxConvertRem;
.index-channel-list {
margin-top: -50%;
margin-top: -300rem / $pxConvertRem;
width: 100%;
position: absolute;
top: 50%;
... ...
... ... @@ -27,7 +27,7 @@
.clear-input {
position: absolute;
top: 24rem / $pxConvertRem;
right: 110rem / $pxConvertRem;
right: 100rem / $pxConvertRem;
font-size: 32rem / $pxConvertRem;
color: #b2b2b2;
}
... ... @@ -35,9 +35,10 @@
.search {
position: absolute;
top: 20rem / $pxConvertRem;
right: 0;
right: 12rem / $pxConvertRem;
border: none;
background: transparent;
color: #b2b2b2;
font-size: 32rem / $pxConvertRem;
}
}
... ...
... ... @@ -3,8 +3,7 @@
<div class="newbrand-search">
<div class="search-box clearfix">
<a href="{{searchUrl}}" >
<!-- <input type="text" class="search-input" placeholder="查找品牌"> -->
<span>查找品牌</span>
<input type="text" class="search-input" placeholder="查找品牌" readonly="true">
<i class="search-icon iconfont">&#xe60f;</i>
</a>
</div>
... ...
... ... @@ -10,12 +10,6 @@
</div>
</form>
</div>
<div class="history">
<h6>历史纪录</h6>
<div class="historyList">
</div>
<span class='removeHistory'>清空搜索历史</span>
</div>
<div class="search-result">
</div>
</div>
... ...
... ... @@ -7,7 +7,7 @@
<a href="javascript:void(0);" class="no-search">取消</a>
<div class="search-box">
<input type="hidden" name="from" value="search">
<input type="text" name="query" placeholder="搜索">
<input type="text" name="query" placeholder="搜索" autocomplete="off">
<span class="iconfont clear-text">&#xe623;</span>
<span class="iconfont search-icon">&#xe60f;</span>
</div>
... ...
... ... @@ -7,7 +7,7 @@
<input type="text" placeholder="搜索商品" name="query">
<input type="hidden" name="from" value="search">
<i class="clear-input iconfont hide">&#xe626;</i>
<button id="search" class="search" type="submit">搜索</button>
<span id="search" class="search" type="submit">搜索</span>
</form>
</div>
<div class="search-items">
... ...
... ... @@ -3,7 +3,7 @@
{{> passport/header}}
<div class="content">
<div class="input-container row has-eye">
<input id="pwd" class="input pwd" type="text" placeholder="请输入密码" autocomplete="off" maxlength="20">
<input id="pwd" class="input pwd" type="password" placeholder="请输入密码" autocomplete="off" maxlength="20">
</div>
<span id="btn-sure" class="btn btn-sure disable row">确定</span>
</div>
... ...
... ... @@ -50,6 +50,14 @@
<input id="sort" type="hidden" value={{sort}}>
{{/if}}
{{#if msort}}
<input id="msort" type="hidden" value={{msort}}>
{{/if}}
{{#if misort}}
<input id="misort" type="hidden" value={{misort}}>
{{/if}}
{{#if color}}
<input id="color" type="hidden" value={{color}}>
{{/if}}
... ...
... ... @@ -61,6 +61,14 @@
<input id="sort" type="hidden" value={{sort}}>
{{/if}}
{{#if msort}}
<input id="msort" type="hidden" value={{msort}}>
{{/if}}
{{#if misort}}
<input id="misort" type="hidden" value={{misort}}>
{{/if}}
{{#if color}}
<input id="color" type="hidden" value={{color}}>
{{/if}}
... ...
... ... @@ -9,7 +9,6 @@
<a href="javascript:;">
{{/ url}}
{{# img}}
<!-- <img class="nav-img" src="{{.}}" alt=""> -->
<span class="nav-img" style="background-image: url({{.}})"></span>
{{/ img}}
{{^ img}}
... ...
... ... @@ -101,6 +101,14 @@
<input id="sort" type="hidden" value={{sort}}>
{{/if}}
{{#if msort}}
<input id="msort" type="hidden" value={{msort}}>
{{/if}}
{{#if misort}}
<input id="misort" type="hidden" value={{misort}}>
{{/if}}
{{#if color}}
<input id="color" type="hidden" value={{color}}>
{{/if}}
... ...
... ... @@ -2,5 +2,5 @@
<a href={{cartUrl}}>
<span class="iconfont">&#xe62c;</span>
</a>
<span class="cart-count hide">1</span>
<span class="cart-count hide">0</span>
</div>
\ No newline at end of file
... ...
<?php
/**
* 错误错误控制器
*
... ... @@ -10,26 +11,33 @@ use Action\AbstractAction;
class ErrorController extends AbstractAction
{
public function indexAction()
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
$this->_view->display('index');
}
public function errorAction($exception)
{
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
// @todo debug
echo $exception->getMessage();
// // 生成HTML (error.html)
// $this->_view->html('error');
// // 渲染模板
// $this->_view->display('error');
//echo $exception->getMessage();
// 设置网站标题
$this->setTitle('页面不存在');
$this->setNavHeader('抱歉,页面不存在!', true, SITE_MAIN);
// 生成HTML (error.html)
$this->_view->html('error');
// 渲染模板
$this->_view->display('index', array(
'pageFooter' => true,
'showDownloadApp' => true,
));
}
}
... ...
... ... @@ -154,6 +154,9 @@ class SearchController extends AbstractAction
// 显示底部悬浮下载
$data['showDownloadApp'] = true;
// 显示页面底部登录信息
$data['pageFooter'] = true;
// // 查询数据
// if (!isset($condition['query'])) {
... ...
... ... @@ -99,7 +99,7 @@ class HomeModel
// 调用接口获取数据
$banner = IndexData::getBannerStart(self::CODE_BG);
if (isset($banner['data'][0]['data']['list'][0]['src'])) {
$result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 1);
$result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 2);
}
if (USE_CACHE) {
... ...
... ... @@ -217,7 +217,7 @@ class NewsaleModel
{
$result = array();
if (isset($data['code']) && $data['code'] === 200) {
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
foreach ($data['data']['product_list'] as $val) {
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388);
}
... ...
... ... @@ -49,8 +49,6 @@ class IndexController extends AbstractAction
*/
public function tagAction()
{
$uid = $this->getUid();
$udid = $this->getUdid();
$tag = $this->get('query');
$channel = $this->get('yh_channel');
... ... @@ -68,11 +66,22 @@ class IndexController extends AbstractAction
default: // 所有
$gender = '1,2,3';
}
$uid = $this->get('uid');
$udid = $this->get('udid');
if ($uid) {
$this->setSession('uid', $uid);
}
if ($udid) {
$this->setSession('udid', $udid);
}
}
// 从Cookie获取
else {
$gender = Helpers::getGenderByCookie();
$uid = $this->getUid();
$udid = $this->getUdid();
$this->setNavHeader($tag, true, SITE_MAIN);
}
... ... @@ -92,7 +101,7 @@ class IndexController extends AbstractAction
// 构建资讯文章内容
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, $isApp);
$build[] = Helpers::formatArticle($article, true, $isApp, true, $uid);
}
$data['guang']['infos'] = $build;
... ... @@ -129,11 +138,22 @@ class IndexController extends AbstractAction
default: // 所有
$gender = '1,2,3';
}
$uid = $this->get('uid');
$udid = $this->get('udid');
if ($uid) {
$this->setSession('uid', $uid);
}
if ($udid) {
$this->setSession('udid', $udid);
}
}
// 从Cookie获取
else {
$gender = Helpers::getGenderByCookie();
$uid = $this->getUid();
$udid = $this->getUdid();
$this->setNavHeader('编辑简介', true, SITE_MAIN);
}
... ... @@ -146,9 +166,6 @@ class IndexController extends AbstractAction
$this->setTitle('编辑简介');
$uid = $this->getUid();
$udid = $this->getUdid();
$data = array();
// 模板中使用JS的标识
$data['guangList'] = true;
... ... @@ -166,7 +183,7 @@ class IndexController extends AbstractAction
if (!empty($article['data']['list']['artList'])) {
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, $isApp, false);
$build[] = Helpers::formatArticle($article, true, $isApp, false, $uid);
}
$data['guang']['infos'] = $build;
}
... ... @@ -216,8 +233,13 @@ class IndexController extends AbstractAction
}
/* 获取资讯文章列表 */
$uid = $this->getUid();
$udid = $this->getUdid();
if ($isApp) {
$uid = $this->getSession('uid');
$udid = $this->getSession('udid');
} else {
$uid = $this->getUid();
$udid = $this->getUdid();
}
//$page = intval($page) + 1;
$article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId);
if (empty($article['data']['list']['artList'])) {
... ... @@ -228,16 +250,17 @@ class IndexController extends AbstractAction
$data = array();
$build = array();
foreach ($article['data']['list']['artList'] as $article) {
$build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor);
$build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid);
}
$data['infos'] = $build;
$this->_view->display('page', $data);
exit();
} while (false);
echo ' ';
if (isset($data)) {
$this->_view->display('page', $data);
} else {
echo ' ';
}
}
}
... ...
... ... @@ -3,6 +3,7 @@
use Action\AbstractAction;
use LibModels\Wap\Guang\DetailData;
use LibModels\Wap\Product\ListData;
use LibModels\Wap\Guang\OptData;
use Plugin\Helpers;
/**
... ... @@ -36,7 +37,7 @@ class InfoController extends AbstractAction
// WAP上设置头部导航
if (!$isApp) {
$this->setNavHeader('逛', true, SITE_MAIN);
}
}
$data = array();
$data['guangDetail'] = true; // 模板中使用JS的标识
... ... @@ -99,7 +100,7 @@ class InfoController extends AbstractAction
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false, true, true, 235,314);
$good[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
}
}
// 没有商品
... ... @@ -130,7 +131,7 @@ class InfoController extends AbstractAction
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
$good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235,314);
$good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp);
}
$build['collocation'][] = $good;
}
... ... @@ -187,5 +188,29 @@ class InfoController extends AbstractAction
$detail = array();
$data = array();
}
/**
* APP里使用的收藏内容的接口
*
* @param id 资讯ID
* @param type "fav"表示收藏 或者 "cancel"表示取消收藏
* @return json
*/
public function collectAction()
{
do {
if (!$this->isAjax()) {
break;
}
$id = $this->get('id');
$type = $this->get('type');
// 收藏
if ($type == 'fav') {
}
}
while (false);
}
}
... ...
... ... @@ -2,14 +2,16 @@
use Action\AbstractAction;
use LibModels\Wap\Guang\OptData;
use Plugin\Helpers;
/**
* 逛操作
*/
class OptController extends AbstractAction
{
/**
* 资讯文章点赞
/**
* 资讯文章点赞 (H5里显示点赞)
*
* @param int $id 唯一的资讯ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
... ... @@ -18,29 +20,73 @@ class OptController extends AbstractAction
public function praiseArticleAction()
{
$result = array();
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$id = $this->post('id');
if (!is_numeric($id)) {
break;
}
/* 执行点赞或取消操作 */
$opt = $this->post('opt', 'ok');
$udid = $this->getUdid();
$result = OptData::praiseArticle($udid, $id, $opt);
}
while (false);
} while (false);
$this->echoJson($result);
}
/**
* 资讯文章收藏 (APP里显示收藏)
*
* @param int $id 唯一的资讯ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return json
*/
public function collectArticleAction()
{
$result = array('code' => 400, 'message' => '您未登录,无法收藏或者取消收藏。请先登录!', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$id = $this->post('id');
if (!is_numeric($id)) {
break;
}
/* 判断用户是否登录 */
$uid = $this->getSession('uid');
if (empty($uid) || !is_numeric($uid)) {
break;
}
/* 执行点赞或取消操作 */
$opt = $this->post('opt', 'ok');
$data = OptData::collectArticle($uid, $id, $opt);
if (!$data) {
$result = array('code' => 400, 'message' => '操作失败', 'data' => '');
break;
}
$result = array('code' => 200, 'message' => '成功', 'data' => '');
} while (false);
$this->echoJson($result);
}
/**
* 品牌收藏
*
... ... @@ -50,20 +96,21 @@ class OptController extends AbstractAction
*/
public function favoriteBrandAction()
{
$result = array('code' => 400, 'message' => '未登录', 'data' => false);
$refer = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/')));
$result = array('code' => 400, 'message' => '未登录', 'data' => $refer);
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否有效 */
$id = $this->post('id');
if (!is_numeric($id)) {
break;
}
/* 检查用户是否登录 */
$uid = $this->getUid();
if (!$uid) {
... ... @@ -76,11 +123,11 @@ class OptController extends AbstractAction
if (!$status) {
break;
}
$result = array('code' => 200, 'message' => '收藏成功', 'data' => $status);
}
while (false);
$result = array('code' => 200, 'message' => '收藏成功', 'data' => '');
} while (false);
$this->echoJson($result);
}
}
... ...
... ... @@ -30,7 +30,7 @@ class PlusstarController extends AbstractAction
$data['psList'] = true; // 控制模板中的JS使用
$data['ps']['sName'] = '明星潮品';
$data['ps']['pName'] = '原创潮牌';
$data[ 'pageFooter'] = true;
$data['pageFooter'] = true;
$this->_view->display('list', $data);
} else {
... ... @@ -41,7 +41,7 @@ class PlusstarController extends AbstractAction
$data['psList'] = true; // 控制模板中的JS使用
$data['ps']['sName'] = '设计师';
$data['ps']['pName'] = '经典潮牌';
$data[ 'pageFooter'] = true;
$data['pageFooter'] = true;
$this->_view->display('list', $data);
}
... ... @@ -75,30 +75,54 @@ class PlusstarController extends AbstractAction
{
$data = array();
$id = $this->get('id');
$gender = $this->get('gender', '1,3');
$uid = $this->getUid();
$udid = $this->getUdid();
do {
/* 判断参数是否有效 */
if (!is_numeric($id) || ($gender !== '1,3' && $gender !== '2,3')) {
$id = $this->get('id');
if (!is_numeric($id)) {
break;
}
$channel = $this->get('yh_channel');
// 标识是不是APP客户端
$isApp = is_numeric($channel);
// APP访问时通过频道参数判断性别
if ($isApp) {
switch (intval($channel)) {
case 1: // 男
$gender = '1,3';
break;
case 2: // 女
$gender = '2,3';
break;
default: // 所有
$gender = '1,2,3';
}
$uid = $this->get('uid');
$udid = $this->get('udid');
}
// 从Cookie获取
else {
$gender = Helpers::getGenderByCookie();
$uid = $this->getUid();
$udid = $this->getUdid();
}
/* 判断品牌信息是否为空 */
$brandInfo = PlusstarData::brandInfo($id, $gender, $uid, $udid);
$brandInfo = PlusstarData::brandInfo($id, $gender, $uid, $udid, $isApp);
if (empty($brandInfo['getBrandInfo']['data']['brand_id'])) {
break;
}
$brandId = $brandInfo['getBrandInfo']['data']['brand_id'];
$brandDomain = $brandInfo['getBrandInfo']['data']['brand_domain'];
$isDifferent = $brandInfo['getBrandInfo']['data']['is_different'];
/* 获取更多品牌的链接 */
$url = '/brands';
$brandDomains = Product\ListModel::getAllBrandDomains();
if (isset($brandDomains[$brandId])) {
// 构建成 品牌域名.xxx.com
$url = Helpers::url('', null, $brandDomains[$brandId]);
// 构建成 品牌域名.xxx.com
$url = Helpers::url('', null, $brandDomain);
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if ($isApp) {
$url .= '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' . $brandId . '","is_different":"' . $isDifferent . '"}}';
}
$data['psDetail'] = true;
... ... @@ -107,12 +131,23 @@ class PlusstarController extends AbstractAction
$data['ps']['logo'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['brand_ico'], 160, 160);
$data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name'];
$data['ps']['isLike'] = $brandInfo['getUidBrandFav'];
$data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&amp;openby:yohobuy={&quot;action&quot;:&quot;go.weblogin&quot;,&quot;params&quot;:{&quot;jumpurl&quot;:{&quot;url&quot;:&quot;http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo&quot;,&quot;param&quot;:{&quot;id&quot;:285}},&quot;requesturl&quot;:{&quot;url&quot;:&quot;\/guang\/api\/v1\/favorite\/togglebrand&quot;,&quot;param&quot;:{&quot;brand_id&quot;:&quot;701&quot;}},&quot;priority&quot;:&quot;Y&quot;}}";
$data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array('&nbsp;' => ' '));
$data['ps']['newArrival'] = array();
$data['ps']['newArrival']['moreUrl'] = $url;
$data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct'];
$data['ps']['infos'] = array();
// 拼收藏的URL, 一个坑!
// 备注:此处是根据原来逛的代码硬扒过来的
$defaultUrl = Helpers::url('/plustar/brandinfo', array('id' => $id), 'guang');
if ($isApp) {
$url = $defaultUrl;
$url .= '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
. $id . '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' . $brandId . '"}},"priority":"Y"}}';
} else {
$url = Helpers::url('/signin.html', array('refer' => $defaultUrl));
}
$data['ps']['likeUrl'] = $url;
if (empty($brandInfo['getArticleByBrand'])) {
break;
... ... @@ -120,11 +155,22 @@ class PlusstarController extends AbstractAction
// 相关文章
foreach ($brandInfo['getArticleByBrand'] as $value) {
$data['ps']['infos'][] = Helpers::formatArticle($value, false, false, false);
$data['ps']['infos'][] = Helpers::formatArticle($value, false, false, false, $uid);
}
// 设置头部信息
if (!$isApp) {
$this->setNavHeader($data['ps']['name'], true, SITE_MAIN);
}
$this->setNavHeader($brandInfo['getBrandInfo']['data']['brand_name'], true, SITE_MAIN);
// 标识有微信分享
$data['hasWxShare'] = true;
$data['shareLink'] = $defaultUrl;
$data['shareTitle'] = $data['ps']['name'];
$data['shareDesc'] = (mb_strlen($data['ps']['intro'],'utf-8') > 800) ? mb_substr($data['ps']['intro'], 0, 800, 'utf-8') . '...' : $data['ps']['intro'];
$data['shareImg'] = $data['ps']['logo'];
$brandInfo = array();
} while (false);
... ... @@ -134,7 +180,6 @@ class PlusstarController extends AbstractAction
} else {
$this->_view->display('detail', $data);
}
}
}
... ...
... ... @@ -92,9 +92,12 @@ class BackController extends AbstractAction
public function successAction()
{
$this->setTitle('找回密码-通过邮箱');
$email = $this->get('email', '');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!Helpers::verifyEmail($email)) {
$this->error();
}
// 获取到邮箱域名
list($name, $domain) = explode('@', $email);
$domain_name = 'http://' . (($domain == 'gmail.com') ? 'mail.google.com' : 'mail.' . $domain);
... ... @@ -108,6 +111,7 @@ class BackController extends AbstractAction
'resendUrl' => '/passport/back/resendemail?email='.$email
);
$this->setTitle('找回密码-通过邮箱');
$this->_view->display('email-success', $data);
}
... ... @@ -147,11 +151,11 @@ class BackController extends AbstractAction
'isPassportPage' => true,
'backMobile' => true,
'countrys' => RegData::getAreasData(),
'countryCode' => '+86'
'areaCode' => '+86'
);
// 生成HTML (phoneback.html)
$this->_view->html('phoneback');
// $this->_view->html('phoneback');
$this->_view->display('mobile', $data);
}
... ... @@ -178,10 +182,14 @@ class BackController extends AbstractAction
}
// 发送手机验证码
$return = BackData::sendCodeToMobile($phoneNum, $areaCode);
if($return && $return['code'] === 200)
$result = BackData::sendCodeToMobile($phoneNum, $areaCode);
if(empty($result))
{
break;
}
if($result['code'] === 200)
{
$result = $return;
$result['data'] = '/passport/back/mobilecode?phoneNum='.$phoneNum.'&areaCode='.$areaCode;
}
... ... @@ -201,7 +209,7 @@ class BackController extends AbstractAction
$areaCode = '+'.$areaCode;
$data = array(
'backUrl' => '/mobileback.html',
'backUrl' => '/phoneback.html',
'headerText' => '找回密码',
'isPassportPage' => true,
'backCode' => true,
... ...
... ... @@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction
'size' => '0',
'dayLimit' => 1,
'discount' => '',
'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)),
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('new', $data);
... ... @@ -63,7 +63,7 @@ class NewsaleController extends AbstractAction
'price' => '0',
'size' => '0',
'discount' => '0.1,0.9',
'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)),
'cartUrl' => Helpers::url('/cart/index/index', null),
);
$this->_view->display('sale', $data);
... ...
... ... @@ -21,7 +21,7 @@ routes.plusstar.route.action = Index
; 国际优选/明星原创详情
routes.brandinfo.type = "rewrite"
routes.brandinfo.match = "/(plustar/brandinfo)$"
routes.brandinfo.match = "/(plustar/brandinfo|guang/plustar/brandinfo)$"
routes.brandinfo.route.module = Guang
routes.brandinfo.route.controller = Plusstar
routes.brandinfo.route.action = detail
... ...