Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
张丽霞
9 years ago
Commit
a0e75e80fb1a95996a1742793338cdbef92860af
1 parent
ac6e9339
拼接为你优选商品链接&商品分类tag
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
1 deletions
apps/product/models/recommend-for-you.js
apps/product/models/recommend-for-you.js
View file @
a0e75e8
...
...
@@ -4,6 +4,8 @@ var API = require('../../../library/api').API;
var
api
=
new
API
();
const
camelCase
=
global
.
yoho
.
camelCase
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
/**
* 分享页面基础参数
...
...
@@ -16,8 +18,40 @@ const getPreferenceData = (data) => {
let
list
=
data
.
data
||
{};
list
=
camelCase
(
list
);
let
distGoods
=
[];
_
.
forEach
(
list
.
productList
,
function
(
value
)
{
if
(
!
value
.
productSkn
||
!
value
.
goodsList
||
!
value
.
goodsList
.
length
)
{
return
;
}
value
.
goodsId
=
value
.
goodsList
[
0
].
goodsId
;
let
goods
=
value
;
goods
.
url
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
value
.
productId
}
_$
{
value
.
goodsId
}
/${value.cnAlphabet}.html`
)
;
if
(
_
.
get
(
goods
,
'tags[0]'
,
null
))
{
goods
.
tags
=
[];
if
(
goods
.
isNew
===
'Y'
)
{
goods
.
tags
.
push
({
isNew
:
true
});
}
else
if
(
goods
.
isAdvance
===
'Y'
)
{
goods
.
tags
.
push
({
isAdvance
:
true
});
}
else
if
(
goods
.
isDiscount
===
'Y'
)
{
goods
.
tags
.
push
({
isDiscount
:
true
});
}
else
if
(
goods
.
isYohoood
===
'Y'
)
{
goods
.
tags
.
push
({
isYohoood
:
true
});
}
else
if
(
goods
.
isLimited
===
'Y'
)
{
goods
.
tags
.
push
({
isLimited
:
true
});
}
}
distGoods
.
push
(
goods
);
});
dest
.
code
=
list
.
code
;
dest
.
goods
=
list
.
productList
;
dest
.
goods
=
distGoods
;
dest
.
rec_id
=
list
.
recId
;
dest
.
message
=
list
.
message
;
...
...
@@ -36,6 +70,7 @@ exports.getPreference = (data) => {
infoData
=
Object
.
assign
(
defaultParam
,
data
);
// 处理完成后,发给后端
return
api
.
get
(
''
,
infoData
).
then
(
result
=>
{
return
getPreferenceData
(
result
);
});
// 所有数据返回一个 Promise,方便 Promise.all 调用
};
...
...
Please
register
or
login
to post a comment