Authored by ccbikai

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

@@ -265,7 +265,8 @@ @@ -265,7 +265,8 @@
265 count: 1 265 count: 1
266 }, 266 },
267 collect: { 267 collect: {
268 - isCollected: true 268 + isCollected: true,
  269 + url: ''
269 }, 270 },
270 share: false, 271 share: false,
271 isFashionMan: true, //标签分类:isTip、isCollocation、isFashionMan、isFashionGood、isTopic 272 isFashionMan: true, //标签分类:isTip、isCollocation、isFashionMan、isFashionGood、isTopic
framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -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 * @param integer $order 类型值 147 * @param integer $order 类型值
122 * @param string $type 排序类型 148 * @param string $type 排序类型
@@ -153,7 +179,6 @@ class Helpers @@ -153,7 +179,6 @@ class Helpers
153 */ 179 */
154 public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true) 180 public static function formatProduct($productData, $showTags = true, $showNew = true, $showSale = true)
155 { 181 {
156 -  
157 // 商品信息有问题,则不显示 182 // 商品信息有问题,则不显示
158 if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) { 183 if (!isset($productData['product_skn']) || !isset($productData['goods_list'][0])) {
159 return false; 184 return false;
@@ -178,9 +203,9 @@ class Helpers @@ -178,9 +203,9 @@ class Helpers
178 $result['price'] = $productData['market_price']; 203 $result['price'] = $productData['market_price'];
179 $result['salePrice'] = $productData['sales_price']; 204 $result['salePrice'] = $productData['sales_price'];
180 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y'); 205 $result['is_soon_sold_out'] = ($productData['is_soon_sold_out'] === 'Y');
181 - $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_'  
182 - . $productData['goods_list'][0]['goods_id']  
183 - . '/'. $productData['cn_alphabet'] . '.html'; 206 + $result['url'] = OLD_MAIN . '/product/pro_' . $productData['product_id'] . '_'
  207 + . $productData['goods_list'][0]['goods_id']
  208 + . '/' . $productData['cn_alphabet'] . '.html';
184 209
185 if ($showTags) { 210 if ($showTags) {
186 $result['tags'] = array(); 211 $result['tags'] = array();
@@ -216,7 +241,7 @@ class Helpers @@ -216,7 +241,7 @@ class Helpers
216 $result['id'] = $articleData['id']; 241 $result['id'] = $articleData['id'];
217 $result['showTags'] = $showTag; 242 $result['showTags'] = $showTag;
218 $result['img'] = self::getImageUrl($articleData['src'], 640, 640); 243 $result['img'] = self::getImageUrl($articleData['src'], 640, 640);
219 - $result['url'] = $isApp && !empty($articleData['url']) ? $articleData['url'] : '/info/index?id=' . $articleData['id']; 244 + $result['url'] = $isApp ? $articleData['url'] : self::url('/info/index', array('id' => $articleData['id']), 'guang');
220 $result['title'] = $articleData['title']; 245 $result['title'] = $articleData['title'];
221 $result['text'] = $articleData['intro']; 246 $result['text'] = $articleData['intro'];
222 $result['publishTime'] = $articleData['publish_time']; 247 $result['publishTime'] = $articleData['publish_time'];
@@ -428,29 +453,4 @@ class Helpers @@ -428,29 +453,4 @@ class Helpers
428 return false; 453 return false;
429 } 454 }
430 455
431 - /**  
432 - * 获取商品的ICON  
433 - *  
434 - * @param int $type  
435 - * @return array  
436 - */  
437 - public static function getProductIcon($type)  
438 - {  
439 - static $icons = array(  
440 - 1 => 'cloth',  
441 - 3 => 'pants',  
442 - 4 => 'dress',  
443 - 6 => 'shoe',  
444 - 7 => 'bag',  
445 - 10 => 'lamp',  
446 - 241 => 'headset',  
447 - 8 => 'watch',  
448 - 360 => 'swim-suit',  
449 - 308 => 'under'  
450 - );  
451 - $type = intval($type);  
452 -  
453 - return isset($icons[$type]) ? $icons[$type] : '';  
454 - }  
455 -  
456 } 456 }
@@ -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,6 +14,8 @@ var winH = $(window).height(), @@ -14,6 +14,8 @@ 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: 2, 21 page: 2,
@@ -32,12 +34,16 @@ if ($author.length > 0) { @@ -32,12 +34,16 @@ 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
39 $(document).scroll(function() { 43 $(document).scroll(function() {
40 - if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { 44 +
  45 + //设置50px阈值
  46 + if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH - 50) {
41 loadMore($infos, setting); 47 loadMore($infos, setting);
42 } 48 }
43 }); 49 });
@@ -96,7 +96,7 @@ function initFilter(cb) { @@ -96,7 +96,7 @@ function initFilter(cb) {
96 //tap subclassify 96 //tap subclassify
97 $cur = $this.closest('li'); 97 $cur = $this.closest('li');
98 98
99 - classifyTapEvt($cur); 99 + subClassifyTapEvt($cur);
100 } else { 100 } else {
101 101
102 //tap classify 102 //tap classify
@@ -104,7 +104,7 @@ function initFilter(cb) { @@ -104,7 +104,7 @@ function initFilter(cb) {
104 104
105 e.srcEvent.stopPropagation(); 105 e.srcEvent.stopPropagation();
106 106
107 - subClassifyTapEvt($cur); 107 + classifyTapEvt($cur);
108 } 108 }
109 } else { 109 } else {
110 hideFilter(); 110 hideFilter();
@@ -116,9 +116,6 @@ function initFilter(cb) { @@ -116,9 +116,6 @@ function initFilter(cb) {
116 }); 116 });
117 } 117 }
118 118
119 -//设置完高度后显示sub并设置选中  
120 -//T:不在HTML中使用{{#if @first}}active{{/if}}来初始化active为避免sub设置高度时的闪烁  
121 -// $filter.find('.classify > :first-child').addClass('active');  
122 exports.initFilter = initFilter; 119 exports.initFilter = initFilter;
123 120
124 exports.showFilter = showFilter; 121 exports.showFilter = showFilter;
  1 +.err-page .err-bg {
  2 + position: fixed;
  3 + height: 200rem / $pxConvertRem;
  4 + width: 200rem / $pxConvertRem;
  5 + top: 50%;
  6 + left: 50%;
  7 + margin-left: -100rem / $pxConvertRem;
  8 + margin-top: -100rem / $pxConvertRem;
  9 + background: image-url('404.png') no-repeat;
  10 + background-size: 100% 100%;
  11 +}
@@ -126,5 +126,5 @@ @@ -126,5 +126,5 @@
126 126
127 } 127 }
128 128
129 -@import "search","footer"; 129 +@import "search","footer", "error";
130 130
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}}
  1 +{{> layout/header}}
  2 +<div class="err-page yoho-page">
  3 + <div class="err-bg"></div>
  4 +</div>
  5 +{{> layout/footer}}
@@ -9,7 +9,9 @@ @@ -9,7 +9,9 @@
9 <span class="like-count">{{count}}</span> 9 <span class="like-count">{{count}}</span>
10 {{/ like}} 10 {{/ like}}
11 {{# collect}} 11 {{# collect}}
12 - <i class="iconfont collect-btn{{#isCollected}} collected{{/isCollected}}">&#xe605;</i> 12 + <a href={{url}}>
  13 + <i class="iconfont collect-btn{{#isCollected}} collected{{/isCollected}}">&#xe605;</i>
  14 + </a>
13 {{/ collect}} 15 {{/ collect}}
14 {{# share}} 16 {{# share}}
15 <a href="{{.}}" class="iconfont share-btn">&#xe600;</a> 17 <a href="{{.}}" class="iconfont share-btn">&#xe600;</a>
@@ -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" />
@@ -15,6 +15,7 @@ class ErrorController extends AbstractAction @@ -15,6 +15,7 @@ class ErrorController extends AbstractAction
15 { 15 {
16 header('HTTP/1.1 404 Not Found'); 16 header('HTTP/1.1 404 Not Found');
17 header('Status: 404 Not Found'); 17 header('Status: 404 Not Found');
  18 + $this->_view->display('index');
18 } 19 }
19 20
20 public function errorAction($exception) 21 public function errorAction($exception)
@@ -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