Authored by ccbikai

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

framework @ 75bbc3b0
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -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'];
... ...
... ... @@ -95,7 +95,7 @@ class NewsaleData
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {
return $v !== null;
return !empty($v);
});
$param = Yohobuy::param();
... ...
... ... @@ -39,12 +39,12 @@ class Cache
// WINDOWS
if (DIRECTORY_SEPARATOR === '\\') {
HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);
HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天
}
// LINUX
else {
HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0);
HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 86400); // 二级缓存1天
}
} catch (Exception $e) {
// do nothing
... ...
... ... @@ -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 {
... ...
... ... @@ -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'));
... ...
{
"name": "yohobuy",
"version": "0.0.9",
"version": "1.0.5",
"description": "yohobuy statics",
"keywords": [],
"homepage": "",
... ...
... ... @@ -44,7 +44,7 @@
.collect-btn {
margin-left: 20rem / $pxConvertRem;
&.collected {
color: #444;
color: #D62927;
}
}
}
... ...
<?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'])) {
... ...
... ... @@ -196,11 +196,11 @@ class NewsaleModel
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS, 'slave');
$result = Cache::get($cacheKey, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS, $result);
Cache::set($cacheKey, $result);
}
}
... ...
... ... @@ -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);
}
}
}
... ...
... ... @@ -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);
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.9"
application.version = "1.0.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.9"
application.version = "1.0.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.9"
application.version = "1.0.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -50,7 +50,7 @@ application.template.ext = ".phtml"
application.assets.path = ROOT_PATH "/assets"
; 应用的版本号
application.version = "0.0.9"
application.version = "1.0.5"
; 网站SEO信息
application.seo.title = "Yoho!Buy有货"
... ...
... ... @@ -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
... ...