modify to fixes bug to guang detail page support app operate
Showing
15 changed files
with
319 additions
and
91 deletions
framework @ 75bbc3b0
@@ -16,6 +16,7 @@ use Yaf\Controller_Abstract; | @@ -16,6 +16,7 @@ use Yaf\Controller_Abstract; | ||
16 | use Yaf\Dispatcher; | 16 | use Yaf\Dispatcher; |
17 | use Plugin\Cache; | 17 | use Plugin\Cache; |
18 | use Plugin\Helpers; | 18 | use Plugin\Helpers; |
19 | +use Hood\Session; | ||
19 | 20 | ||
20 | class AbstractAction extends Controller_Abstract | 21 | class AbstractAction extends Controller_Abstract |
21 | { | 22 | { |
@@ -100,8 +101,8 @@ class AbstractAction extends Controller_Abstract | @@ -100,8 +101,8 @@ class AbstractAction extends Controller_Abstract | ||
100 | { | 101 | { |
101 | return $this->_request->getParam($key, $default); | 102 | return $this->_request->getParam($key, $default); |
102 | } | 103 | } |
103 | - | ||
104 | - /** | 104 | + |
105 | + /** | ||
105 | * 封装一下获取服务器的参数 | 106 | * 封装一下获取服务器的参数 |
106 | * | 107 | * |
107 | * @param String $key | 108 | * @param String $key |
@@ -245,6 +246,28 @@ class AbstractAction extends Controller_Abstract | @@ -245,6 +246,28 @@ class AbstractAction extends Controller_Abstract | ||
245 | } | 246 | } |
246 | 247 | ||
247 | /** | 248 | /** |
249 | + * 设置Session | ||
250 | + * | ||
251 | + * @param string $name 名称 | ||
252 | + * @param mixed $value 值 | ||
253 | + * @return void | ||
254 | + */ | ||
255 | + public function setSession($name, $value) | ||
256 | + { | ||
257 | + Session::start('yohobuy_session')->__set($name, $value); | ||
258 | + } | ||
259 | + | ||
260 | + /** | ||
261 | + * 获取Session | ||
262 | + * | ||
263 | + * @param string $name 名称 | ||
264 | + */ | ||
265 | + public function getSession($name) | ||
266 | + { | ||
267 | + Session::start('yohobuy_session')->__get($name); | ||
268 | + } | ||
269 | + | ||
270 | + /** | ||
248 | * 获取当前登录的用户ID | 271 | * 获取当前登录的用户ID |
249 | * | 272 | * |
250 | * @return int | 273 | * @return int |
@@ -340,11 +363,11 @@ class AbstractAction extends Controller_Abstract | @@ -340,11 +363,11 @@ class AbstractAction extends Controller_Abstract | ||
340 | if (!empty($homeUrl)) { | 363 | if (!empty($homeUrl)) { |
341 | $header['navHome'] = $homeUrl . '?go=1'; | 364 | $header['navHome'] = $homeUrl . '?go=1'; |
342 | } | 365 | } |
343 | - | 366 | + |
344 | // 根据COOKIE记录的频道进行导航定位 | 367 | // 根据COOKIE记录的频道进行导航定位 |
345 | $channel = Helpers::getChannelByCookie(); | 368 | $channel = Helpers::getChannelByCookie(); |
346 | switch ($channel) { | 369 | switch ($channel) { |
347 | - default: | 370 | + default: |
348 | case 1: | 371 | case 1: |
349 | $header['boys'] = true; | 372 | $header['boys'] = true; |
350 | break; | 373 | break; |
@@ -26,7 +26,7 @@ class OptData | @@ -26,7 +26,7 @@ class OptData | ||
26 | */ | 26 | */ |
27 | public static function favoriteBrand($uid, $id, $opt = 'ok') | 27 | public static function favoriteBrand($uid, $id, $opt = 'ok') |
28 | { | 28 | { |
29 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id) ); | 29 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id)); |
30 | } | 30 | } |
31 | 31 | ||
32 | /** | 32 | /** |
@@ -40,9 +40,9 @@ class OptData | @@ -40,9 +40,9 @@ class OptData | ||
40 | public static function favoriteProduct($uid, $skn, $opt = 'ok') | 40 | public static function favoriteProduct($uid, $skn, $opt = 'ok') |
41 | { | 41 | { |
42 | if ($opt === 'cancel') { | 42 | if ($opt === 'cancel') { |
43 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn) ); | 43 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn)); |
44 | } else { | 44 | } else { |
45 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn) ); | 45 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn)); |
46 | } | 46 | } |
47 | } | 47 | } |
48 | 48 | ||
@@ -57,9 +57,26 @@ class OptData | @@ -57,9 +57,26 @@ class OptData | ||
57 | public static function praiseArticle($udid, $id, $opt = 'ok') | 57 | public static function praiseArticle($udid, $id, $opt = 'ok') |
58 | { | 58 | { |
59 | if ($opt === 'cancel') { | 59 | if ($opt === 'cancel') { |
60 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid) ); | 60 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid)); |
61 | } else { | 61 | } else { |
62 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid) ); | 62 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid)); |
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * 逛资讯收藏/取消收藏 (APP里调用) | ||
68 | + * | ||
69 | + * @param int $udid 唯一客户端标识 | ||
70 | + * @param int $id 唯一资讯的ID | ||
71 | + * @param string $opt 操作(ok:表示确定,cancel:表示取消) | ||
72 | + * @return array | ||
73 | + */ | ||
74 | + public static function collectArticle($uid, $id, $opt = 'ok') | ||
75 | + { | ||
76 | + if ($opt === 'cancel') { | ||
77 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'cancelFavorite', array($id, $uid)); | ||
78 | + } else { | ||
79 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v2/favorite/', 'setFavorite', array($id, $uid)); | ||
63 | } | 80 | } |
64 | } | 81 | } |
65 | 82 |
@@ -106,6 +106,7 @@ class PlusstarData | @@ -106,6 +106,7 @@ class PlusstarData | ||
106 | * @param string $gender $gender "1,3"表示男, "2,3"表示女 | 106 | * @param string $gender $gender "1,3"表示男, "2,3"表示女 |
107 | * @param int $uid 用户ID | 107 | * @param int $uid 用户ID |
108 | * @param string $udid cookie记录唯一标识 | 108 | * @param string $udid cookie记录唯一标识 |
109 | + * @param bool $isApp 判断是不是APP访问 | ||
109 | * @return array( | 110 | * @return array( |
110 | * "getBrandInfo" => array(品牌详情信息), | 111 | * "getBrandInfo" => array(品牌详情信息), |
111 | * "getUidBrandFav" => false, | 112 | * "getUidBrandFav" => false, |
@@ -114,7 +115,7 @@ class PlusstarData | @@ -114,7 +115,7 @@ class PlusstarData | ||
114 | * "getUidProductFav" => array(用户是否收藏新品) | 115 | * "getUidProductFav" => array(用户是否收藏新品) |
115 | * ) | 116 | * ) |
116 | */ | 117 | */ |
117 | - public static function brandInfo($id, $gender, $uid, $udid = null) | 118 | + public static function brandInfo($id, $gender, $uid, $udid = null, $isApp = false) |
118 | { | 119 | { |
119 | $result = array(); | 120 | $result = array(); |
120 | $result['getBrandInfo'] = array(); | 121 | $result['getBrandInfo'] = array(); |
@@ -177,7 +178,7 @@ class PlusstarData | @@ -177,7 +178,7 @@ class PlusstarData | ||
177 | } | 178 | } |
178 | 179 | ||
179 | // 商品信息列表 | 180 | // 商品信息列表 |
180 | - $result['getNewProduct'][$i] = Helpers::formatProduct($value); | 181 | + $result['getNewProduct'][$i] = Helpers::formatProduct($value, true, true, true, 235, 314, $isApp); |
181 | 182 | ||
182 | // 用户是否收藏该商品 | 183 | // 用户是否收藏该商品 |
183 | $skn = $value['product_skn']; | 184 | $skn = $value['product_skn']; |
@@ -177,9 +177,10 @@ class Helpers | @@ -177,9 +177,10 @@ class Helpers | ||
177 | * @param bool $showSale 控制是否显示SALE图标 | 177 | * @param bool $showSale 控制是否显示SALE图标 |
178 | * @param int $width 图片的宽度 | 178 | * @param int $width 图片的宽度 |
179 | * @param int $height 图片的高度 | 179 | * @param int $height 图片的高度 |
180 | + * @param bool $isApp 判断是不是APP访问 | ||
180 | * @return array | false | 181 | * @return array | false |
181 | */ | 182 | */ |
182 | - public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388) | 183 | + public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true, $width = 290, $height = 388, $isApp = false) |
183 | { | 184 | { |
184 | // 商品信息有问题,则不显示 | 185 | // 商品信息有问题,则不显示 |
185 | if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) { | 186 | if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) { |
@@ -207,6 +208,11 @@ class Helpers | @@ -207,6 +208,11 @@ class Helpers | ||
207 | $result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_' | 208 | $result['url'] = SITE_MAIN . '/product/pro_' . $productData['product_id'] . '_' |
208 | . $productData['goods_list'][0]['goods_id'] | 209 | . $productData['goods_list'][0]['goods_id'] |
209 | . '/' . $productData['cn_alphabet'] . '.html'; | 210 | . '/' . $productData['cn_alphabet'] . '.html'; |
211 | + // APP访问需要加附加的参数 | ||
212 | + // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 | ||
213 | + if ($isApp) { | ||
214 | + $result['url'] .= '?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'.$productData['product_skn'].'}}'; | ||
215 | + } | ||
210 | 216 | ||
211 | if ($showTags) { | 217 | if ($showTags) { |
212 | $result['tags'] = array(); | 218 | $result['tags'] = array(); |
@@ -229,9 +235,10 @@ class Helpers | @@ -229,9 +235,10 @@ class Helpers | ||
229 | * @param bool $showTag 是否显示左上角标签 | 235 | * @param bool $showTag 是否显示左上角标签 |
230 | * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接 | 236 | * @param mixed $isApp 是否显示分享,在APP客户端里嵌入需要传url链接 |
231 | * @param bool $showAuthor 控制是否显示作者信息 | 237 | * @param bool $showAuthor 控制是否显示作者信息 |
238 | + * @param int $uid 当前登录的用户ID | ||
232 | * @return array | false | 239 | * @return array | false |
233 | */ | 240 | */ |
234 | - public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true) | 241 | + public static function formatArticle($articleData, $showTag = true, $isApp = false, $showAuthor = true, $uid = null) |
235 | { | 242 | { |
236 | // 资讯ID不存在,则不显示 | 243 | // 资讯ID不存在,则不显示 |
237 | if (!isset($articleData['id'])) { | 244 | if (!isset($articleData['id'])) { |
@@ -252,7 +259,7 @@ class Helpers | @@ -252,7 +259,7 @@ class Helpers | ||
252 | if ($isApp) { | 259 | if ($isApp) { |
253 | $result['collect'] = array(); | 260 | $result['collect'] = array(); |
254 | $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; | 261 | $result['collect']['isCollected'] = isset($articleData['isFavor']) && $articleData['isFavor'] === 'Y'; |
255 | - $result['collect']['url'] = $articleData['url']; | 262 | + $result['collect']['url'] = !empty($uid) ? 'javascript:;' : strtr($articleData['url'], array('"islogin":"N"' => '"islogin":"Y"')); |
256 | } | 263 | } |
257 | // 点赞 | 264 | // 点赞 |
258 | else { | 265 | else { |
@@ -5,16 +5,16 @@ | @@ -5,16 +5,16 @@ | ||
5 | */ | 5 | */ |
6 | 6 | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | - Hammer = require('yoho.hammer'), | ||
9 | - ellipsis = require('mlellipsis'), | ||
10 | - lazyLoad = require('yoho.lazyload'); | 8 | + Hammer = require('yoho.hammer'), |
9 | + ellipsis = require('mlellipsis'), | ||
10 | + lazyLoad = require('yoho.lazyload'); | ||
11 | 11 | ||
12 | var tip = require('../plugin/tip'); | 12 | var tip = require('../plugin/tip'); |
13 | var loading = require('../plugin/loading'); | 13 | var loading = require('../plugin/loading'); |
14 | 14 | ||
15 | var $loadMoreInfo = $('#load-more-info'); | 15 | var $loadMoreInfo = $('#load-more-info'); |
16 | var $loading = $(''), | 16 | var $loading = $(''), |
17 | - $noMore = $(''); | 17 | + $noMore = $(''); |
18 | 18 | ||
19 | var searching = false; | 19 | var searching = false; |
20 | 20 | ||
@@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { | @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { | ||
34 | 34 | ||
35 | $infos.each(function() { | 35 | $infos.each(function() { |
36 | var $this = $(this), | 36 | var $this = $(this), |
37 | - $title = $this.find('.info-title'), | ||
38 | - $text = $this.find('.info-text'); | 37 | + $title = $this.find('.info-title'), |
38 | + $text = $this.find('.info-text'); | ||
39 | 39 | ||
40 | $title[0].mlellipsis(2); | 40 | $title[0].mlellipsis(2); |
41 | $text[0].mlellipsis(2); | 41 | $text[0].mlellipsis(2); |
@@ -51,9 +51,10 @@ function initInfosEvt($container) { | @@ -51,9 +51,10 @@ function initInfosEvt($container) { | ||
51 | 51 | ||
52 | cHammer.on('tap', function(e) { | 52 | cHammer.on('tap', function(e) { |
53 | var $this = $(e.target), | 53 | var $this = $(e.target), |
54 | - opt = 'ok', | ||
55 | - $likeBtn, | ||
56 | - $info; | 54 | + opt = 'ok', |
55 | + $likeBtn, | ||
56 | + $collectBtn, | ||
57 | + $info; | ||
57 | 58 | ||
58 | $likeBtn = $this.closest('.like-btn'); | 59 | $likeBtn = $this.closest('.like-btn'); |
59 | if ($likeBtn.length > 0) { | 60 | if ($likeBtn.length > 0) { |
@@ -84,6 +85,34 @@ function initInfosEvt($container) { | @@ -84,6 +85,34 @@ function initInfosEvt($container) { | ||
84 | } | 85 | } |
85 | }); | 86 | }); |
86 | } | 87 | } |
88 | + | ||
89 | + // 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改! | ||
90 | + $collectBtn = $this.closest('.collect-btn'); | ||
91 | + if ($collectBtn.length > 0) { | ||
92 | + if ($collectBtn.hasClass('collected')) { | ||
93 | + opt = 'cancel'; | ||
94 | + } | ||
95 | + | ||
96 | + $info = $this.closest('.guang-info'); | ||
97 | + $.ajax({ | ||
98 | + type: 'POST', | ||
99 | + url: '/guang/opt/collectArticle', | ||
100 | + data: { | ||
101 | + id: $info.data('id'), | ||
102 | + opt: opt | ||
103 | + }, | ||
104 | + success: function(data) { | ||
105 | + if (data.code && data.code === 200) { | ||
106 | + | ||
107 | + //切换收藏状态 | ||
108 | + $collectBtn.toggleClass('collected'); | ||
109 | + } | ||
110 | + }, | ||
111 | + error: function() { | ||
112 | + tip.show('网络断开连接了~'); | ||
113 | + } | ||
114 | + }); | ||
115 | + } | ||
87 | }); | 116 | }); |
88 | 117 | ||
89 | setLazyLoadAndMellipsis($container.find('.guang-info')); | 118 | setLazyLoadAndMellipsis($container.find('.guang-info')); |
1 | <?php | 1 | <?php |
2 | + | ||
2 | /** | 3 | /** |
3 | * 错误错误控制器 | 4 | * 错误错误控制器 |
4 | * | 5 | * |
@@ -10,26 +11,33 @@ use Action\AbstractAction; | @@ -10,26 +11,33 @@ use Action\AbstractAction; | ||
10 | 11 | ||
11 | class ErrorController extends AbstractAction | 12 | class ErrorController extends AbstractAction |
12 | { | 13 | { |
13 | - | 14 | + |
14 | public function indexAction() | 15 | public function indexAction() |
15 | { | 16 | { |
16 | header('HTTP/1.1 404 Not Found'); | 17 | header('HTTP/1.1 404 Not Found'); |
17 | header('Status: 404 Not Found'); | 18 | header('Status: 404 Not Found'); |
18 | $this->_view->display('index'); | 19 | $this->_view->display('index'); |
19 | } | 20 | } |
20 | - | 21 | + |
21 | public function errorAction($exception) | 22 | public function errorAction($exception) |
22 | { | 23 | { |
23 | header('HTTP/1.1 404 Not Found'); | 24 | header('HTTP/1.1 404 Not Found'); |
24 | header('Status: 404 Not Found'); | 25 | header('Status: 404 Not Found'); |
25 | - | 26 | + |
26 | // @todo debug | 27 | // @todo debug |
27 | - echo $exception->getMessage(); | ||
28 | - | ||
29 | -// // 生成HTML (error.html) | ||
30 | -// $this->_view->html('error'); | ||
31 | -// // 渲染模板 | ||
32 | -// $this->_view->display('error'); | 28 | + //echo $exception->getMessage(); |
29 | + | ||
30 | + // 设置网站标题 | ||
31 | + $this->setTitle('页面不存在'); | ||
32 | + $this->setNavHeader('抱歉,页面不存在!', true, SITE_MAIN); | ||
33 | + | ||
34 | + // 生成HTML (error.html) | ||
35 | + $this->_view->html('error'); | ||
36 | + // 渲染模板 | ||
37 | + $this->_view->display('index', array( | ||
38 | + 'pageFooter' => true, | ||
39 | + 'showDownloadApp' => true, | ||
40 | + )); | ||
33 | } | 41 | } |
34 | 42 | ||
35 | } | 43 | } |
@@ -154,6 +154,9 @@ class SearchController extends AbstractAction | @@ -154,6 +154,9 @@ class SearchController extends AbstractAction | ||
154 | 154 | ||
155 | // 显示底部悬浮下载 | 155 | // 显示底部悬浮下载 |
156 | $data['showDownloadApp'] = true; | 156 | $data['showDownloadApp'] = true; |
157 | + | ||
158 | + // 显示页面底部登录信息 | ||
159 | + $data['pageFooter'] = true; | ||
157 | 160 | ||
158 | // // 查询数据 | 161 | // // 查询数据 |
159 | // if (!isset($condition['query'])) { | 162 | // if (!isset($condition['query'])) { |
@@ -49,8 +49,6 @@ class IndexController extends AbstractAction | @@ -49,8 +49,6 @@ class IndexController extends AbstractAction | ||
49 | */ | 49 | */ |
50 | public function tagAction() | 50 | public function tagAction() |
51 | { | 51 | { |
52 | - $uid = $this->getUid(); | ||
53 | - $udid = $this->getUdid(); | ||
54 | $tag = $this->get('query'); | 52 | $tag = $this->get('query'); |
55 | $channel = $this->get('yh_channel'); | 53 | $channel = $this->get('yh_channel'); |
56 | 54 | ||
@@ -68,11 +66,22 @@ class IndexController extends AbstractAction | @@ -68,11 +66,22 @@ class IndexController extends AbstractAction | ||
68 | default: // 所有 | 66 | default: // 所有 |
69 | $gender = '1,2,3'; | 67 | $gender = '1,2,3'; |
70 | } | 68 | } |
69 | + $uid = $this->get('uid'); | ||
70 | + $udid = $this->get('udid'); | ||
71 | + if ($uid) { | ||
72 | + $this->setSession('uid', $uid); | ||
73 | + } | ||
74 | + if ($udid) { | ||
75 | + $this->setSession('udid', $udid); | ||
76 | + } | ||
71 | } | 77 | } |
72 | // 从Cookie获取 | 78 | // 从Cookie获取 |
73 | else { | 79 | else { |
74 | $gender = Helpers::getGenderByCookie(); | 80 | $gender = Helpers::getGenderByCookie(); |
75 | 81 | ||
82 | + $uid = $this->getUid(); | ||
83 | + $udid = $this->getUdid(); | ||
84 | + | ||
76 | $this->setNavHeader($tag, true, SITE_MAIN); | 85 | $this->setNavHeader($tag, true, SITE_MAIN); |
77 | } | 86 | } |
78 | 87 | ||
@@ -92,7 +101,7 @@ class IndexController extends AbstractAction | @@ -92,7 +101,7 @@ class IndexController extends AbstractAction | ||
92 | // 构建资讯文章内容 | 101 | // 构建资讯文章内容 |
93 | $build = array(); | 102 | $build = array(); |
94 | foreach ($article['data']['list']['artList'] as $article) { | 103 | foreach ($article['data']['list']['artList'] as $article) { |
95 | - $build[] = Helpers::formatArticle($article, true, $isApp); | 104 | + $build[] = Helpers::formatArticle($article, true, $isApp, true, $uid); |
96 | } | 105 | } |
97 | $data['guang']['infos'] = $build; | 106 | $data['guang']['infos'] = $build; |
98 | 107 | ||
@@ -129,11 +138,22 @@ class IndexController extends AbstractAction | @@ -129,11 +138,22 @@ class IndexController extends AbstractAction | ||
129 | default: // 所有 | 138 | default: // 所有 |
130 | $gender = '1,2,3'; | 139 | $gender = '1,2,3'; |
131 | } | 140 | } |
141 | + $uid = $this->get('uid'); | ||
142 | + $udid = $this->get('udid'); | ||
143 | + if ($uid) { | ||
144 | + $this->setSession('uid', $uid); | ||
145 | + } | ||
146 | + if ($udid) { | ||
147 | + $this->setSession('udid', $udid); | ||
148 | + } | ||
132 | } | 149 | } |
133 | // 从Cookie获取 | 150 | // 从Cookie获取 |
134 | else { | 151 | else { |
135 | $gender = Helpers::getGenderByCookie(); | 152 | $gender = Helpers::getGenderByCookie(); |
136 | 153 | ||
154 | + $uid = $this->getUid(); | ||
155 | + $udid = $this->getUdid(); | ||
156 | + | ||
137 | $this->setNavHeader('编辑简介', true, SITE_MAIN); | 157 | $this->setNavHeader('编辑简介', true, SITE_MAIN); |
138 | } | 158 | } |
139 | 159 | ||
@@ -146,9 +166,6 @@ class IndexController extends AbstractAction | @@ -146,9 +166,6 @@ class IndexController extends AbstractAction | ||
146 | 166 | ||
147 | $this->setTitle('编辑简介'); | 167 | $this->setTitle('编辑简介'); |
148 | 168 | ||
149 | - $uid = $this->getUid(); | ||
150 | - $udid = $this->getUdid(); | ||
151 | - | ||
152 | $data = array(); | 169 | $data = array(); |
153 | // 模板中使用JS的标识 | 170 | // 模板中使用JS的标识 |
154 | $data['guangList'] = true; | 171 | $data['guangList'] = true; |
@@ -166,7 +183,7 @@ class IndexController extends AbstractAction | @@ -166,7 +183,7 @@ class IndexController extends AbstractAction | ||
166 | if (!empty($article['data']['list']['artList'])) { | 183 | if (!empty($article['data']['list']['artList'])) { |
167 | $build = array(); | 184 | $build = array(); |
168 | foreach ($article['data']['list']['artList'] as $article) { | 185 | foreach ($article['data']['list']['artList'] as $article) { |
169 | - $build[] = Helpers::formatArticle($article, true, $isApp, false); | 186 | + $build[] = Helpers::formatArticle($article, true, $isApp, false, $uid); |
170 | } | 187 | } |
171 | $data['guang']['infos'] = $build; | 188 | $data['guang']['infos'] = $build; |
172 | } | 189 | } |
@@ -216,8 +233,13 @@ class IndexController extends AbstractAction | @@ -216,8 +233,13 @@ class IndexController extends AbstractAction | ||
216 | } | 233 | } |
217 | 234 | ||
218 | /* 获取资讯文章列表 */ | 235 | /* 获取资讯文章列表 */ |
219 | - $uid = $this->getUid(); | ||
220 | - $udid = $this->getUdid(); | 236 | + if ($isApp) { |
237 | + $uid = $this->getSession('uid'); | ||
238 | + $udid = $this->getSession('udid'); | ||
239 | + } else { | ||
240 | + $uid = $this->getUid(); | ||
241 | + $udid = $this->getUdid(); | ||
242 | + } | ||
221 | //$page = intval($page) + 1; | 243 | //$page = intval($page) + 1; |
222 | $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); | 244 | $article = ListData::article($gender, $sortId, $uid, $udid, $page, $tag, $authorId); |
223 | if (empty($article['data']['list']['artList'])) { | 245 | if (empty($article['data']['list']['artList'])) { |
@@ -228,16 +250,17 @@ class IndexController extends AbstractAction | @@ -228,16 +250,17 @@ class IndexController extends AbstractAction | ||
228 | $data = array(); | 250 | $data = array(); |
229 | $build = array(); | 251 | $build = array(); |
230 | foreach ($article['data']['list']['artList'] as $article) { | 252 | foreach ($article['data']['list']['artList'] as $article) { |
231 | - $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor); | 253 | + $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor, $uid); |
232 | } | 254 | } |
233 | $data['infos'] = $build; | 255 | $data['infos'] = $build; |
234 | 256 | ||
235 | - $this->_view->display('page', $data); | ||
236 | - | ||
237 | - exit(); | ||
238 | } while (false); | 257 | } while (false); |
239 | 258 | ||
240 | - echo ' '; | 259 | + if (isset($data)) { |
260 | + $this->_view->display('page', $data); | ||
261 | + } else { | ||
262 | + echo ' '; | ||
263 | + } | ||
241 | } | 264 | } |
242 | 265 | ||
243 | } | 266 | } |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use LibModels\Wap\Guang\DetailData; | 4 | use LibModels\Wap\Guang\DetailData; |
5 | use LibModels\Wap\Product\ListData; | 5 | use LibModels\Wap\Product\ListData; |
6 | +use LibModels\Wap\Guang\OptData; | ||
6 | use Plugin\Helpers; | 7 | use Plugin\Helpers; |
7 | 8 | ||
8 | /** | 9 | /** |
@@ -36,7 +37,7 @@ class InfoController extends AbstractAction | @@ -36,7 +37,7 @@ class InfoController extends AbstractAction | ||
36 | // WAP上设置头部导航 | 37 | // WAP上设置头部导航 |
37 | if (!$isApp) { | 38 | if (!$isApp) { |
38 | $this->setNavHeader('逛', true, SITE_MAIN); | 39 | $this->setNavHeader('逛', true, SITE_MAIN); |
39 | - } | 40 | + } |
40 | 41 | ||
41 | $data = array(); | 42 | $data = array(); |
42 | $data['guangDetail'] = true; // 模板中使用JS的标识 | 43 | $data['guangDetail'] = true; // 模板中使用JS的标识 |
@@ -99,7 +100,7 @@ class InfoController extends AbstractAction | @@ -99,7 +100,7 @@ class InfoController extends AbstractAction | ||
99 | if ($i > 3) { | 100 | if ($i > 3) { |
100 | break; | 101 | break; |
101 | } | 102 | } |
102 | - $good[] = Helpers::formatProduct($goods, false, true, true, 235,314); | 103 | + $good[] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp); |
103 | } | 104 | } |
104 | } | 105 | } |
105 | // 没有商品 | 106 | // 没有商品 |
@@ -130,7 +131,7 @@ class InfoController extends AbstractAction | @@ -130,7 +131,7 @@ class InfoController extends AbstractAction | ||
130 | $product = ListData::productInfoBySkns($skns); | 131 | $product = ListData::productInfoBySkns($skns); |
131 | if (!empty($product['data']['product_list'])) { | 132 | if (!empty($product['data']['product_list'])) { |
132 | foreach ($product['data']['product_list'] as $i => $goods) { | 133 | foreach ($product['data']['product_list'] as $i => $goods) { |
133 | - $good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235,314); | 134 | + $good['goods'][] = Helpers::formatProduct($goods, false, true, true, 235, 314, $isApp); |
134 | } | 135 | } |
135 | $build['collocation'][] = $good; | 136 | $build['collocation'][] = $good; |
136 | } | 137 | } |
@@ -187,5 +188,29 @@ class InfoController extends AbstractAction | @@ -187,5 +188,29 @@ class InfoController extends AbstractAction | ||
187 | $detail = array(); | 188 | $detail = array(); |
188 | $data = array(); | 189 | $data = array(); |
189 | } | 190 | } |
191 | + | ||
192 | + /** | ||
193 | + * APP里使用的收藏内容的接口 | ||
194 | + * | ||
195 | + * @param id 资讯ID | ||
196 | + * @param type "fav"表示收藏 或者 "cancel"表示取消收藏 | ||
197 | + * @return json | ||
198 | + */ | ||
199 | + public function collectAction() | ||
200 | + { | ||
201 | + do { | ||
202 | + if (!$this->isAjax()) { | ||
203 | + break; | ||
204 | + } | ||
205 | + | ||
206 | + $id = $this->get('id'); | ||
207 | + $type = $this->get('type'); | ||
208 | + // 收藏 | ||
209 | + if ($type == 'fav') { | ||
210 | + | ||
211 | + } | ||
212 | + } | ||
213 | + while (false); | ||
214 | + } | ||
190 | 215 | ||
191 | } | 216 | } |
@@ -2,14 +2,16 @@ | @@ -2,14 +2,16 @@ | ||
2 | 2 | ||
3 | use Action\AbstractAction; | 3 | use Action\AbstractAction; |
4 | use LibModels\Wap\Guang\OptData; | 4 | use LibModels\Wap\Guang\OptData; |
5 | +use Plugin\Helpers; | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * 逛操作 | 8 | * 逛操作 |
8 | */ | 9 | */ |
9 | class OptController extends AbstractAction | 10 | class OptController extends AbstractAction |
10 | { | 11 | { |
11 | - /** | ||
12 | - * 资讯文章点赞 | 12 | + |
13 | + /** | ||
14 | + * 资讯文章点赞 (H5里显示点赞) | ||
13 | * | 15 | * |
14 | * @param int $id 唯一的资讯ID | 16 | * @param int $id 唯一的资讯ID |
15 | * @param string $opt 操作(ok:表示确定,cancel:表示取消) | 17 | * @param string $opt 操作(ok:表示确定,cancel:表示取消) |
@@ -18,29 +20,73 @@ class OptController extends AbstractAction | @@ -18,29 +20,73 @@ class OptController extends AbstractAction | ||
18 | public function praiseArticleAction() | 20 | public function praiseArticleAction() |
19 | { | 21 | { |
20 | $result = array(); | 22 | $result = array(); |
21 | - | 23 | + |
22 | do { | 24 | do { |
23 | /* 判断是不是AJAX请求 */ | 25 | /* 判断是不是AJAX请求 */ |
24 | if (!$this->isAjax()) { | 26 | if (!$this->isAjax()) { |
25 | break; | 27 | break; |
26 | } | 28 | } |
27 | - | 29 | + |
28 | /* 判断参数是否有效 */ | 30 | /* 判断参数是否有效 */ |
29 | $id = $this->post('id'); | 31 | $id = $this->post('id'); |
30 | if (!is_numeric($id)) { | 32 | if (!is_numeric($id)) { |
31 | break; | 33 | break; |
32 | } | 34 | } |
33 | - | 35 | + |
34 | /* 执行点赞或取消操作 */ | 36 | /* 执行点赞或取消操作 */ |
35 | $opt = $this->post('opt', 'ok'); | 37 | $opt = $this->post('opt', 'ok'); |
36 | $udid = $this->getUdid(); | 38 | $udid = $this->getUdid(); |
37 | $result = OptData::praiseArticle($udid, $id, $opt); | 39 | $result = OptData::praiseArticle($udid, $id, $opt); |
38 | - } | ||
39 | - while (false); | ||
40 | - | 40 | + |
41 | + } while (false); | ||
42 | + | ||
41 | $this->echoJson($result); | 43 | $this->echoJson($result); |
42 | } | 44 | } |
43 | - | 45 | + |
46 | + /** | ||
47 | + * 资讯文章收藏 (APP里显示收藏) | ||
48 | + * | ||
49 | + * @param int $id 唯一的资讯ID | ||
50 | + * @param string $opt 操作(ok:表示确定,cancel:表示取消) | ||
51 | + * @return json | ||
52 | + */ | ||
53 | + public function collectArticleAction() | ||
54 | + { | ||
55 | + $result = array('code' => 400, 'message' => '您未登录,无法收藏或者取消收藏。请先登录!', 'data' => ''); | ||
56 | + | ||
57 | + do { | ||
58 | + /* 判断是不是AJAX请求 */ | ||
59 | + if (!$this->isAjax()) { | ||
60 | + break; | ||
61 | + } | ||
62 | + | ||
63 | + /* 判断参数是否有效 */ | ||
64 | + $id = $this->post('id'); | ||
65 | + if (!is_numeric($id)) { | ||
66 | + break; | ||
67 | + } | ||
68 | + | ||
69 | + /* 判断用户是否登录 */ | ||
70 | + $uid = $this->getSession('uid'); | ||
71 | + if (empty($uid) || !is_numeric($uid)) { | ||
72 | + break; | ||
73 | + } | ||
74 | + | ||
75 | + /* 执行点赞或取消操作 */ | ||
76 | + $opt = $this->post('opt', 'ok'); | ||
77 | + $data = OptData::collectArticle($uid, $id, $opt); | ||
78 | + if (!$data) { | ||
79 | + $result = array('code' => 400, 'message' => '操作失败', 'data' => ''); | ||
80 | + break; | ||
81 | + } | ||
82 | + | ||
83 | + $result = array('code' => 200, 'message' => '成功', 'data' => ''); | ||
84 | + | ||
85 | + } while (false); | ||
86 | + | ||
87 | + $this->echoJson($result); | ||
88 | + } | ||
89 | + | ||
44 | /** | 90 | /** |
45 | * 品牌收藏 | 91 | * 品牌收藏 |
46 | * | 92 | * |
@@ -50,20 +96,21 @@ class OptController extends AbstractAction | @@ -50,20 +96,21 @@ class OptController extends AbstractAction | ||
50 | */ | 96 | */ |
51 | public function favoriteBrandAction() | 97 | public function favoriteBrandAction() |
52 | { | 98 | { |
53 | - $result = array('code' => 400, 'message' => '未登录', 'data' => false); | ||
54 | - | 99 | + $refer = Helpers::url('/signin.html', array('refer' => $this->server('HTTP_REFERER', '/'))); |
100 | + $result = array('code' => 400, 'message' => '未登录', 'data' => $refer); | ||
101 | + | ||
55 | do { | 102 | do { |
56 | /* 判断是不是AJAX请求 */ | 103 | /* 判断是不是AJAX请求 */ |
57 | if (!$this->isAjax()) { | 104 | if (!$this->isAjax()) { |
58 | break; | 105 | break; |
59 | } | 106 | } |
60 | - | 107 | + |
61 | /* 判断参数是否有效 */ | 108 | /* 判断参数是否有效 */ |
62 | $id = $this->post('id'); | 109 | $id = $this->post('id'); |
63 | if (!is_numeric($id)) { | 110 | if (!is_numeric($id)) { |
64 | break; | 111 | break; |
65 | } | 112 | } |
66 | - | 113 | + |
67 | /* 检查用户是否登录 */ | 114 | /* 检查用户是否登录 */ |
68 | $uid = $this->getUid(); | 115 | $uid = $this->getUid(); |
69 | if (!$uid) { | 116 | if (!$uid) { |
@@ -76,11 +123,11 @@ class OptController extends AbstractAction | @@ -76,11 +123,11 @@ class OptController extends AbstractAction | ||
76 | if (!$status) { | 123 | if (!$status) { |
77 | break; | 124 | break; |
78 | } | 125 | } |
79 | - $result = array('code' => 200, 'message' => '收藏成功', 'data' => $status); | ||
80 | - } | ||
81 | - while (false); | ||
82 | - | 126 | + $result = array('code' => 200, 'message' => '收藏成功', 'data' => ''); |
127 | + | ||
128 | + } while (false); | ||
129 | + | ||
83 | $this->echoJson($result); | 130 | $this->echoJson($result); |
84 | } | 131 | } |
85 | - | 132 | + |
86 | } | 133 | } |
@@ -30,7 +30,7 @@ class PlusstarController extends AbstractAction | @@ -30,7 +30,7 @@ class PlusstarController extends AbstractAction | ||
30 | $data['psList'] = true; // 控制模板中的JS使用 | 30 | $data['psList'] = true; // 控制模板中的JS使用 |
31 | $data['ps']['sName'] = '明星潮品'; | 31 | $data['ps']['sName'] = '明星潮品'; |
32 | $data['ps']['pName'] = '原创潮牌'; | 32 | $data['ps']['pName'] = '原创潮牌'; |
33 | - $data[ 'pageFooter'] = true; | 33 | + $data['pageFooter'] = true; |
34 | 34 | ||
35 | $this->_view->display('list', $data); | 35 | $this->_view->display('list', $data); |
36 | } else { | 36 | } else { |
@@ -41,7 +41,7 @@ class PlusstarController extends AbstractAction | @@ -41,7 +41,7 @@ class PlusstarController extends AbstractAction | ||
41 | $data['psList'] = true; // 控制模板中的JS使用 | 41 | $data['psList'] = true; // 控制模板中的JS使用 |
42 | $data['ps']['sName'] = '设计师'; | 42 | $data['ps']['sName'] = '设计师'; |
43 | $data['ps']['pName'] = '经典潮牌'; | 43 | $data['ps']['pName'] = '经典潮牌'; |
44 | - $data[ 'pageFooter'] = true; | 44 | + $data['pageFooter'] = true; |
45 | 45 | ||
46 | $this->_view->display('list', $data); | 46 | $this->_view->display('list', $data); |
47 | } | 47 | } |
@@ -75,30 +75,54 @@ class PlusstarController extends AbstractAction | @@ -75,30 +75,54 @@ class PlusstarController extends AbstractAction | ||
75 | { | 75 | { |
76 | $data = array(); | 76 | $data = array(); |
77 | 77 | ||
78 | - $id = $this->get('id'); | ||
79 | - $gender = $this->get('gender', '1,3'); | ||
80 | - $uid = $this->getUid(); | ||
81 | - $udid = $this->getUdid(); | ||
82 | - | ||
83 | do { | 78 | do { |
84 | /* 判断参数是否有效 */ | 79 | /* 判断参数是否有效 */ |
85 | - if (!is_numeric($id) || ($gender !== '1,3' && $gender !== '2,3')) { | 80 | + $id = $this->get('id'); |
81 | + if (!is_numeric($id)) { | ||
86 | break; | 82 | break; |
87 | } | 83 | } |
88 | 84 | ||
85 | + $channel = $this->get('yh_channel'); | ||
86 | + // 标识是不是APP客户端 | ||
87 | + $isApp = is_numeric($channel); | ||
88 | + // APP访问时通过频道参数判断性别 | ||
89 | + if ($isApp) { | ||
90 | + switch (intval($channel)) { | ||
91 | + case 1: // 男 | ||
92 | + $gender = '1,3'; | ||
93 | + break; | ||
94 | + case 2: // 女 | ||
95 | + $gender = '2,3'; | ||
96 | + break; | ||
97 | + default: // 所有 | ||
98 | + $gender = '1,2,3'; | ||
99 | + } | ||
100 | + $uid = $this->get('uid'); | ||
101 | + $udid = $this->get('udid'); | ||
102 | + } | ||
103 | + // 从Cookie获取 | ||
104 | + else { | ||
105 | + $gender = Helpers::getGenderByCookie(); | ||
106 | + | ||
107 | + $uid = $this->getUid(); | ||
108 | + $udid = $this->getUdid(); | ||
109 | + } | ||
110 | + | ||
89 | /* 判断品牌信息是否为空 */ | 111 | /* 判断品牌信息是否为空 */ |
90 | - $brandInfo = PlusstarData::brandInfo($id, $gender, $uid, $udid); | 112 | + $brandInfo = PlusstarData::brandInfo($id, $gender, $uid, $udid, $isApp); |
91 | if (empty($brandInfo['getBrandInfo']['data']['brand_id'])) { | 113 | if (empty($brandInfo['getBrandInfo']['data']['brand_id'])) { |
92 | break; | 114 | break; |
93 | } | 115 | } |
94 | $brandId = $brandInfo['getBrandInfo']['data']['brand_id']; | 116 | $brandId = $brandInfo['getBrandInfo']['data']['brand_id']; |
117 | + $brandDomain = $brandInfo['getBrandInfo']['data']['brand_domain']; | ||
118 | + $isDifferent = $brandInfo['getBrandInfo']['data']['is_different']; | ||
95 | 119 | ||
96 | /* 获取更多品牌的链接 */ | 120 | /* 获取更多品牌的链接 */ |
97 | - $url = '/brands'; | ||
98 | - $brandDomains = Product\ListModel::getAllBrandDomains(); | ||
99 | - if (isset($brandDomains[$brandId])) { | ||
100 | - // 构建成 品牌域名.xxx.com | ||
101 | - $url = Helpers::url('', null, $brandDomains[$brandId]); | 121 | + // 构建成 品牌域名.xxx.com |
122 | + $url = Helpers::url('', null, $brandDomain); | ||
123 | + // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 | ||
124 | + if ($isApp) { | ||
125 | + $url .= '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' . $brandId . '","is_different":"' . $isDifferent . '"}}'; | ||
102 | } | 126 | } |
103 | 127 | ||
104 | $data['psDetail'] = true; | 128 | $data['psDetail'] = true; |
@@ -107,12 +131,23 @@ class PlusstarController extends AbstractAction | @@ -107,12 +131,23 @@ class PlusstarController extends AbstractAction | ||
107 | $data['ps']['logo'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['brand_ico'], 160, 160); | 131 | $data['ps']['logo'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['data']['brand_ico'], 160, 160); |
108 | $data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name']; | 132 | $data['ps']['name'] = $brandInfo['getBrandInfo']['data']['brand_name']; |
109 | $data['ps']['isLike'] = $brandInfo['getUidBrandFav']; | 133 | $data['ps']['isLike'] = $brandInfo['getUidBrandFav']; |
110 | - $data['ps']['likeUrl'] = false; //"http://guang.m.yohobuy.com/plustar/brandinfo?id=285&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":285}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"701"}},"priority":"Y"}}"; | ||
111 | $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array(' ' => ' ')); | 134 | $data['ps']['intro'] = empty($brandInfo['getBrandInfo']['data']['brand_intro']) ? '' : strtr(strip_tags($brandInfo['getBrandInfo']['data']['brand_intro']), array(' ' => ' ')); |
112 | $data['ps']['newArrival'] = array(); | 135 | $data['ps']['newArrival'] = array(); |
113 | $data['ps']['newArrival']['moreUrl'] = $url; | 136 | $data['ps']['newArrival']['moreUrl'] = $url; |
114 | $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct']; | 137 | $data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct']; |
115 | $data['ps']['infos'] = array(); | 138 | $data['ps']['infos'] = array(); |
139 | + | ||
140 | + // 拼收藏的URL, 一个坑! | ||
141 | + // 备注:此处是根据原来逛的代码硬扒过来的 | ||
142 | + $defaultUrl = Helpers::url('/plustar/brandinfo', array('id' => $id), 'guang'); | ||
143 | + if ($isApp) { | ||
144 | + $url = $defaultUrl; | ||
145 | + $url .= '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":' | ||
146 | + . $id . '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' . $brandId . '"}},"priority":"Y"}}'; | ||
147 | + } else { | ||
148 | + $url = Helpers::url('/signin.html', array('refer' => $defaultUrl)); | ||
149 | + } | ||
150 | + $data['ps']['likeUrl'] = $url; | ||
116 | 151 | ||
117 | if (empty($brandInfo['getArticleByBrand'])) { | 152 | if (empty($brandInfo['getArticleByBrand'])) { |
118 | break; | 153 | break; |
@@ -120,11 +155,22 @@ class PlusstarController extends AbstractAction | @@ -120,11 +155,22 @@ class PlusstarController extends AbstractAction | ||
120 | 155 | ||
121 | // 相关文章 | 156 | // 相关文章 |
122 | foreach ($brandInfo['getArticleByBrand'] as $value) { | 157 | foreach ($brandInfo['getArticleByBrand'] as $value) { |
123 | - $data['ps']['infos'][] = Helpers::formatArticle($value, false, false, false); | 158 | + $data['ps']['infos'][] = Helpers::formatArticle($value, false, false, false, $uid); |
159 | + } | ||
160 | + | ||
161 | + // 设置头部信息 | ||
162 | + if (!$isApp) { | ||
163 | + $this->setNavHeader($data['ps']['name'], true, SITE_MAIN); | ||
124 | } | 164 | } |
125 | 165 | ||
126 | - $this->setNavHeader($brandInfo['getBrandInfo']['data']['brand_name'], true, SITE_MAIN); | ||
127 | - | 166 | + // 标识有微信分享 |
167 | + $data['hasWxShare'] = true; | ||
168 | + | ||
169 | + $data['shareLink'] = $defaultUrl; | ||
170 | + $data['shareTitle'] = $data['ps']['name']; | ||
171 | + $data['shareDesc'] = (mb_strlen($data['ps']['intro'],'utf-8') > 800) ? mb_substr($data['ps']['intro'], 0, 800, 'utf-8') . '...' : $data['ps']['intro']; | ||
172 | + $data['shareImg'] = $data['ps']['logo']; | ||
173 | + | ||
128 | $brandInfo = array(); | 174 | $brandInfo = array(); |
129 | 175 | ||
130 | } while (false); | 176 | } while (false); |
@@ -134,7 +180,6 @@ class PlusstarController extends AbstractAction | @@ -134,7 +180,6 @@ class PlusstarController extends AbstractAction | ||
134 | } else { | 180 | } else { |
135 | $this->_view->display('detail', $data); | 181 | $this->_view->display('detail', $data); |
136 | } | 182 | } |
137 | - | ||
138 | } | 183 | } |
139 | 184 | ||
140 | } | 185 | } |
@@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction | @@ -34,7 +34,7 @@ class NewsaleController extends AbstractAction | ||
34 | 'size' => '0', | 34 | 'size' => '0', |
35 | 'dayLimit' => 1, | 35 | 'dayLimit' => 1, |
36 | 'discount' => '', | 36 | 'discount' => '', |
37 | - 'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)), | 37 | + 'cartUrl' => Helpers::url('/cart/index/index', null), |
38 | ); | 38 | ); |
39 | 39 | ||
40 | $this->_view->display('new', $data); | 40 | $this->_view->display('new', $data); |
@@ -63,7 +63,7 @@ class NewsaleController extends AbstractAction | @@ -63,7 +63,7 @@ class NewsaleController extends AbstractAction | ||
63 | 'price' => '0', | 63 | 'price' => '0', |
64 | 'size' => '0', | 64 | 'size' => '0', |
65 | 'discount' => '0.1,0.9', | 65 | 'discount' => '0.1,0.9', |
66 | - 'goodList' => array('cartUrl' => Helpers::url('/cart/index/index', null)), | 66 | + 'cartUrl' => Helpers::url('/cart/index/index', null), |
67 | ); | 67 | ); |
68 | 68 | ||
69 | $this->_view->display('sale', $data); | 69 | $this->_view->display('sale', $data); |
@@ -21,7 +21,7 @@ routes.plusstar.route.action = Index | @@ -21,7 +21,7 @@ routes.plusstar.route.action = Index | ||
21 | 21 | ||
22 | ; 国际优选/明星原创详情 | 22 | ; 国际优选/明星原创详情 |
23 | routes.brandinfo.type = "rewrite" | 23 | routes.brandinfo.type = "rewrite" |
24 | -routes.brandinfo.match = "/(plustar/brandinfo)$" | 24 | +routes.brandinfo.match = "/(plustar/brandinfo|guang/plustar/brandinfo)$" |
25 | routes.brandinfo.route.module = Guang | 25 | routes.brandinfo.route.module = Guang |
26 | routes.brandinfo.route.controller = Plusstar | 26 | routes.brandinfo.route.controller = Plusstar |
27 | routes.brandinfo.route.action = detail | 27 | routes.brandinfo.route.action = detail |
-
Please register or login to post a comment