Authored by hf

modify guang detail page to support app

@@ -304,7 +304,7 @@ class AbstractAction extends Controller_Abstract @@ -304,7 +304,7 @@ class AbstractAction extends Controller_Abstract
304 */ 304 */
305 protected function setDescription($description) 305 protected function setDescription($description)
306 { 306 {
307 - $this->_view->assign('description', $description); 307 + $this->_view->assign('description', $description . ' ');
308 } 308 }
309 309
310 /** 310 /**
@@ -20,8 +20,12 @@ class DetailData @@ -20,8 +20,12 @@ class DetailData
20 20
21 /** 21 /**
22 * 逛资讯详情页数据封装 22 * 逛资讯详情页数据封装
  23 + *
  24 + * @param int $id 内容ID
  25 + * @param bool $isApp 标识是否是APP访问
  26 + * @return array
23 */ 27 */
24 - public static function package($id) 28 + public static function package($id, $isApp = false)
25 { 29 {
26 $result = array(); 30 $result = array();
27 $result['getAuthor'] = array(); 31 $result['getAuthor'] = array();
@@ -30,8 +34,11 @@ class DetailData @@ -30,8 +34,11 @@ class DetailData
30 $result['getBrand'] = array(); 34 $result['getBrand'] = array();
31 $result['getOtherArticle'] = array(); 35 $result['getOtherArticle'] = array();
32 36
  37 + // 客户端类型
  38 + $clientType = $isApp ? 'iphone' : 'h5';
  39 +
33 // 获取资讯 40 // 获取资讯
34 - $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id)); 41 + $article = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticle', array($id, $clientType));
35 if (!isset($article['tag'])) { 42 if (!isset($article['tag'])) {
36 return $result; 43 return $result;
37 } 44 }
@@ -40,22 +47,22 @@ class DetailData @@ -40,22 +47,22 @@ class DetailData
40 } 47 }
41 48
42 // 获取作者信息 49 // 获取作者信息
43 - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR, 'getAuthor', array($article['author_id']), function ($retval) use (&$result) { 50 + Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_AUTHOR, 'getAuthor', array($article['author_id'], $clientType), function ($retval) use (&$result) {
44 $result['getAuthor'] = empty($retval) ? array() : $retval; 51 $result['getAuthor'] = empty($retval) ? array() : $retval;
45 }); 52 });
46 53
47 // 获取资讯内容 54 // 获取资讯内容
48 - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id), function ($retval) use (&$result) { 55 + Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getArticleContent', array($id, $clientType), function ($retval) use (&$result) {
49 $result['getArticleContent'] = empty($retval) ? array() : $retval; 56 $result['getArticleContent'] = empty($retval) ? array() : $retval;
50 }); 57 });
51 58
52 // 获取资讯相关的品牌 59 // 获取资讯相关的品牌
53 - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getBrand', array($id), function ($retval) use (&$result) { 60 + Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getBrand', array($id, $clientType), function ($retval) use (&$result) {
54 $result['getBrand'] = empty($retval) ? array() : $retval; 61 $result['getBrand'] = empty($retval) ? array() : $retval;
55 }); 62 });
56 63
57 // 获取资讯相关的其它资讯 64 // 获取资讯相关的其它资讯
58 - Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3), function ($retval) use (&$result) { 65 + Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_PACKAGE_ARTICLE, 'getOtherArticle', array($article['tag'], $id, 0, 3, $clientType), function ($retval) use (&$result) {
59 $result['getOtherArticle'] = empty($retval) ? array() : $retval; 66 $result['getOtherArticle'] = empty($retval) ? array() : $retval;
60 }); 67 });
61 68
@@ -58,7 +58,7 @@ class ListData @@ -58,7 +58,7 @@ class ListData
58 if (isset($sortId)) { 58 if (isset($sortId)) {
59 $param['sort_id'] = $sortId; 59 $param['sort_id'] = $sortId;
60 } 60 }
61 - if (isset($tag)) { 61 + if (!empty($tag)) {
62 $param['tag'] = $tag; 62 $param['tag'] = $tag;
63 } 63 }
64 if (isset($authorId) && is_numeric($authorId)) { 64 if (isset($authorId) && is_numeric($authorId)) {
@@ -110,7 +110,7 @@ class ListData @@ -110,7 +110,7 @@ class ListData
110 $result = array(); 110 $result = array();
111 111
112 if (is_numeric($id)) { 112 if (is_numeric($id)) {
113 - $result = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_AUTHOR, 'getAuthor', array($id)); 113 + $result = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_AUTHOR, 'getAuthor', array($id), 3600); // 缓存1小时
114 } 114 }
115 115
116 return $result; 116 return $result;
@@ -35,7 +35,7 @@ class Helpers @@ -35,7 +35,7 @@ class Helpers
35 case 'index': // 默认 35 case 'index': // 默认
36 $url = ''; 36 $url = '';
37 break; 37 break;
38 - default: 38 + default: // 其它子域名
39 $url = 'http://' . $module . SUB_DOMAIN; 39 $url = 'http://' . $module . SUB_DOMAIN;
40 } 40 }
41 $url .= $uri; 41 $url .= $uri;
@@ -48,6 +48,7 @@ class Helpers @@ -48,6 +48,7 @@ class Helpers
48 48
49 /** 49 /**
50 * 根据尺寸获得图片url 50 * 根据尺寸获得图片url
  51 + *
51 * @param string $url 路径 52 * @param string $url 路径
52 * @param integer $width 图片宽度 53 * @param integer $width 图片宽度
53 * @param integer $height 图片高度 54 * @param integer $height 图片高度
@@ -60,7 +61,7 @@ class Helpers @@ -60,7 +61,7 @@ class Helpers
60 } 61 }
61 62
62 /** 63 /**
63 - * 获取过滤后的URL链接 64 + * 获取过滤APP里附加参数后的URL链接
64 * 65 *
65 * @param string $url 路径 66 * @param string $url 路径
66 * @return string 去除掉如&openby:yohobuy={"action":"go.brand"}这样的APP附加参数 67 * @return string 去除掉如&openby:yohobuy={"action":"go.brand"}这样的APP附加参数
@@ -117,6 +118,31 @@ class Helpers @@ -117,6 +118,31 @@ class Helpers
117 } 118 }
118 119
119 /** 120 /**
  121 + * 获取商品的ICON
  122 + *
  123 + * @param int $type
  124 + * @return array
  125 + */
  126 + public static function getProductIcon($type)
  127 + {
  128 + static $icons = array(
  129 + 1 => 'cloth',
  130 + 3 => 'pants',
  131 + 4 => 'dress',
  132 + 6 => 'shoe',
  133 + 7 => 'bag',
  134 + 10 => 'lamp',
  135 + 241 => 'headset',
  136 + 8 => 'watch',
  137 + 360 => 'swim-suit',
  138 + 308 => 'under'
  139 + );
  140 + $type = intval($type);
  141 +
  142 + return isset($icons[$type]) ? $icons[$type] : '';
  143 + }
  144 +
  145 + /**
120 * 格式化商品信息 146 * 格式化商品信息
121 * 147 *
122 * @param array $productData 需要格式化的商品数据 148 * @param array $productData 需要格式化的商品数据
@@ -127,7 +153,6 @@ class Helpers @@ -127,7 +153,6 @@ class Helpers
127 */ 153 */
128 public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true) 154 public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true)
129 { 155 {
130 -  
131 // 商品信息有问题,则不显示 156 // 商品信息有问题,则不显示
132 if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) { 157 if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
133 return false; 158 return false;
@@ -152,9 +177,9 @@ class Helpers @@ -152,9 +177,9 @@ class Helpers
152 $result['price'] = $productData['market_price']; 177 $result['price'] = $productData['market_price'];
153 $result['salePrice'] = $productData['sales_price']; 178 $result['salePrice'] = $productData['sales_price'];
154 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); 179 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
155 - $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_'  
156 - . $productData['goods_list'][0]['goods_id']  
157 - . '/'. $productData['cn_alphabet'] . '.html'; 180 + $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_'
  181 + . $productData['goods_list'][0]['goods_id']
  182 + . '/' . $productData['cn_alphabet'] . '.html';
158 183
159 if ($showTags) { 184 if ($showTags) {
160 $result['tags'] = array(); 185 $result['tags'] = array();
@@ -190,7 +215,7 @@ class Helpers @@ -190,7 +215,7 @@ class Helpers
190 $result['id'] = $articleData['id']; 215 $result['id'] = $articleData['id'];
191 $result['showTags'] = $showTag; 216 $result['showTags'] = $showTag;
192 $result['img'] = self::getImageUrl($articleData['src'], 640, 640); 217 $result['img'] = self::getImageUrl($articleData['src'], 640, 640);
193 - $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id']; 218 + $result['url'] = $isApp ? $articleData['url'] : self::url('/info/index', array('id' => $articleData['id']), 'guang');
194 $result['title'] = $articleData['title']; 219 $result['title'] = $articleData['title'];
195 $result['text'] = $articleData['intro']; 220 $result['text'] = $articleData['intro'];
196 $result['publishTime'] = $articleData['publish_time']; 221 $result['publishTime'] = $articleData['publish_time'];
@@ -402,29 +427,4 @@ class Helpers @@ -402,29 +427,4 @@ class Helpers
402 return false; 427 return false;
403 } 428 }
404 429
405 - /**  
406 - * 获取商品的ICON  
407 - *  
408 - * @param int $type  
409 - * @return array  
410 - */  
411 - public static function getProductIcon($type)  
412 - {  
413 - static $icons = array(  
414 - 1 => 'cloth',  
415 - 3 => 'pants',  
416 - 4 => 'dress',  
417 - 6 => 'shoe',  
418 - 7 => 'bag',  
419 - 10 => 'lamp',  
420 - 241 => 'headset',  
421 - 8 => 'watch',  
422 - 360 => 'swim-suit',  
423 - 308 => 'under'  
424 - );  
425 - $type = intval($type);  
426 -  
427 - return isset($icons[$type]) ? $icons[$type] : '';  
428 - }  
429 -  
430 } 430 }
@@ -20,6 +20,7 @@ use Plugin\LightnCandy; @@ -20,6 +20,7 @@ use Plugin\LightnCandy;
20 class TemplateLayout implements View_Interface 20 class TemplateLayout implements View_Interface
21 { 21 {
22 /* 模板变量 */ 22 /* 模板变量 */
  23 +
23 protected $_tpl_vars; 24 protected $_tpl_vars;
24 /* 模板目录 */ 25 /* 模板目录 */
25 protected $_tpl_dir; 26 protected $_tpl_dir;
@@ -49,7 +50,7 @@ class TemplateLayout implements View_Interface @@ -49,7 +50,7 @@ class TemplateLayout implements View_Interface
49 // 清空指定的变更值 50 // 清空指定的变更值
50 if (isset($this->_tpl_vars[$name])) { 51 if (isset($this->_tpl_vars[$name])) {
51 unset($this->_tpl_vars[$name]); 52 unset($this->_tpl_vars[$name]);
52 - } 53 + }
53 // 清空整个变量值 54 // 清空整个变量值
54 else { 55 else {
55 $this->_tpl_vars = array(); 56 $this->_tpl_vars = array();
@@ -118,6 +119,23 @@ class TemplateLayout implements View_Interface @@ -118,6 +119,23 @@ class TemplateLayout implements View_Interface
118 // 应用版本号 119 // 应用版本号
119 $tpl_vars['version'] = $config->version; 120 $tpl_vars['version'] = $config->version;
120 121
  122 + // SEO相关的标题、关键词、描述内容信息
  123 + if (isset($tpl_vars['title'])) {
  124 + $tpl_vars['title'] .= $config->seo->title;
  125 + } else {
  126 + $tpl_vars['title'] = $config->seo->title;
  127 + }
  128 + if (isset($tpl_vars['keywords'])) {
  129 + $tpl_vars['keywords'] .= $config->seo->keywords;
  130 + } else {
  131 + $tpl_vars['keywords'] = $config->seo->keywords;
  132 + }
  133 + if (isset($tpl_vars['description'])) {
  134 + $tpl_vars['description'] .= $config->seo->description;
  135 + } else {
  136 + $tpl_vars['description'] = $config->seo->description;
  137 + }
  138 +
121 // 取得模板的最后修改时间戳 139 // 取得模板的最后修改时间戳
122 $lastModifyTime = filemtime($viewName); 140 $lastModifyTime = filemtime($viewName);
123 // 使用MD5生成唯一的键名 141 // 使用MD5生成唯一的键名
@@ -136,11 +154,11 @@ class TemplateLayout implements View_Interface @@ -136,11 +154,11 @@ class TemplateLayout implements View_Interface
136 else { 154 else {
137 $template = file_get_contents($viewName, false, null); 155 $template = file_get_contents($viewName, false, null);
138 $phpStr = LightnCandy::compile($template, array( 156 $phpStr = LightnCandy::compile($template, array(
139 - // DEBUG: LightnCandy::FLAG_RENDER_DEBUG | LightnCandy::FLAG_ERROR_EXCEPTION  
140 - 'flags' => LightnCandy::FLAG_RENDER_DEBUG | LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_MUSTACHE | LightnCandy::FLAG_HANDLEBARS, // 使用MUSTACHE和HANDLEBARS的模板格式  
141 - 'basedir' => array($config->template->partials), // 模板里使用 {{> partial_name}} 时查找的目录  
142 - 'fileext' => array($tplExt), // 允许查找文件的后缀  
143 - 'lcrun' => 'Plugin\LCRun3', // 指定编译模板的runtime 157 + // DEBUG: LightnCandy::FLAG_RENDER_DEBUG | LightnCandy::FLAG_ERROR_EXCEPTION
  158 + 'flags' => LightnCandy::FLAG_RENDER_DEBUG | LightnCandy::FLAG_ERROR_EXCEPTION | LightnCandy::FLAG_MUSTACHE | LightnCandy::FLAG_HANDLEBARS, // 使用MUSTACHE和HANDLEBARS的模板格式
  159 + 'basedir' => array($config->template->partials), // 模板里使用 {{> partial_name}} 时查找的目录
  160 + 'fileext' => array($tplExt), // 允许查找文件的后缀
  161 + 'lcrun' => 'Plugin\LCRun3', // 指定编译模板的runtime
144 )); 162 ));
145 // 文件流方式读取PHP方法 163 // 文件流方式读取PHP方法
146 $renderer = LightnCandy::prepare($phpStr); 164 $renderer = LightnCandy::prepare($phpStr);
@@ -151,8 +169,7 @@ class TemplateLayout implements View_Interface @@ -151,8 +169,7 @@ class TemplateLayout implements View_Interface
151 // 装载内容,调用PHP函数 169 // 装载内容,调用PHP函数
152 try { 170 try {
153 $result = $renderer($tpl_vars); 171 $result = $renderer($tpl_vars);
154 - }  
155 - catch (Exception $e) { 172 + } catch (Exception $e) {
156 $result = ''; 173 $result = '';
157 } 174 }
158 175
@@ -227,12 +244,12 @@ class TemplateLayout implements View_Interface @@ -227,12 +244,12 @@ class TemplateLayout implements View_Interface
227 public function setScriptPath($path) 244 public function setScriptPath($path)
228 { 245 {
229 $result = false; 246 $result = false;
230 - 247 +
231 if (is_dir($path)) { 248 if (is_dir($path)) {
232 $this->_tpl_dir = $path; 249 $this->_tpl_dir = $path;
233 $result = true; 250 $result = true;
234 } 251 }
235 - 252 +
236 return $result; 253 return $result;
237 } 254 }
238 255
@@ -14,9 +14,11 @@ var winH = $(window).height(), @@ -14,9 +14,11 @@ var winH = $(window).height(),
14 14
15 var $author = $('#author-infos'); 15 var $author = $('#author-infos');
16 var $tag = $('#tag'); 16 var $tag = $('#tag');
  17 +var $gender = $('#gender');
  18 +var $isApp = $('#isApp');
17 19
18 var setting = { 20 var setting = {
19 - page: 1, 21 + page: 2,
20 end: false 22 end: false
21 }; 23 };
22 24
@@ -32,7 +34,9 @@ if ($author.length > 0) { @@ -32,7 +34,9 @@ if ($author.length > 0) {
32 34
33 if ($tag.length > 0) { 35 if ($tag.length > 0) {
34 $.extend(setting, { 36 $.extend(setting, {
35 - tag: $tag.val() 37 + tag: $tag.val(),
  38 + gender: $gender.val(),
  39 + isApp: $isApp.val()
36 }); 40 });
37 } 41 }
38 42
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="guang-list-page guang-page yoho-page"> 2 <div class="guang-list-page guang-page yoho-page">
3 - {{# guang}}  
4 - {{# author}}  
5 - <div id="author-infos" class="editor-header clearfix" data-id={{id}}>  
6 - <div class="avatar">  
7 - <img src="{{avatar}}">  
8 - </div>  
9 - <div class="text">  
10 - <p class="name">{{name}}</p>  
11 - <p class="info">{{info}}</p>  
12 - </div>  
13 - </div>  
14 - {{/ author}}  
15 -  
16 - <div id="info-list" class="info-list">  
17 - {{# infos}}  
18 - {{> guang/info}}  
19 - {{/ infos}} 3 +{{# guang}}
  4 + {{# author}}
  5 + <div id="author-infos" class="editor-header clearfix" data-id={{id}}>
  6 + <div class="avatar">
  7 + <img src="{{avatar}}">
  8 + </div>
  9 + <div class="text">
  10 + <p class="name">{{name}}</p>
  11 + <p class="info">{{info}}</p>
20 </div> 12 </div>
  13 + </div>
  14 + {{/ author}}
  15 +
  16 + <div id="info-list" class="info-list">
  17 + {{# infos}}
  18 + {{> guang/info}}
  19 + {{/ infos}}
  20 + </div>
21 21
22 - <div id="load-more-info" class="load-more-info">  
23 - <div class="loading status">  
24 - 正在加载...  
25 - </div>  
26 - <span class="no-more status hide">没有更多啦</span> 22 + <div id="load-more-info" class="load-more-info">
  23 + <div class="loading status">
  24 + 正在加载...
27 </div> 25 </div>
28 - {{#if tag}}  
29 - <input id="tag" type="hidden" value={{tag}}>  
30 - {{/if}}  
31 - {{/ guang}} 26 + <span class="no-more status hide">没有更多啦</span>
  27 + </div>
  28 +
  29 + {{#if tag}}
  30 + <input id="tag" type="hidden" value={{tag}}>
  31 + {{/if}}
  32 + {{#if gender}}
  33 + <input id="gender" type="hidden" value={{gender}}>
  34 + {{/if}}
  35 + {{#if isApp}}
  36 + <input id="isApp" type="hidden" value={{isApp}}>
  37 + {{/if}}
  38 +{{/ guang}}
32 </div> 39 </div>
33 {{> layout/footer}} 40 {{> layout/footer}}
@@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8"> 4 <meta charset="utf-8">
5 -<title>{{title}}Yoho!Buy有货</title>  
6 -<meta name="keywords" content="{{keywords}}Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款">  
7 -<meta name="description" content="{{description}}YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。"> 5 +<title>{{title}}</title>
  6 +<meta name="keywords" content="{{keywords}}">
  7 +<meta name="description" content="{{description}}">
8 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> 8 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
9 <meta http-equiv="cleartype" content="on"> 9 <meta http-equiv="cleartype" content="on">
10 <meta name="apple-mobile-web-app-status-bar-style" content="black" /> 10 <meta name="apple-mobile-web-app-status-bar-style" content="black" />
@@ -23,9 +23,13 @@ class IndexController extends AbstractAction @@ -23,9 +23,13 @@ class IndexController extends AbstractAction
23 23
24 $uid = $this->getUid(); 24 $uid = $this->getUid();
25 $udid = $this->getUdid(); 25 $udid = $this->getUdid();
26 - $type = $this->get('id', 0);  
27 - $gender = rawurldecode($this->get('gender', '1,2,3'));  
28 26
  27 + $type = $this->get('id', 0);
  28 + $gender = $this->get('gender', '1,2,3');
  29 + if (is_string($gender)) {
  30 + $gender = rawurldecode($gender);
  31 + }
  32 +
29 // // 设置侧边栏逛的默认选中状态 33 // // 设置侧边栏逛的默认选中状态
30 // if ($gender === '1,3') { 34 // if ($gender === '1,3') {
31 // $this->setNavSide('boys'); 35 // $this->setNavSide('boys');
@@ -51,19 +55,36 @@ class IndexController extends AbstractAction @@ -51,19 +55,36 @@ class IndexController extends AbstractAction
51 $tag = $this->get('query'); 55 $tag = $this->get('query');
52 $channel = $this->get('yh_channel'); 56 $channel = $this->get('yh_channel');
53 57
  58 + // 标识是不是APP客户端
  59 + $isApp = is_numeric($channel);
  60 + // APP访问时通过频道参数判断性别
  61 + if ($isApp) {
  62 + switch (intval($channel)) {
  63 + case 1: // 男
  64 + $gender = '1,3';
  65 + break;
  66 + case 2: // 女
  67 + $gender = '2,3';
  68 + break;
  69 + default: // 所有
  70 + $gender = '1,2,3';
  71 + }
  72 + }
  73 + // 从Cookie获取
  74 + else {
  75 + $gender = Helpers::getGenderByCookie();
  76 +
  77 + $this->setNavHeader($tag, true, SITE_MAIN);
  78 + }
  79 +
54 // 标签聚合内容列表 80 // 标签聚合内容列表
55 - $article = ListData::article('', 0, $uid, $udid, 1, $tag); 81 + $article = ListData::article($gender, 0, $uid, $udid, 1, $tag);
56 // 标签聚合内容不存在, 跳到错误页面 82 // 标签聚合内容不存在, 跳到错误页面
57 if (empty($article['data']['list']['artList'])) { 83 if (empty($article['data']['list']['artList'])) {
58 $this->error(); 84 $this->error();
59 } 85 }
60 - // 标识是不是APP客户端  
61 - $isApp = isset($channel);  
62 86
63 $this->setTitle($tag); 87 $this->setTitle($tag);
64 - if (!$isApp) {  
65 - $this->setNavHeader($tag, true, SITE_MAIN);  
66 - }  
67 88
68 $data = array(); 89 $data = array();
69 // 模板中使用JS的标识 90 // 模板中使用JS的标识
@@ -78,6 +99,8 @@ class IndexController extends AbstractAction @@ -78,6 +99,8 @@ class IndexController extends AbstractAction
78 99
79 // 分页需要的参数 100 // 分页需要的参数
80 $data['guang']['tag'] = $tag; 101 $data['guang']['tag'] = $tag;
  102 + $data['guang']['gender'] = $gender;
  103 + $data['guang']['isApp'] = $isApp ? 1 : 0;
81 104
82 $this->_view->display('list', $data); 105 $this->_view->display('list', $data);
83 } 106 }
@@ -99,14 +122,31 @@ class IndexController extends AbstractAction @@ -99,14 +122,31 @@ class IndexController extends AbstractAction
99 if (!isset($author['name'])) { 122 if (!isset($author['name'])) {
100 $this->error(); 123 $this->error();
101 } 124 }
  125 +
102 // 标识是不是APP客户端 126 // 标识是不是APP客户端
103 - $isApp = isset($channel);  
104 -  
105 - $this->setTitle('编辑简介');  
106 - if (!$isApp) { 127 + $isApp = is_numeric($channel);
  128 + // APP访问时通过频道参数判断性别
  129 + if ($isApp) {
  130 + switch (intval($channel)) {
  131 + case 1: // 男
  132 + $gender = '1,3';
  133 + break;
  134 + case 2: // 女
  135 + $gender = '2,3';
  136 + break;
  137 + default: // 所有
  138 + $gender = '1,2,3';
  139 + }
  140 + }
  141 + // 从Cookie获取
  142 + else {
  143 + $gender = Helpers::getGenderByCookie();
  144 +
107 $this->setNavHeader('编辑简介', true, SITE_MAIN); 145 $this->setNavHeader('编辑简介', true, SITE_MAIN);
108 } 146 }
109 147
  148 + $this->setTitle('编辑简介');
  149 +
110 $uid = $this->getUid(); 150 $uid = $this->getUid();
111 $udid = $this->getUdid(); 151 $udid = $this->getUdid();
112 152
@@ -122,15 +162,18 @@ class IndexController extends AbstractAction @@ -122,15 +162,18 @@ class IndexController extends AbstractAction
122 $data['author']['id'] = $id; 162 $data['author']['id'] = $id;
123 163
124 // 标签聚合内容列表 164 // 标签聚合内容列表
125 - $article = ListData::article('', 0, $uid, $udid, 1, null, $id); 165 + $article = ListData::article($gender, 0, $uid, $udid, 1, null, $id);
126 // 构建资讯文章内容 166 // 构建资讯文章内容
127 if (!empty($article['data']['list']['artList'])) { 167 if (!empty($article['data']['list']['artList'])) {
128 $build = array(); 168 $build = array();
129 foreach ($article['data']['list']['artList'] as $article) { 169 foreach ($article['data']['list']['artList'] as $article) {
130 - $build[] = Helpers::formatArticle($article, true, false, false); 170 + $build[] = Helpers::formatArticle($article, true, $isApp, false);
131 } 171 }
132 $data['guang']['infos'] = $build; 172 $data['guang']['infos'] = $build;
133 } 173 }
  174 +
  175 + $data['guang']['gender'] = $gender;
  176 + $data['guang']['isApp'] = $isApp ? 1 : 0;
134 177
135 $this->_view->display('list', $data); 178 $this->_view->display('list', $data);
136 } 179 }
@@ -161,6 +204,7 @@ class IndexController extends AbstractAction @@ -161,6 +204,7 @@ class IndexController extends AbstractAction
161 $page = $this->get('page'); 204 $page = $this->get('page');
162 $gender = $this->get('gender'); 205 $gender = $this->get('gender');
163 $authorId = $this->get('authorId'); 206 $authorId = $this->get('authorId');
  207 + $isApp = $this->get('isApp', false);
164 $showAuthor = true; 208 $showAuthor = true;
165 if (!empty($sortId) && !is_numeric($sortId)) { 209 if (!empty($sortId) && !is_numeric($sortId)) {
166 break; 210 break;
@@ -185,7 +229,7 @@ class IndexController extends AbstractAction @@ -185,7 +229,7 @@ class IndexController extends AbstractAction
185 $data = array(); 229 $data = array();
186 $build = array(); 230 $build = array();
187 foreach ($article['data']['list']['artList'] as $article) { 231 foreach ($article['data']['list']['artList'] as $article) {
188 - $build[] = Helpers::formatArticle($article, true, false, $showAuthor); 232 + $build[] = Helpers::formatArticle($article, true, $isApp, $showAuthor);
189 } 233 }
190 $data['infos'] = $build; 234 $data['infos'] = $build;
191 235
@@ -19,34 +19,36 @@ class InfoController extends AbstractAction @@ -19,34 +19,36 @@ class InfoController extends AbstractAction
19 public function indexAction() 19 public function indexAction()
20 { 20 {
21 $id = $this->get('id'); 21 $id = $this->get('id');
22 - 22 +
23 // 判断参数是否有效, 无效会跳转到错误页面 23 // 判断参数是否有效, 无效会跳转到错误页面
24 if (!is_numeric($id)) { 24 if (!is_numeric($id)) {
25 $this->error(); 25 $this->error();
26 } 26 }
27 - 27 +
  28 + // 标识是不是APP访问的
  29 + $isApp = null !== $this->get('app_version', null);
28 // 获取详情内容信息, 异常则跳到错误页面 30 // 获取详情内容信息, 异常则跳到错误页面
29 - $detail = DetailData::package($id); 31 + $detail = DetailData::package($id, $isApp);
30 if (empty($detail['getArticle'])) { 32 if (empty($detail['getArticle'])) {
31 $this->error(); 33 $this->error();
32 } 34 }
33 - 35 +
34 // WAP上设置头部导航 36 // WAP上设置头部导航
35 - if (null === $this->get('openby:yohobuy', null)) { 37 + if (!$isApp) {
36 $this->setNavHeader('逛', true, SITE_MAIN); 38 $this->setNavHeader('逛', true, SITE_MAIN);
37 } 39 }
38 - 40 +
39 $data = array(); 41 $data = array();
40 $data['guangDetail'] = true; // 模板中使用JS的标识 42 $data['guangDetail'] = true; // 模板中使用JS的标识
41 $data['guang']['id'] = $id; 43 $data['guang']['id'] = $id;
42 - 44 +
43 // 作者信息数据 45 // 作者信息数据
44 if (isset($detail['getAuthor']['name'])) { 46 if (isset($detail['getAuthor']['name'])) {
45 $data['guang']['author'] = array(); 47 $data['guang']['author'] = array();
46 $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar']; 48 $data['guang']['author']['avatar'] = $detail['getAuthor']['avatar'];
47 $data['guang']['author']['name'] = $detail['getAuthor']['name']; 49 $data['guang']['author']['name'] = $detail['getAuthor']['name'];
48 $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc']; 50 $data['guang']['author']['intro'] = $detail['getAuthor']['author_desc'];
49 - $data['guang']['author']['url'] = Helpers::url('/author/index', array('id' => $detail['getArticle']['author_id']), 'guang'); 51 + $data['guang']['author']['url'] = $isApp ? $detail['getAuthor']['url'] : Helpers::url('/author/index', array('id' => $detail['getArticle']['author_id']), 'guang');
50 } 52 }
51 53
52 $data['detail'] = array(); 54 $data['detail'] = array();
@@ -54,7 +56,7 @@ class InfoController extends AbstractAction @@ -54,7 +56,7 @@ class InfoController extends AbstractAction
54 $data['detail']['publishTime'] = $detail['getArticle']['publishTime']; 56 $data['detail']['publishTime'] = $detail['getArticle']['publishTime'];
55 $data['detail']['pageView'] = $detail['getArticle']['pageViews']; 57 $data['detail']['pageView'] = $detail['getArticle']['pageViews'];
56 $data['detail']['content'] = array(); 58 $data['detail']['content'] = array();
57 - 59 +
58 if (!empty($detail['getArticleContent'])) { 60 if (!empty($detail['getArticleContent'])) {
59 $build = array(); 61 $build = array();
60 $good = array(); 62 $good = array();
@@ -66,12 +68,11 @@ class InfoController extends AbstractAction @@ -66,12 +68,11 @@ class InfoController extends AbstractAction
66 // 文字 68 // 文字
67 if (isset($value['text'])) { 69 if (isset($value['text'])) {
68 $build['text'] = $value['text']['data']['text']; 70 $build['text'] = $value['text']['data']['text'];
69 - } 71 + }
70 // 单张图 72 // 单张图
71 elseif (isset($value['singleImage'])) { 73 elseif (isset($value['singleImage'])) {
72 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640); 74 $build['bigImage'] = Helpers::getImageUrl($value['singleImage']['data'][0]['src'], 640, 640);
73 - }  
74 - elseif (isset($value['smallPic'])) { 75 + } elseif (isset($value['smallPic']['data'])) {
75 $imgs = $value['smallPic']['data']; 76 $imgs = $value['smallPic']['data'];
76 $build['smallImage'] = array( 77 $build['smallImage'] = array(
77 array( 78 array(
@@ -108,7 +109,7 @@ class InfoController extends AbstractAction @@ -108,7 +109,7 @@ class InfoController extends AbstractAction
108 // 单个商品 109 // 单个商品
109 elseif ($i === 0 && isset($good[0])) { 110 elseif ($i === 0 && isset($good[0])) {
110 $build['relatedReco'] = $good[0]; 111 $build['relatedReco'] = $good[0];
111 - } 112 + }
112 // 多个商品 113 // 多个商品
113 else { 114 else {
114 $build['relatedReco'] = $good; 115 $build['relatedReco'] = $good;
@@ -135,36 +136,53 @@ class InfoController extends AbstractAction @@ -135,36 +136,53 @@ class InfoController extends AbstractAction
135 } 136 }
136 } 137 }
137 } 138 }
138 - 139 +
139 $data['detail']['content'][] = $build; 140 $data['detail']['content'][] = $build;
140 } 141 }
141 } 142 }
142 - 143 +
143 // 相关品牌 144 // 相关品牌
144 if (!empty($detail['getBrand'])) { 145 if (!empty($detail['getBrand'])) {
145 $data['relatedBrand'] = $detail['getBrand']; 146 $data['relatedBrand'] = $detail['getBrand'];
146 } 147 }
147 - 148 +
148 // 相关标签 149 // 相关标签
149 if (!empty($detail['getArticle']['tags'])) { 150 if (!empty($detail['getArticle']['tags'])) {
150 foreach ($detail['getArticle']['tags'] as $value) { 151 foreach ($detail['getArticle']['tags'] as $value) {
151 - $value['url'] = Helpers::url('/tags/index', array('query=' => $value['name']), 'guang'); 152 + if (!$isApp) {
  153 + $value['url'] = Helpers::url('/tags/index', array('query=' => $value['name']), 'guang');
  154 + }
152 $data['relatedTag'][] = $value; 155 $data['relatedTag'][] = $value;
153 } 156 }
154 } 157 }
155 - 158 +
156 // 相关文章 159 // 相关文章
157 if (!empty($detail['getOtherArticle'])) { 160 if (!empty($detail['getOtherArticle'])) {
158 foreach ($detail['getOtherArticle'] as $value) { 161 foreach ($detail['getOtherArticle'] as $value) {
159 - $value['url'] = Helpers::url('/info/index', array('id' => $value['id']), 'guang'); 162 + if (!$isApp) {
  163 + $value['url'] = Helpers::url('/info/index', array('id' => $value['id']), 'guang');
  164 + }
160 $value['thumb'] = Helpers::getImageUrl($value['thumb'], 279, 175); 165 $value['thumb'] = Helpers::getImageUrl($value['thumb'], 279, 175);
161 $data['relatedInfo'][] = $value; 166 $data['relatedInfo'][] = $value;
162 } 167 }
163 } 168 }
164 - 169 +
  170 + // 分享参数
  171 + if (isset($detail['getArticle']['cover_image'])) {
  172 + $data['shareLink'] = Helpers::url('/info/index', array('id' => $id), 'guang');
  173 + $data['shareTitle'] = $detail['getArticle']['article_title'];
  174 + $data['shareDesc'] = $detail['getArticle']['article_summary'];
  175 + if ($detail['getArticle']['cover_image_type'] == 1) {
  176 + $data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 640);
  177 + } else {
  178 + $data['shareImg'] = Helpers::getImageUrl($detail['getArticle']['cover_image'], 640, 320);
  179 + }
  180 + }
  181 +
165 $this->_view->display('index', $data); 182 $this->_view->display('index', $data);
166 - 183 +
167 $detail = array(); 184 $detail = array();
168 $data = array(); 185 $data = array();
169 } 186 }
170 -}  
  187 +
  188 +}
@@ -50,4 +50,9 @@ application.template.ext = ".phtml" @@ -50,4 +50,9 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.5"  
  53 +application.version = "0.0.5"
  54 +
  55 +; 网站SEO信息
  56 +application.seo.title = "Yoho!Buy有货"
  57 +application.seo.keywords = "Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款"
  58 +application.seo.description = "YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。"
@@ -50,4 +50,9 @@ application.template.ext = ".phtml" @@ -50,4 +50,9 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.5"  
  53 +application.version = "0.0.5"
  54 +
  55 +; 网站SEO信息
  56 +application.seo.title = "Yoho!Buy有货"
  57 +application.seo.keywords = "Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款"
  58 +application.seo.description = "YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。"
@@ -50,4 +50,9 @@ application.template.ext = ".phtml" @@ -50,4 +50,9 @@ application.template.ext = ".phtml"
50 application.assets.path = ROOT_PATH "/assets" 50 application.assets.path = ROOT_PATH "/assets"
51 51
52 ; 应用的版本号 52 ; 应用的版本号
53 -application.version = "0.0.5"  
  53 +application.version = "0.0.5"
  54 +
  55 +; 网站SEO信息
  56 +application.seo.title = "Yoho!Buy有货"
  57 +application.seo.keywords = "Yoho! 有货官网,潮流志,潮流男装,潮牌,美国潮牌,日本潮牌,香港潮牌,潮牌店,新品首发,欧美潮流,全球购,代购,时尚,流行,特卖,B2C,正品,购物网站,网上购物,货到付款"
  58 +application.seo.description = "YOHO! 有货,年轻人潮流购物中心,中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。作为YOHO!旗下的购物平台,汇集了全球潮流时尚商品和中国最流行的商品,也是国内最大的原创文化商品平台,也是香港,台湾地区流行商品的集中地。同时包含日本、韩国等众多国外潮流品牌,带给您全新潮流购物体验。"
@@ -89,4 +89,11 @@ routes.girls.route.module = Index @@ -89,4 +89,11 @@ routes.girls.route.module = Index
89 routes.girls.route.controller = Girls 89 routes.girls.route.controller = Girls
90 routes.girls.route.action = index 90 routes.girls.route.action = index
91 91
  92 +; 商品筛选
  93 +routes.goodsfilter.type = "rewrite"
  94 +routes.goodsfilter.match = "/search/filter"
  95 +routes.goodsfilter.route.module = Index
  96 +routes.goodsfilter.route.controller = Search
  97 +routes.goodsfilter.route.action = Filter
  98 +
92 99
  1 +; 商品筛选
  2 +routes.goodsfilter.type = "rewrite"
  3 +routes.goodsfilter.match = "/search/filter"
  4 +routes.goodsfilter.route.module = Index
  5 +routes.goodsfilter.route.controller = Search
  6 +routes.goodsfilter.route.action = Filter