Authored by Rock Zhang

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

Showing 34 changed files with 222 additions and 199 deletions
... ... @@ -39,6 +39,7 @@ class CacheConfig
const KEY_ACTION_PRODUCT_BRAND_DOMAINS = 'key_action_product_brand_domains'; // 所有品牌域名列表
const KEY_ACTION_PRODUCT_BRAND_NAMES = 'key_action_product_brand_names'; // 所有品牌名称列表
const KEY_ACTION_PRODUCT_BRAND_LOGO = 'key_action_product_brand_logo'; // 品牌信息
const KEY_ACTION_PRODUCT_BRAND_LOGO_DOMAIN = 'key_action_product_brand_logo_domain'; // 品牌信息通过域名取得
const KEY_ACTION_SEARCH_SEARCH = 'key_action_search_search'; // 搜索的数据
const KEY_ACTION_SEARCH_FILTER = 'key_action_search_filter'; // 搜索的过滤条件
... ...
... ... @@ -212,5 +212,16 @@ class BrandData
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . '/shops/service/v1/brand', 'getBrandByids', array($id ));
}
/**
* 通过域名获取品牌LOGO信息
*
* @param int $id 用户ID
* @return array
*/
public static function getBrandLogoByDomain($domain)
{
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . '/shops/service/v1/brand', 'getBrandByDomain', array($domain ));
}
}
... ...
... ... @@ -15,6 +15,7 @@ use Api\Yohobuy;
*/
class DetailData
{
const URI_PACKAGE_ARTICLE = 'guang/service/v2/article/';
const URI_PACKAGE_AUTHOR = 'guang/service/v1/author/';
... ... @@ -36,15 +37,13 @@ class DetailData
// 客户端类型
$clientType = $isApp ? 'iphone' : 'h5';
// 获取资讯
$article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType));
if (!isset($article['tag'])) {
$article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), 3600);
if (!isset($article['author_id'])) {
return $result;
}
else {
$result['getArticle'] = $article;
}
$result['getArticle'] = $article;
// 获取作者信息
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR, 'getAuthor', array($article['author_id'], $clientType), function ($retval) use (&$result) {
... ... @@ -62,9 +61,11 @@ class DetailData
});
// 获取资讯相关的其它资讯
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3, $clientType), function ($retval) use (&$result) {
$result['getOtherArticle'] = empty($retval) ? array() : $retval;
});
if (isset($article['tag'])) {
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3, $clientType), function ($retval) use (&$result) {
$result['getOtherArticle'] = empty($retval) ? array() : $retval;
});
}
// 调用发起请求
Yohobuy::yarConcurrentLoop();
... ...
... ... @@ -11,19 +11,12 @@ var $ = require('jquery'),
var swiper,
$fixTitleBar,
$brandText,
$brandHref,
$brandList = $('.brand-list');
var $icon = $('.search-icon');
var searchH = $('.newbrand-search').outerHeight(),
headerH = $('.yoho-header').outerHeight(),
brandSwipe = parseInt(searchH) + parseInt(headerH) - 1,
minBrandListTop,
searchArray = [],
clearTextHammer,
removeHistory,
searchList,
yohoHistory,
minBrandListTop;
var brandsData,
... ... @@ -117,21 +110,6 @@ function searchResult() {
// 插入 dom,绑定事件
$('.search-result').html(html);
$('.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) {
... ... @@ -139,12 +117,13 @@ if ($('.brand-search-page').length) {
$keyword = $('#keyword');
$keyword.on('input', function() {
$('.history').css('display', 'none');
if ($keyword.val().length) {
searchResult();
$icon.css('color', '#000');
$(this).closest('.search-box').css('width', '11.25rem');
$('.search-action').show();
} else {
$icon.css('color', '#b2b2b2');
$(this).closest('.search-box').css('width', '12.5rem');
$('.search-action').hide();
}
... ... @@ -161,20 +140,5 @@ 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');
});
}
} else {
$('.history').css('display', 'none');
}
removeHistory = new Hammer($('.removeHistory')[0]);
removeHistory.on('tap', function(e) {
$('.historyList').html(' ');
localStorage.clear();
});
}
... ...
... ... @@ -119,7 +119,7 @@ function rePosFooter() {
//未登录
$op.prepend(
'<a href="/signin.html">登录</a>' +
'<a href="/signin.html?refer=' + location.href + '">登录</a>' +
'<span class="sep-line">|</span>' +
'<a href="/reg.html">注册</a>'
);
... ...
... ... @@ -215,6 +215,7 @@ $('#yoho-footer').css({
//set cookie
exports.set = function(c) {
window.setCookie('_Channel', c, {
expires: 365
expires: 365,
domain: '.m.yohobuy.com'
});
};
\ No newline at end of file
... ...
... ... @@ -6,28 +6,36 @@
var $ = require('jquery');
var $searchBox = $('.search-box'),
$box = $('.box'),
$indexSearch = $('.index-search'),
$indexLogo = $('.index-logo');
var $search = $searchBox.children('input'),
$cancelSearch = $indexSearch.children('.no-search');
var $search = $searchBox.children('input[type="text"]'),
$cancelSearch = $box.children('.no-search'),
$searchIcon = $searchBox.children('.search-icon');
require('../common');
$search.on('focus', function() {
$indexSearch.addClass('action');
$box.addClass('action');
$indexLogo.addClass('action');
}).on('input', function() {
if ($search.val() === '') {
$searchIcon.addClass('empty');
} else {
$searchIcon.removeClass('empty');
}
});
$cancelSearch.on('touchstart', function() {
$indexSearch.removeClass('action');
$box.removeClass('action');
$indexLogo.removeClass('action');
$search.blur();
});
$searchBox.children('.clear-text').on('touchstart', function() {
$search.val('').focus();
$search.val('').focus().trigger('input');
});
$searchBox.children('.search-icon').on('touchstart', function() {
... ...
... ... @@ -34,10 +34,10 @@ chHammer.on('tap', function() {
$input.on('input', function() {
if ($input.val() === '') {
$icon.css('color','#b2b2b2');
$icon.css('color', '#b2b2b2');
$clear.addClass('hide');
} else {
$icon.css('color','#000');
$icon.css('color', '#000');
$clear.removeClass('hide');
}
});
... ...
... ... @@ -44,7 +44,8 @@
border: none;
width: 95%;
height: 60rem / $pxConvertRem;
line-height: 1;
line-height: 60rem / $pxConvertRem;
font-size: 1.2em;
padding: 0 10rem / $pxConvertRem;
}
... ... @@ -67,6 +68,7 @@
.clear-text {
margin-right: 20rem / $pxConvertRem;
color: #666;
}
}
}
... ... @@ -194,50 +196,4 @@
.search-result {
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;
}
}
}
... ...
.hot-brands {
background: #f0f0f0;
border-bottom: 1px solid #e0e0e0;
background: #fff;
.floor-header {
background: #f0f0f0;
margin: 0;
padding: 29rem / $pxConvertRem 30rem / $pxConvertRem 0;
border: 0;
h2 {
border: 1px solid #e0e0e0;
background: #fff;
border-bottom: 0;
}
}
a {
display: block;
... ... @@ -8,10 +21,6 @@
height: 100%;
}
> * {
background: #fff;
}
.brand {
float: left;
width: 158rem / $pxConvertRem;
... ...
... ... @@ -71,7 +71,13 @@
background: white;
border-radius: 5px;
margin-top: -13px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.5);
&:link,
&:visited,
&:hover,
&:actived {
color: #000;
}
}
.circle-rightbottom {
... ...
... ... @@ -3,6 +3,7 @@
overflow: hidden;
margin: 0 auto;
.index-header {
box-sizing: border-box;
padding: 0 20rem / $pxConvertRem;
width: 100%;
height: 96rem / $pxConvertRem;
... ... @@ -22,49 +23,49 @@
}
}
.index-search {
position: absolute;
top: 0;
right: 0;
width: 384rem / $pxConvertRem;
height: 96rem / $pxConvertRem;
background: #fff;
.box {
position: relative;
overflow: hidden;
z-index: 3;
@include transition(width .4s);
z-index: 1;
&.action {
width: 620rem / $pxConvertRem;
.no-search, .clear-text {
display: block;
}
.search-box {
width: 512rem / $pxConvertRem;
margin-left: 80rem / $pxConvertRem;
}
}
}
.index-search {
height: 96rem / $pxConvertRem;
background: #fff;
overflow: hidden;
@include transition(width .4s);
.search-box {
float: left;
position: relative;
top: 20rem / $pxConvertRem;
width: 352rem / $pxConvertRem;
height: 56rem / $pxConvertRem;
padding-right: 40rem / $pxConvertRem;
z-index: 1;
padding-right: 80rem / $pxConvertRem;
transition: width 400ms;
box-sizing: border-box;
border: 1px solid #ccc;
overflow: hidden;
@include transition(margin-left 0.4s);
}
input {
float: left;
width: 100%;
width: 96%;
font-size: 28rem / $pxConvertRem;
padding: 10rem / $pxConvertRem;
color: #999;
overflow: hidden;
border: none;
-webkit-appearance: none;
}
.iconfont {
position: absolute;
... ... @@ -81,16 +82,22 @@
}
.search-icon {
right: 10rem / $pxConvertRem;
color: #e6e6e6;
color: #000;
&.empty {
color: #e6e6e6;
}
}
}
.no-search {
position: absolute;
display: none;
float: left;
margin-right: 10rem / $pxConvertRem;
color: #999;
font-size: 28rem / $pxConvertRem;
@inlcude transition(display .4s);
}
}
.index-container {
... ...
... ... @@ -29,7 +29,7 @@
top: 24rem / $pxConvertRem;
right: 145rem / $pxConvertRem;
font-size: 32rem / $pxConvertRem;
color: #b2b2b2;
color: #666;
}
.search {
... ... @@ -38,8 +38,8 @@
left: 515rem / $pxConvertRem;
border: none;
background: transparent;
color: #b2b2b2;
font-size: 32rem / $pxConvertRem;
color: #000;
font-size: 30rem / $pxConvertRem;
line-height: 56rem / $pxConvertRem;
}
}
... ...
... ... @@ -32,7 +32,7 @@
}
.list-nav {
border:1px solid #e6e6e6;
border-bottom:1px solid #e6e6e6;
> li {
float: left;
width: 25%;
... ...
... ... @@ -13,7 +13,7 @@
input {
height: 30px;
width: 100%;
width: 95%;
border-radius: 15px;
text-indent: 26px;
background: #fff;
... ... @@ -29,7 +29,7 @@
.search {
position: absolute;
top: 12px;
right: 0;
right: .4rem;
border: none;
background: transparent;
font-size: 16px;
... ...
... ... @@ -32,7 +32,7 @@
}
.list-nav {
border:1px solid #e6e6e6;
border-bottom:1px solid #e6e6e6;
> li {
float: left;
width: 25%;
... ...
... ... @@ -10,11 +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>
... ...
... ... @@ -3,15 +3,17 @@
<div class="index-container">
<div class="index-header clearfix">
<div class="iconfont index-logo">&#xe60e;</div>
<form action="{{searchUrl}}" class="index-search">
<div class="box">
<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="搜索" autocomplete="off">
<span class="iconfont clear-text">&#xe623;</span>
<span class="iconfont search-icon">&#xe60f;</span>
</div>
</form>
<form action="{{searchUrl}}" class="index-search">
<div class="search-box">
<input type="hidden" name="from" value="search">
<input type="text" name="query" placeholder="搜索" autocomplete="off">
<span class="iconfont clear-text">&#xe623;</span>
<span class="iconfont search-icon empty">&#xe60f;</span>
</div>
</form>
</div>
</div>
<div class="index-channel">
<img class="img" src="{{background}}">
... ...
... ... @@ -13,7 +13,7 @@
{{/if}}
{{#if testEnv}}
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/lib.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index.js"></script>
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
... ...
{{# goodList}}
{{# search}}
<div id="search-input" class="search-input">
<form id="search-form" action={{url}} method="get">
<form id="search-form" action="{{url}}" method="get">
<i class="search-icon iconfont">&#xe60f;</i>
<input type="text" value={{default}} name="query">
<input type="text" value="{{default}}" name="query">
<input type="hidden" value="search" name="search">
<i class="clear-input iconfont hide">&#xe61a;</i>
<button id="search" class="search" type="submit">搜索</button>
</form>
... ...
... ... @@ -23,7 +23,7 @@ class BoysController extends AbstractAction
}
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_BOYS);
// 设置网站标题
$this->setTitle('男生首页');
... ...
... ... @@ -18,7 +18,7 @@ class GirlsController extends AbstractAction
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS);
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_GIRLS);
// 设置网站标题
$this->setTitle('女生首页');
... ...
... ... @@ -18,7 +18,7 @@ class KidsController extends AbstractAction
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_KIDS);
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_KIDS);
// 设置网站标题
$this->setTitle('潮童首页');
... ...
... ... @@ -18,7 +18,7 @@ class LifestyleController extends AbstractAction
$this->setExpires(300); // 缓存5分钟
// 设置COOKIE标识用户访问过该页面了
Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_LIFESTYLE);
// Index\HomeModel::setSwitchToCookie(Index\HomeModel::COOKIE_NAME_LIFESTYLE);
// 设置网站标题
$this->setTitle('创意生活首页');
... ...
... ... @@ -16,11 +16,6 @@ class SearchController extends AbstractAction
*/
public function indexAction()
{
// 设置客户端浏览器1小时内不改变
$this->setLastModified(mktime(date('H'), 0, 0, date('n'), date('j'), date('Y')));
// 设置浏览器缓存5分钟
$this->setExpires(300); // 缓存5分钟
$this->setNavHeader('搜索', true, SITE_MAIN);
//$this->_view->html('search');
... ... @@ -251,6 +246,7 @@ class SearchController extends AbstractAction
// $data = Product\ListModel::getClassData($condition);
$data = Product\SearchModel::getSearchData($condition);
} while (false);
if (empty($data['new'])) {
... ...
... ... @@ -168,7 +168,7 @@ class ListModel
}
// 调用接口查询数据
$brandLogo = BrandData::getBrandLogo($id);
$brandLogo = BrandData::getBrandLogo($id); var_dump($brandLogo); exit;
// 处理返回的数据
if (isset($brandLogo['data'][0])) {
$result = array(
... ... @@ -192,6 +192,53 @@ class ListModel
return $result;
}
/**
* 根据品牌ID获取品牌LOGO
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
*/
public static function getBrandLogoByDomain($domain, &$title)
{
$result = false;
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_PRODUCT_BRAND_LOGO_DOMAIN . strval($domain);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口查询数据
$brandLogo = BrandData::getBrandLogoByDomain($domain);
// 处理返回的数据
if (isset($brandLogo['data'])) {
$result = array(
'id' => $brandLogo['data']['id'],
'url' => Helpers::url('', null, $brandLogo['data']['brand_domain']),
'thumb' => Helpers::getImageUrl($brandLogo['data']['brand_ico'], 75, 40),
'name' => $brandLogo['data']['brand_name'],
);
$title = $result['name'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($key, $result); // 缓存1小时
}
}
return $result;
}
/**
* 获取所有的品牌名称列表
... ...
... ... @@ -49,7 +49,7 @@ class SearchModel
// 处理返回的数据
if (isset($listData['code']) && $listData['code'] === 200) {
$result = ListProcess::getListData($listData['data'], false);
}
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ...
... ... @@ -28,6 +28,8 @@ class IndexController extends AbstractAction
$gender = $this->get('gender', '1,2,3');
if (is_string($gender)) {
$gender = rawurldecode($gender);
} else {
$gender = Helpers::getGenderByCookie();
}
// // 设置侧边栏逛的默认选中状态
// if ($gender === '1,3') {
... ...
... ... @@ -26,18 +26,26 @@ class InfoController extends AbstractAction
$this->error();
}
$data = array();
$data['guangDetail'] = true; // 模板中使用JS的标识
$data['guang']['id'] = $id;
// 标识是不是APP访问的
$isApp = null !== $this->get('app_version', null);
// 获取详情内容信息, 异常则跳到错误页面
$detail = DetailData::package($id, $isApp);
if (empty($detail['getArticle'])) {
$this->error();
}
// 标识是否是微信访问
$isWeixin = stripos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false;
// WAP上设置头部导航
if (!$isApp) {
if (!$isApp && !$isWeixin) {
$this->setNavHeader('逛', true, SITE_MAIN);
}
}
// 获取详情内容信息, 异常则跳到错误页面
$detail = DetailData::package($id, $isApp);
if (empty($detail['getArticle'])) {
$this->_view->display('index', $data);
return;
}
$data = array();
$data['guangDetail'] = true; // 模板中使用JS的标识
... ... @@ -179,7 +187,7 @@ class InfoController extends AbstractAction
$data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 320);
}
}
// 标识有微信分享
$data['hasWxShare'] = true;
... ... @@ -188,7 +196,7 @@ class InfoController extends AbstractAction
$detail = array();
$data = array();
}
/**
* APP里使用的收藏内容的接口
*
... ... @@ -202,15 +210,14 @@ class InfoController extends AbstractAction
if (!$this->isAjax()) {
break;
}
$id = $this->get('id');
$type = $this->get('type');
// 收藏
if ($type == 'fav') {
}
}
while (false);
}
} while (false);
}
}
... ...
... ... @@ -85,6 +85,8 @@ class PlusstarController extends AbstractAction
$channel = $this->get('yh_channel');
// 标识是不是APP客户端
$isApp = is_numeric($channel);
// 标识是否是微信访问
$isWeixin = stripos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false;
// APP访问时通过频道参数判断性别
if ($isApp) {
switch (intval($channel)) {
... ... @@ -99,7 +101,7 @@ class PlusstarController extends AbstractAction
}
$uid = $this->get('uid');
$udid = $this->get('udid');
$this->setSession('uid', $uid);
}
// 从Cookie获取
... ... @@ -138,14 +140,14 @@ class PlusstarController extends AbstractAction
$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"}}';
$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));
}
... ... @@ -157,20 +159,20 @@ class PlusstarController extends AbstractAction
// 相关文章
foreach ($brandInfo['getArticleByBrand'] as $value) {
$data['ps']['infos'][] = Helpers::formatArticle($value, false, false, false, $uid);
$data['ps']['infos'][] = Helpers::formatArticle($value, false, $isApp, false, $uid);
}
// 设置头部信息
if (!$isApp) {
if (!$isApp && !$isWeixin) {
$this->setNavHeader($data['ps']['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['shareDesc'] = (mb_strlen($data['ps']['intro'], 'utf-8') > 120) ? mb_substr($data['ps']['intro'], 0, 120, 'utf-8') . '...' : $data['ps']['intro'];
$data['shareImg'] = $data['ps']['logo'];
$brandInfo = array();
... ...
... ... @@ -85,18 +85,23 @@ class IndexController extends AbstractAction
$this->go(SITE_MAIN);
}
/* 通过品牌域名找到对应的品牌ID */
$domainList = Product\ListModel::getAllBrandDomains();
$brandIds = array_keys($domainList, $domain);
// 存标题信息
$title = '';
$brandLogo = Product\ListModel::getBrandLogoByDomain($domain, $title);
$brandId = 0;
if (isset($brandIds[0])) {
$brandId = $brandIds[0];
}
if ($brandLogo && isset($brandLogo['id'])) {
$brandId = $brandLogo['id'];
}
/* 通过品牌域名找到对应的品牌ID */
// $domainList = Product\ListModel::getAllBrandDomains();
// $brandIds = array_keys($domainList, $domain);
// $brandId = 0;
// if (isset($brandIds[0])) {
// $brandId = $brandIds[0];
// }
// 当前的登录用户UID
$uid = $this->getUid();
// 存标题信息
$title = '';
/* 搜索框相关 */
$from = $this->get('from');
... ... @@ -114,7 +119,7 @@ class IndexController extends AbstractAction
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
$condition['brand'] = $brandId;
if ($brandId === 0) {
$condition['query'] = $domain;
}
... ... @@ -131,12 +136,13 @@ class IndexController extends AbstractAction
// 从搜索页过来的,显示搜索框, 和进入品牌引导信息
if ($from === 'search') {
$data['goodList'] = array();
$data['goodList']['brandWay'] = \Product\ListModel::getBrandLogoByIds($brandId, $title);
//$data['goodList']['brandWay'] = \Product\ListModel::getBrandLogoByIds($brandId, $title);
$data['goodList']['brandWay'] = $brandLogo;
$data['goodList']['search']['default'] = $query;
$data['goodList']['search']['url'] = Helpers::url('', null, 'search');
}
// 品牌一览过来的展示品牌介绍和LOGO
else {
elseif ($brandId !== 0) {
$data['brandHome'] = \Product\ListModel::getBrandIntro($brandId, $uid, $title);
$data['goodList'] = array();
}
... ...
... ... @@ -40,7 +40,7 @@ class OptController extends AbstractAction
}
/* 判断用户是否登录 */
$uid = $this->getUdid();
$uid = $this->getUid();
if (!$uid) {
$referer = $this->server('HTTP_REFERER', SITE_MAIN);
$result = array('code' => 400, 'message' => '未登录', 'data' => Helpers::url('/signin.html', array('refer' => $referer)));
... ... @@ -60,6 +60,7 @@ class OptController extends AbstractAction
$result = array('code' => 401, 'message' => '参数不正确', 'data' => false);
break;
}
} while (false);
$this->echoJson($result);
... ...
<?php
use Yaf\Application;
define('SITE_MAIN', 'http://mtesth5.yohobuy.com'); // 网站主域名
define('SITE_MAIN', 'http://m.yohobuy.com'); // 网站主域名
define('OLD_MAIN', 'http://m.yohobuy.com'); // 网站旧域名
define('COOKIE_DOMAIN', '.yohobuy.com'); // COOKIE作用域
define('SUB_DOMAIN', '.mtesth5.yohobuy.com'); // 子域名后缀
define('SUB_DOMAIN', '.m.yohobuy.com'); // 子域名后缀
define('USE_CACHE', true); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__)); // 应用目录
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH))); // 根目录
... ...
User-agent: *
Disallow: /
\ No newline at end of file
Disallow:
\ No newline at end of file
... ...