Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
73027307b4ea11cb6e9364af4165b1e7481fc8e1
1 parent
e7741416
sale seo
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
123 additions
and
14 deletions
apps/product/controllers/sale.js
apps/product/models/sale.js
apps/product/views/partial/sale/brand-sale.hbs
apps/product/views/partial/sale/discount-center-content.hbs
doraemon/middleware/htaccess/rules/www.js
doraemon/middleware/seo/seoConfig.js
doraemon/views/partial/product/good.hbs
public/scss/common/_good.css
public/scss/product/sale/_base.css
utils/product-process-simple.js
utils/product-process.js
apps/product/controllers/sale.js
View file @
7302730
...
...
@@ -60,7 +60,10 @@ exports.discount = (req, res, next) => {
responseData
.
result
=
result
;
if
(
result
)
{
responseData
.
headerData
=
result
.
headerData
;
Object
.
assign
(
responseData
,
result
.
seo
||
{});
}
res
.
render
(
'sale/discount'
,
responseData
);
}).
catch
(
next
);
};
...
...
apps/product/models/sale.js
View file @
7302730
...
...
@@ -109,20 +109,23 @@ function getSaleGoodsData(params, vipLevel) {
case
'5'
:
finalResult
.
goods
.
push
({
thumb
:
'//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-broken.jpg'
,
url
:
'/product/sale/breakingYards?channel='
+
params
.
channel
url
:
'/product/sale/breakingYards?channel='
+
params
.
channel
,
noFollow
:
true
});
break
;
case
'2'
:
finalResult
.
goods
.
push
({
thumb
:
'//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-vip.jpg'
,
url
:
'/product/sale/vip?channel='
+
params
.
channel
,
vipPicture
:
true
// 为了处理首页最后一张图片
vipPicture
:
true
,
// 为了处理首页最后一张图片
noFollow
:
true
});
break
;
case
'0'
:
finalResult
.
goods
.
push
({
thumb
:
'//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-sale.jpg'
,
url
:
'/product/sale/newSale?channel='
+
params
.
channel
url
:
'/product/sale/newSale?channel='
+
params
.
channel
,
noFollow
:
true
});
break
;
default
:
...
...
@@ -206,6 +209,7 @@ function getSaleIndexData(channel) {
);
}
let
saleGoods
=
await
Promise
.
all
(
_
.
cloneDeep
(
finalResult
.
saleCategory
).
map
(
value
=>
{
return
this
.
getSaleGoodsData
(
querystring
.
parse
(
_
.
trim
(
value
.
urlLocation
,
'?'
)));
}));
...
...
@@ -329,6 +333,26 @@ function getSaleOthersData(params, channel) {
});
}
/**
* 设置折扣专场TDK
* @return {[object]} [tdk]
*/
function
_setSaleDiscountData
(
info
)
{
let
title
=
_
.
get
(
info
,
'saleTitle.title'
,
''
);
let
keyWordsArr
=
[
title
];
_
.
forEach
(
_
.
get
(
info
,
'leftContent.allSort.list'
,
[]),
value
=>
{
keyWordsArr
.
push
(
`潮流折扣
$
{
value
.
name
}
`
);
});
return
{
title
:
`【
$
{
title
}
】潮流折扣商品
|
YOHO
!
BUY
有货`
,
keywords
:
_
.
take
(
keyWordsArr
,
5
).
join
(
','
),
description
:
`有货网为您提供大量
$
{
title
}
商品,支持货到付款,质量保证,让您全面了解
$
{
title
}
商品价格、品牌、图片、折扣等方面信息,想网购
$
{
title
}
商品就上有货网!`
// eslint-disable-line
};
}
/**
* 获取折扣专场数据 Controller 调用
* @return {[type]} [description]
...
...
@@ -386,7 +410,6 @@ function getSaleDiscountData(params, channel) {
});
}
// 处理商品数据,顶部分类
if
(
subResult
[
1
].
code
===
200
)
{
let
sknArr
=
[];
...
...
@@ -405,6 +428,8 @@ function getSaleDiscountData(params, channel) {
finalResult
.
criteo
=
{
skn
:
sknArr
};
// 重要:推广列表前三个商品Skn
}
finalResult
.
seo
=
_setSaleDiscountData
(
finalResult
);
return
finalResult
;
});
}
...
...
@@ -599,6 +624,16 @@ function getSaleSpecialData(id, params, channel) {
};
}
}
let
specialName
=
_
.
get
(
special
,
'data.special_name'
,
'活动专区'
)
Object
.
assign
(
resData
,
{
title
:
`
$
{
specialName
}
|
限时折扣
|
YOHO
!
BUY
有货`
,
keywords
:
`
$
{
specialName
}
,限时折扣,折扣商品`
,
description
:
`有货网为您带来限时
$
{
specialName
}
,大量限时折扣商品,优惠幅度大,支持货到付款,`
+
'让您全面了解限时感恩特享商品价格、品牌、图片、折扣等方面信息,想网购限时感恩特享商品就上有货网!'
});
return
resData
;
});
});
...
...
apps/product/views/partial/sale/brand-sale.hbs
View file @
7302730
...
...
@@ -6,9 +6,9 @@
</div>
<div
class=
"sale-group-big clearfix"
>
{{#
big
}}
<a
class=
"item pull-left"
href=
"
{{
link
}}
"
target=
"_blank"
>
<a
class=
"item pull-left"
href=
"
{{
link
}}
"
target=
"_blank"
title=
"
{{
title
}}
"
>
<div
class=
"pic"
>
<img
src=
"
{{
image2
img
w
=
375
h
=
375
}}
"
>
<img
src=
"
{{
image2
img
w
=
375
h
=
375
}}
"
alt=
"
{{
title
}}
"
>
<div
class=
"time"
><span
class=
"time-span"
><span
class=
"iconfont"
>

</span>
{{
time
}}
</span></div>
</div>
<div
class=
"detail"
>
...
...
@@ -29,8 +29,8 @@
</div>
<div
class=
"sale-group clearfix"
>
{{#
normal
}}
<a
class=
"item pull-left"
href=
"
{{
link
}}
"
target=
"_blank"
>
<img
class=
"pic"
src=
"
{{
image2
img
w
=
350
h
=
350
}}
"
>
<a
class=
"item pull-left"
href=
"
{{
link
}}
"
target=
"_blank"
title=
"
{{
title
}}
"
>
<img
class=
"pic"
src=
"
{{
image2
img
w
=
350
h
=
350
}}
"
alt=
"
{{
title
}}
"
>
<div
class=
"detail"
>
<div
class=
"title"
>
{{
title
}}
</div>
<div
class=
"time"
>
{{
time
}}
</div>
...
...
apps/product/views/partial/sale/discount-center-content.hbs
View file @
7302730
<div
class=
"center-content clearfix"
>
{{#
saleTitle
}}
<div
class=
"sale-title"
>
<
span
class=
"title"
>
{{
title
}}
</span
>
<
h1
class=
"title"
>
{{
title
}}
</h1
>
{{#if
discount
}}
<span
class=
"discount"
>
{{
discount
}}
</span>
{{/if}}
...
...
@@ -27,4 +27,4 @@
{{/
allSort
}}
{{/
leftContent
}}
</ul>
</div>
\ No newline at end of file
</div>
...
...
doraemon/middleware/htaccess/rules/www.js
View file @
7302730
...
...
@@ -206,6 +206,16 @@ module.exports = [
return
`
/
guang
/
index
/
editor
?
channel
=
$
{
channel
}
&
author_id
=
$
{
authorId
}
&
page
=
$
{
page
}
`
;
}
},
// sale页
{
type
:
TYPE
.
rewrite
,
origin
:
/^
\/(
boys|girls|kids|lifestyle
)
-sale
(\/
*
)
$/
,
target
:
(
req
)
=>
{
return
`
/
product
/
$
{
req
.
url
}
`
;
}
},
{
type
:
TYPE
.
rewrite
,
origin
:
/
\/
shop
([\d]
+
)
-about/
,
...
...
doraemon/middleware/seo/seoConfig.js
View file @
7302730
...
...
@@ -27,26 +27,61 @@ const seoMap = {
keywords
:
'有货优惠券,有货现金优惠券,全场券,品类券,品牌券'
,
description
:
'YOHO!BUY有货官网领券频道,提供有货优惠券,有货现金优惠券,有货全场券,有货品类券,品牌券免费领取,让你做网购达人,省钱又省心!'
},
'/boys-sale/'
:
{
title
:
'SALE|男装SALE,男装折扣|YOHO!BUY有货'
,
keywords
:
'SALE,男装SALE,男装折扣'
,
description
:
'YOHO!BUY有货SALE频道提供男装折扣,精致品牌男装sale,男装,针织衫,外套 卫衣,衬衫,T恤/POLO衫,裤子,品牌男鞋等限时特惠。YOHO!BUY有货男装折扣,100%正品保证!'
},
'/product/boys-sale/'
:
{
title
:
'SALE|男装SALE,男装折扣|YOHO!BUY有货'
,
keywords
:
'SALE,男装SALE,男装折扣'
,
description
:
'YOHO!BUY有货SALE频道提供男装折扣,精致品牌男装sale,男装,针织衫,外套 卫衣,衬衫,T恤/POLO衫,裤子,品牌男鞋等限时特惠。YOHO!BUY有货男装折扣,100%正品保证!'
},
'/girls-sale/'
:
{
title
:
'SALE|女装SALE,女装折扣|YOHO!BUY有货'
,
keywords
:
'SALE,女装SALE,女装折扣'
,
description
:
'YOHO!BUY有货SALE频道提供女装折扣,精致品牌女装sale,女装,针织衫,外套 卫衣,衬衫,T恤/POLO衫,裤子,品牌女鞋等限时特惠。YOHO!BUY有货女装折扣,100%正品保证!'
},
'/product/girls-sale/'
:
{
title
:
'SALE|女装SALE,女装折扣|YOHO!BUY有货'
,
keywords
:
'SALE,女装SALE,女装折扣'
,
description
:
'YOHO!BUY有货SALE频道提供女装折扣,精致品牌女装sale,女装,针织衫,外套 卫衣,衬衫,T恤/POLO衫,裤子,品牌女鞋等限时特惠。YOHO!BUY有货女装折扣,100%正品保证!'
},
'/kids-sale/'
:
{
title
:
'SALE|童装SALE,童装折扣,潮童鞋包配饰特卖|YOHO!BUY有货'
,
keywords
:
'SALE,童装SALE,童装折扣,潮童鞋包配饰特卖'
,
description
:
'YOHO!BUY有货SALE频道提供童装折扣,精致品牌童装sale,童装,针织衫,外套 卫衣,夹克,棉衣,裤子,品牌童鞋,潮童鞋包配饰等限时特惠。YOHO!BUY有货潮童折扣,100%正品保证!'
},
'/product/kids-sale/'
:
{
title
:
'SALE|童装SALE,童装折扣,潮童鞋包配饰特卖|YOHO!BUY有货'
,
keywords
:
'SALE,童装SALE,童装折扣,潮童鞋包配饰特卖'
,
description
:
'YOHO!BUY有货SALE频道提供童装折扣,精致品牌童装sale,童装,针织衫,外套 卫衣,夹克,棉衣,裤子,品牌童鞋,潮童鞋包配饰等限时特惠。YOHO!BUY有货潮童折扣,100%正品保证!'
},
'/lifestyle-sale/'
:
{
title
:
'SALE|家居生活用品SALE,生活用品折扣,数码家居特卖YOHO!BUY有货'
,
keywords
:
'SALE,家居生活用品SALE,生活用品折扣,数码家居特卖'
,
description
:
'YOHO!BUY有货SALE频道提供生活用品折扣,数码家居特卖,数码3c,居家,玩具娱乐,文具,美妆等限时特惠。YOHO!BUY有货家居生活用品SALE,,100%正品保证'
},
'/product/lifestyle-sale/'
:
{
title
:
'SALE|家居生活用品SALE,生活用品折扣,数码家居特卖YOHO!BUY有货'
,
keywords
:
'SALE,家居生活用品SALE,生活用品折扣,数码家居特卖'
,
description
:
'YOHO!BUY有货SALE频道提供生活用品折扣,数码家居特卖,数码3c,居家,玩具娱乐,文具,美妆等限时特惠。YOHO!BUY有货家居生活用品SALE,,100%正品保证'
},
'/product/sale/vip'
:
{
title
:
'VIP会员专享|会员专享|YOHO!BUY有货'
,
keywords
:
'会员专享,VIP专享,专享商品'
,
description
:
'有货网为您带VIP会员专享精选商品,大量潮流品牌商品,VIP价格优惠幅度大,支持货到付款,让您全面了解VIP会员专享商品价格、品牌、图片、折扣等方面信息,想网购VIP会员专享商品就上有货网!'
},
'/product/sale/breakingYards'
:
{
title
:
'断码商品|断码折扣商品|YOHO!BUY有货'
,
keywords
:
'断码商品、断码专区、断码折扣'
,
description
:
'有货网为您带断码专区精选商品,大量断码商品,价格优惠幅度大,支持货到付款,让您全面了解潮流断码商品价格、品牌、图片、折扣等方面信息,想网购潮流断码区商品就上有货网!'
},
'/product/sale/newSale'
:
{
title
:
'降价优选商品|潮流降价精品|YOHO!BUY有货'
,
keywords
:
'降价优选、降价商品,潮流商品'
,
description
:
'有货网为您带来降价优选商品,大量降价折扣优选商品,价格优惠幅度大,质量保证,支持货到付款,让您全面了解降价优选商品价格、品牌、图片、折扣等方面信息,想网购潮流降价商品就上有货网!'
},
'/privacy.html'
:
{
title
:
`有货隐私条款
|
$
{
siteName
}
`
,
keywords
:
'有货隐私条款'
,
...
...
doraemon/views/partial/product/good.hbs
View file @
7302730
...
...
@@ -31,8 +31,8 @@
{{/
tags
}}
</div>
<div
class=
"good-detail-img"
>
<a
class=
"good-thumb"
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image2
thumb
w
=
280
h
=
382
}}
"
>
<a
class=
"good-thumb"
href=
"
{{
url
}}
"
{{#
productTitle
}}
title=
"
{{
.
}}
"
{{/
productTitle
}}{{#if
noFollow
}}
rel=
"nofollow"
{{/if}}
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image2
thumb
w
=
280
h
=
382
}}
"
{{#
productTitle
}}
alt=
"
{{
.
}}
"
{{/
productTitle
}}
>
</a>
{{#
is_few
}}
<p
class=
"few-tag"
>
即将售罄
</p>
...
...
@@ -43,9 +43,11 @@
{{/
is_solded
}}
</div>
<div
class=
"good-detail-text
{{#
for_stu
}}
stu-good-detail
{{/
for_stu
}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
{{{
product_name
}}}
</a>
<a
href=
"
{{
url
}}
"
target=
"_blank"
{{#
productTitle
}}
title=
"
{{
.
}}
"
{{/
productTitle
}}{{#if
noFollow
}}
rel=
"nofollow"
{{/if}}
>
{{{
product_name
}}}
</a>
<p
class=
"brand"
>
<a
href=
"
{{
brandUrl
}}
"
{{#if
@root
.
pageNoFollow
}}
rel=
"nofollow"
{{/if}}
>
{{
brand_name
}}
</a>
{{#if
brand_name
}}
<a
href=
"
{{
brandUrl
}}
"
{{#if
@root
.
pageNoFollow
}}
rel=
"nofollow"
{{/if}}
>
{{
brand_name
}}
</a>
{{/if}}
</p>
<p
class=
"price
{{#if
vip
}}
vip-center
{{/if}}
"
>
{{#
market_price
}}
...
...
public/scss/common/_good.css
View file @
7302730
...
...
@@ -15,6 +15,7 @@
overflow
:
hidden
;
width
:
100%
;
height
:
100%
;
color
:
#fff
;
}
.few-tag
{
...
...
public/scss/product/sale/_base.css
View file @
7302730
...
...
@@ -574,6 +574,8 @@
.title
{
margin-right
:
20px
;
font-size
:
16px
;
display
:
inline-block
;
vertical-align
:
middle
;
}
.discount
{
...
...
utils/product-process-simple.js
View file @
7302730
...
...
@@ -3,6 +3,13 @@ const _ = require('lodash');
const
helpers
=
global
.
yoho
.
helpers
;
const
logger
=
global
.
yoho
.
logger
;
const
genderName
=
{
'1'
:
'男生'
,
'2'
:
'女生'
,
'1,3'
:
'男生'
,
'2,3'
:
'女生'
};
/**
* 商品搜索商品数据处理
*/
...
...
@@ -158,6 +165,9 @@ exports.processProductList = (list, options) => {
isfew
?
proInfo
.
is_few
=
isfew
:
delete
proInfo
.
is_few
;
}
proInfo
.
productTitle
=
_
.
compact
([
product
.
brand_name_en
,
product
.
brand_name_cn
||
product
.
brand_name
,
genderName
[
product
.
gender
],
product
.
small_sort_name
,
product
.
product_name
]).
join
(
'|'
);
if
(
options
.
query
&&
_
.
isString
(
proInfo
.
product_name
))
{
try
{
let
qreg
=
new
RegExp
(
options
.
query
.
replace
(
'\\'
,
'\\\\'
),
'ig'
);
...
...
utils/product-process.js
View file @
7302730
...
...
@@ -103,6 +103,13 @@ const procProductImgs = (item, gender) => {
}
};
const
genderName
=
{
'1'
:
'男生'
,
'2'
:
'女生'
,
'1,3'
:
'男生'
,
'2,3'
:
'女生'
};
/**
* 商品搜索商品数据处理
*/
...
...
@@ -293,6 +300,10 @@ exports.processProductList = (list, options) => {
product
.
tags
=
tags
;
isfew
?
product
.
is_few
=
isfew
:
delete
product
.
is_few
;
}
product
.
productTitle
=
_
.
compact
([
product
.
brand_name_en
,
product
.
brand_name_cn
||
product
.
brand_name
,
genderName
[
product
.
gender
],
product
.
small_sort_name
,
product
.
product_name
]).
join
(
'|'
);
if
(
options
.
query
&&
_
.
isString
(
product
.
product_name
))
{
try
{
let
qreg
=
new
RegExp
(
options
.
query
.
replace
(
'\\'
,
'\\\\'
),
'ig'
);
...
...
Please
register
or
login
to post a comment