Authored by hongweigao

修改url链接

@@ -100,7 +100,7 @@ const getBrandViewTop = channel => { @@ -100,7 +100,7 @@ const getBrandViewTop = channel => {
100 brandAds.push({ 100 brandAds.push({
101 name: subValue.name, 101 name: subValue.name,
102 src: helpers.image(subValue.src, 80, 50, 3), 102 src: helpers.image(subValue.src, 80, 50, 3),
103 - url: helpers.urlFormat(subValue.url) 103 + url: subValue.url
104 }); 104 });
105 }); 105 });
106 } 106 }
@@ -120,7 +120,7 @@ const getBrandViewTop = channel => { @@ -120,7 +120,7 @@ const getBrandViewTop = channel => {
120 brandLogos.push({ 120 brandLogos.push({
121 name: subValue.title, 121 name: subValue.title,
122 src: srcUrl, 122 src: srcUrl,
123 - url: helpers.urlFormat(subValue.url) 123 + url: subValue.url
124 }); 124 });
125 }); 125 });
126 } 126 }
@@ -162,11 +162,11 @@ const getBrandViewList = (channel, start, length) => { @@ -162,11 +162,11 @@ const getBrandViewList = (channel, start, length) => {
162 let href; 162 let href;
163 163
164 if (switchParams.channelType === 1) { 164 if (switchParams.channelType === 1) {
165 - href = helpers.urlFormat(ssubValue.brand_domain) + '?gender=1,3'; 165 + href = helpers.urlFormat('', {gender: '1,3'}, ssubValue.brand_domain);
166 } else if (switchParams.channelType === 2) { 166 } else if (switchParams.channelType === 2) {
167 - href = helpers.urlFormat(ssubValue.brand_domain) + '?gender=2,3'; 167 + href = helpers.urlFormat('', {gender: '2,3'}, ssubValue.brand_domain);
168 } else { 168 } else {
169 - href = helpers.urlFormat(ssubValue.brand_domain); 169 + href = helpers.urlFormat('', '', ssubValue.brand_domain);
170 } 170 }
171 let brandItem = { 171 let brandItem = {
172 name: ssubValue.brand_name, 172 name: ssubValue.brand_name,
@@ -260,7 +260,7 @@ const getBrandInfoByIds = (brandIds) => { @@ -260,7 +260,7 @@ const getBrandInfoByIds = (brandIds) => {
260 if (data.data && data.code === 200) { 260 if (data.data && data.code === 200) {
261 _.forEach(data.data, (subValue, k) => { 261 _.forEach(data.data, (subValue, k) => {
262 subValue.desc = _.trim(subValue.brand_intro.replace('/[\r\n\t ]/g', '')); 262 subValue.desc = _.trim(subValue.brand_intro.replace('/[\r\n\t ]/g', ''));
263 - subValue.url = helpers.urlFormat(subValue.brand_domain); 263 + subValue.url = subValue.brand_domain;
264 delete subValue.brand_intro; 264 delete subValue.brand_intro;
265 brandsInfo[k] = subValue; 265 brandsInfo[k] = subValue;
266 }); 266 });
@@ -287,7 +287,7 @@ const getPlusstarBrandListItem = (channel) => { @@ -287,7 +287,7 @@ const getPlusstarBrandListItem = (channel) => {
287 let items = []; 287 let items = [];
288 288
289 if (resource.data && resource.code === 200) { 289 if (resource.data && resource.code === 200) {
290 - items[0] = {name: '所有品牌', src: '', url: helpers.urlFormat('/brands'), brandType: ''}; 290 + items[0] = {name: '所有品牌', src: '', url: helpers.urlFormat('/brands', ''), brandType: ''};
291 items[1] = {name: '设计新潮', src: '', url: '', brandType: 4}; 291 items[1] = {name: '设计新潮', src: '', url: '', brandType: 4};
292 items[2] = {name: '潮流经典', src: '', url: '', brandType: 1}; 292 items[2] = {name: '潮流经典', src: '', url: '', brandType: 1};
293 items[3] = {name: '明星潮牌', src: '', url: '', brandType: 2}; 293 items[3] = {name: '明星潮牌', src: '', url: '', brandType: 2};
@@ -302,7 +302,7 @@ const getPlusstarBrandListItem = (channel) => { @@ -302,7 +302,7 @@ const getPlusstarBrandListItem = (channel) => {
302 } 302 }
303 303
304 if (pos in resourceData[0].data) { 304 if (pos in resourceData[0].data) {
305 - subValue.url = helpers.urlFormat(resourceData[0].data[pos].url); 305 + subValue.url = resourceData[0].data[pos].url;
306 subValue.src = helpers.image(resourceData[0].data[pos].src, 222, 180, 1); 306 subValue.src = helpers.image(resourceData[0].data[pos].src, 222, 180, 1);
307 subValue.name = resourceData[0].data[pos].title; 307 subValue.name = resourceData[0].data[pos].title;
308 } 308 }
@@ -14,6 +14,33 @@ const _ = require('lodash'); @@ -14,6 +14,33 @@ const _ = require('lodash');
14 const helpers = global.yoho.helpers; 14 const helpers = global.yoho.helpers;
15 const pager = require(`${global.utils}/pager`).setPager; 15 const pager = require(`${global.utils}/pager`).setPager;
16 16
  17 +const BOYS = 'boys';
  18 +const GIRLS = 'girls';
  19 +
  20 +/**
  21 + * 获取品牌一览资源位&channelType
  22 + *
  23 + * @param string $channelStr
  24 + * @return array
  25 + */
  26 +const getGenderByChannel = channel => {
  27 + let gender = '';
  28 +
  29 + switch (channel) {
  30 +
  31 + case BOYS:
  32 + gender = '1,3';
  33 + break;
  34 + case GIRLS:
  35 + gender = '2,3';
  36 + break;
  37 + default:
  38 + gender = '1,2,3';
  39 + break;
  40 + }
  41 + return gender;
  42 +};
  43 +
17 // 添加网站的SEO 44 // 添加网站的SEO
18 const seoMap = { 45 const seoMap = {
19 boys: { 46 boys: {
@@ -129,18 +156,8 @@ exports.plusstarList = (channel, req) => { @@ -129,18 +156,8 @@ exports.plusstarList = (channel, req) => {
129 brandsHomePage: true 156 brandsHomePage: true
130 }; 157 };
131 158
132 - let genderChannel;  
133 -  
134 - if (channel === 'boys') {  
135 - genderChannel = '1,3';  
136 - } else if (channel === 'girls') {  
137 - genderChannel = '2,3';  
138 - } else {  
139 - genderChannel = '1,2,3';  
140 - }  
141 -  
142 let id = req.query.id || '', 159 let id = req.query.id || '',
143 - gender = req.query.gender || genderChannel, 160 + gender = req.query.gender || getGenderByChannel(channel),
144 limit = 20, 161 limit = 20,
145 page = parseInt(req.query.page, 10) || 1; 162 page = parseInt(req.query.page, 10) || 1;
146 163
@@ -174,7 +191,7 @@ exports.plusstarList = (channel, req) => { @@ -174,7 +191,7 @@ exports.plusstarList = (channel, req) => {
174 _.forEach(brandIds, brandId => { 191 _.forEach(brandIds, brandId => {
175 if (brandsInfo[brandId]) { 192 if (brandsInfo[brandId]) {
176 list[brandId].desc = brandsInfo[brandId].desc; 193 list[brandId].desc = brandsInfo[brandId].desc;
177 - list[brandId].url = helpers.urlFormat(brandsInfo[brandId].url + '?gender=' + gender); 194 + list[brandId].url = helpers.urlFormat('', {gender: gender}, brandsInfo[brandId].url);
178 } 195 }
179 brands.push(list[brandId]); 196 brands.push(list[brandId]);
180 }); 197 });