Authored by hf

fixes bug to guang and search

... ... @@ -135,7 +135,6 @@
'.'<script>
seajs.use(\'js/common\');
</script>
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('psList')))) ? '<script>
seajs.use(\'js/guang/plus-star/list\');
</script>
... ... @@ -151,8 +150,12 @@
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('guangDetail')))) ? '<script>
seajs.use(\'js/guang/detail\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('regIndex')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('guangEzine')))) ? '<script>
seajs.use(\'js/guang/detail\', function(detail) {
detail.init(true);
});
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('regIndex')))) ? '<script>
seajs.use(\'js/passport/register/register\');
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('regCode')))) ? '<script>
... ... @@ -161,15 +164,13 @@
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('regPwd')))) ? '<script>
seajs.use(\'js/passport/register/password\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('loginIndex')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('loginIndex')))) ? '<script>
seajs.use(\'js/passport/login/login\');
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('loginInternational')))) ? ' <script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('loginInternational')))) ? '<script>
seajs.use(\'js/passport/login/international\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('backEmail')))) ? '<script>
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('backEmail')))) ? '<script>
seajs.use(\'js/passport/back/email\');
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('backEmailSuccess')))) ? '<script>
... ... @@ -184,13 +185,11 @@
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('backNewPwd')))) ? '<script>
seajs.use(\'js/passport/back/new-password\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('channelPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('channelPage')))) ? '<script>
seajs.use(\'js/index/channel\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('grilsHomePage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('grilsHomePage')))) ? '<script>
seajs.use(\'js/home/home\', function(h) {
h.set(\'girls\');
});
... ... @@ -214,42 +213,34 @@
});
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('newArrivalPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('newArrivalPage')))) ? '<script>
seajs.use(\'js/product/newsale/newarrival\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('discountPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('discountPage')))) ? '<script>
seajs.use(\'js/product/newsale/discount\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('goodListPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('goodListPage')))) ? '<script>
seajs.use(\'js/product/list\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('goodsDetailPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('goodsDetailPage')))) ? '<script>
seajs.use(\'js/product/detail/detail\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('categoryPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('categoryPage')))) ? '<script>
seajs.use(\'js/category/index\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('brandPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('brandPage')))) ? '<script>
seajs.use(\'js/category/brand\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('searchPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('searchPage')))) ? '<script>
seajs.use(\'js/index/search\');
seajs.use(\'js/index/footer\');
</script>
' : '').'
'.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('shoppingCartPage')))) ? '<script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('shoppingCartPage')))) ? '<script>
seajs.use(\'js/shopping-cart/cart\');
</script>
' : '').''.((Plugin\LCRun3::ifvar($cx, Plugin\LCRun3::v($cx, $in, array('giftAdvancePage')))) ? '<script>
... ...
... ... @@ -39,7 +39,7 @@ class DetailData
$clientType = $isApp ? 'iphone' : 'h5';
// 获取资讯
$article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType), 3600);
$article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType));
if (!isset($article['author_id'])) {
return $result;
}
... ... @@ -73,4 +73,47 @@ class DetailData
return $result;
}
/**
* 逛资讯详情页数据封装 (专为YOHO!潮流志APP提供)
*
* @param int $id 内容ID
* @param bool $isApp 标识是否是APP访问
* @return array
*/
public static function packageFoEzine($id, $isApp = false)
{
$result = array();
$result['getAuthor'] = array();
$result['getArticle'] = array();
$result['getArticleContent'] = array();
$result['getBrand'] = array();
$result['getOtherArticle'] = array();
// 客户端类型
$clientType = $isApp ? 'iphone' : 'h5';
// 获取资讯
$article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType));
if (!isset($article['author_id'])) {
return $result;
}
$result['getArticle'] = $article;
// 获取资讯内容
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, $clientType), function ($retval) use (&$result) {
$result['getArticleContent'] = empty($retval) ? array() : $retval;
});
// 获取资讯相关的品牌
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getBrand', array($id, $clientType), function ($retval) use (&$result) {
$result['getBrand'] = empty($retval) ? array() : $retval;
});
// 调用发起请求
Yohobuy::yarConcurrentLoop();
return $result;
}
}
... ...
... ... @@ -125,7 +125,7 @@ class PlusstarData
$result['getArticleByBrand'] = array();
// 品牌详情信息
$brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)));
$brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)), 3600); // 缓存1小时
if (!isset($brandInfo['data']['brand_id'])) {
return $result;
} else {
... ... @@ -160,7 +160,7 @@ class PlusstarData
$param['gender'] = $gender;
$param['order'] = 's_t_desc';
$param['client_secret'] = Sign::getSign($param);
$newProduct = Yohobuy::get(Yohobuy::API_URL, $param);
$newProduct = Yohobuy::get(Yohobuy::API_URL, $param, 1800); // 缓存30分钟
if (empty($newProduct['data']['product_list'])) {
break;
}
... ...
... ... @@ -201,6 +201,14 @@ server
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /info/mini {
proxy_redirect off;
proxy_pass http://yohobuy;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /plustar {
proxy_redirect off;
proxy_pass http://yohobuy;
... ...
... ... @@ -155,7 +155,7 @@ if (hasCollocationBlock) {
/**
* 初始化页面参数
*/
exports.init = function (flag) {
exports.init = function(flag) {
if (flag === true) {
isEzinPage = true;
}
... ... @@ -177,7 +177,7 @@ window.onload = function() {
click: true
});
document.addEventListener('touchmove', function (e) {
document.addEventListener('touchmove', function(e) {
e.preventDefault();
}, false);
... ...
{
"name": "yohobuy",
"version": "1.1.4",
"version": "1.1.5",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -154,10 +154,10 @@
</div>
{{!-- wx-share --}}
<input id="shareLink" type="hidden" value={{shareLink}}>
<input id="shareImg" type="hidden" value={{shareImg}}>
<input id="shareTitle" type="hidden" value={{shareTitle}}>
<input id="shareDesc" type="hidden" value={{shareDesc}}>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/ guang}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -52,13 +52,13 @@
</div>
{{/if}}
<input id="jump-to-app" type="hidden" value={{jumpToApp}}>
<input id="jump-to-app" type="hidden" value="{{jumpToApp}}">
{{!-- wx-share --}}
<input id="shareLink" type="hidden" value={{shareLink}}>
<input id="shareImg" type="hidden" value={{shareImg}}>
<input id="shareTitle" type="hidden" value={{shareTitle}}>
<input id="shareDesc" type="hidden" value={{shareDesc}}>
<input id="shareLink" type="hidden" value="{{shareLink}}">
<input id="shareImg" type="hidden" value="{{shareImg}}">
<input id="shareTitle" type="hidden" value="{{shareTitle}}">
<input id="shareDesc" type="hidden" value="{{shareDesc}}">
{{/ ps}}
</div>
{{>layout/footer}}
\ No newline at end of file
... ...
<script>
seajs.use('js/common');
</script>
{{!-- 逛(PLUS+STAR) --}}
{{#if psList}}
<script>
... ... @@ -28,7 +27,13 @@
seajs.use('js/guang/detail');
</script>
{{/if}}
{{#if guangEzine}}
<script>
seajs.use('js/guang/detail', function(detail) {
detail.init(true);
});
</script>
{{/if}}
{{!-- 注册 --}}
{{#if regIndex}}
<script>
... ... @@ -45,7 +50,6 @@
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
... ... @@ -53,11 +57,10 @@
</script>
{{/if}}
{{#if loginInternational}}
<script>
<script>
seajs.use('js/passport/login/international');
</script>
</script>
{{/if}}
{{!-- 密码找回 --}}
{{#if backEmail}}
<script>
... ... @@ -84,7 +87,6 @@
seajs.use('js/passport/back/new-password');
</script>
{{/if}}
{{!-- 频道选择页 --}}
{{#if channelPage}}
<script>
... ... @@ -92,7 +94,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 首页 --}}
{{#if grilsHomePage}}
<script>
... ... @@ -126,7 +127,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 新品到着 --}}
{{#if newArrivalPage}}
<script>
... ... @@ -134,7 +134,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 折扣专区 --}}
{{#if discountPage}}
<script>
... ... @@ -142,7 +141,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 商品列表 --}}
{{#if goodListPage}}
<script>
... ... @@ -150,14 +148,12 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 商品详情 --}}
{{#if goodsDetailPage}}
<script>
seajs.use('js/product/detail/detail');
</script>
{{/if}}
{{!-- 品类 --}}
{{#if categoryPage}}
<script>
... ... @@ -165,7 +161,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 品牌 --}}
{{#if brandPage}}
<script>
... ... @@ -173,7 +168,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 搜索 --}}
{{#if searchPage}}
<script>
... ... @@ -181,7 +175,6 @@
seajs.use('js/index/footer');
</script>
{{/if}}
{{!-- 购物车 --}}
{{#if shoppingCartPage}}
<script>
... ...
... ... @@ -51,6 +51,9 @@ class SearchController extends AbstractAction
$condition['p_d'] = rawurldecode($condition['discount']);
unset($condition['discount']);
}
if (isset($condition['query'])) {
$condition['query'] = rawurlencode($condition['query']);
}
// 标识用户是否有输入搜索内容
$haveQuery = $query !== null;
... ... @@ -221,6 +224,10 @@ class SearchController extends AbstractAction
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
if (isset($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
}
// 转换排序方式
$type = $this->get('type', '');
$order = $this->get('order', 0);
... ...
... ... @@ -47,10 +47,6 @@ class InfoController extends AbstractAction
return;
}
$data = array();
$data['guangDetail'] = true; // 模板中使用JS的标识
$data['guang']['id'] = $id;
// 作者信息数据
if (isset($detail['getAuthor']['name'])) {
$data['guang']['author'] = array();
... ... @@ -204,20 +200,140 @@ class InfoController extends AbstractAction
* @param type "fav"表示收藏 或者 "cancel"表示取消收藏
* @return json
*/
public function collectAction()
public function miniAction()
{
do {
if (!$this->isAjax()) {
$id = $this->get('id');
// 判断参数是否有效, 无效会跳转到错误页面
if (!is_numeric($id)) {
$this->error();
}
$data = array();
$data['guangEzine'] = true; // 模板中使用JS的标识
$data['guang']['id'] = $id;
// 获取详情内容信息, 异常则跳到错误页面
$detail = DetailData::packageFoEzine($id, true);
if (empty($detail['getArticle'])) {
$this->_view->display('index', $data);
return;
}
$data['detail'] = array();
$data['detail']['title'] = $detail['getArticle']['article_title'];
$data['detail']['publishTime'] = $detail['getArticle']['publishTime'];
$data['detail']['pageView'] = $detail['getArticle']['pageViews'];
$data['detail']['content'] = array();
if (!empty($detail['getArticleContent'])) {
$build = array();
$good = array();
$skns = array();
$product = array();
foreach ($detail['getArticleContent'] as $value) {
$build = array();
// 文字
if (isset($value['text'])) {
$build['text'] = $value['text']['data']['text'];
}
// 单张图
elseif (isset($value['singleImage'])) {
$build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
} elseif (isset($value['smallPic']['data'])) {
$imgs = $value['smallPic']['data'];
$build['smallImage'] = array(
array(
'src' => Helpers::getImageUrl($imgs[0]['src'], 315, 420)
),
array(
'src' => Helpers::getImageUrl($imgs[1]['src'], 315, 420)
)
);
}
// 相关推荐
elseif (isset($value['goods']['data'])) {
$good = array();
// 遍历取得SKN
$skns = array();
foreach ($value['goods']['data'] as $goods) {
$skns[] = $goods['id'];
}
// 通过SKN获取商品信息
$product = ListData::productInfoBySkns($skns);
if (!empty($product['data']['product_list'])) {
foreach ($product['data']['product_list'] as $i => $goods) {
// 最多显示4个
if ($i > 3) {
break;
}
$good[] = Helpers::formatProduct($goods, false, true, true, 235, 314, true);
}
}
// 没有商品
if (!isset($i)) {
continue;
}
// 单个商品
elseif ($i === 0 && isset($good[0])) {
$build['relatedReco'] = $good[0];
}
// 多个商品
else {
$build['relatedReco'] = $good;
}
}
// 悬停浮动商品
elseif (isset($value['goodsGroup']['data'])) {
foreach ($value['goodsGroup']['data'] as $goods) {
$good = array();
$good['thumb'] = Helpers::getImageUrl($goods['cover']['cover'], 235, 314);
$good['type'] = Helpers::getProductIcon($goods['cover']['maxSortId']);
$good['goods'] = array();
$skns = array();
foreach ($goods['list'] as $mini) {
$skns[] = $mini['id'];
}
// 通过SKN获取商品信息
$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, true);
}
$build['collocation'][] = $good;
}
}
}
$id = $this->get('id');
$type = $this->get('type');
// 收藏
if ($type == 'fav') {
$data['detail']['content'][] = $build;
}
}
// 相关品牌
if (!empty($detail['getBrand'])) {
$data['relatedBrand'] = $detail['getBrand'];
}
// 分享参数
if (isset($detail['getArticle']['cover_image'])) {
$data['shareLink'] = Helpers::url('/info/index', array('id' => $id), 'guang');
$data['shareTitle'] = $detail['getArticle']['article_title'];
$data['shareDesc'] = $detail['getArticle']['article_summary'];
if ($detail['getArticle']['cover_image_type'] == 1) {
$data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 640);
} else {
$data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 320);
}
}
} while (false);
// 标识有微信分享
$data['hasWxShare'] = true;
$this->_view->display('index', $data);
$detail = array();
$data = array();
}
}
... ...
... ... @@ -177,7 +177,7 @@ class PlusstarController extends AbstractAction
$data['shareLink'] = $defaultUrl;
$data['shareTitle'] = $data['ps']['name'];
$data['shareDesc'] = (mb_strlen($data['ps']['intro'], 'utf-8') > 120) ? mb_substr($data['ps']['intro'], 0, 120, 'utf-8') . '...' : $data['ps']['intro'];
$data['shareDesc'] = (mb_strlen($data['ps']['intro'], 'utf-8') > 120) ? trim(strip_tags(mb_substr($data['ps']['intro'], 0, 120, 'utf-8'))) . '...' : $data['ps']['intro'];
$data['shareImg'] = $data['ps']['logo'];
$brandInfo = array();
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.1.4"
application.version = "1.1.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.1.4"
application.version = "1.1.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.1.4"
application.version = "1.1.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "1.1.4"
application.version = "1.1.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...