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
yyq
7 years ago
Commit
22a56f43ac2e1eefd83a42f1e7f519b461d671a6
1 parent
3010dabb
goods_list
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
43 deletions
apps/activity/controllers/student.js
apps/product/models/new-recommend.js
apps/product/models/newsale.js
apps/product/models/recommend-for-you.js
utils/product-process.js
apps/activity/controllers/student.js
View file @
22a56f4
'use strict'
;
const
utils
=
'../../../utils'
;
const
productNameProcess
=
require
(
`
$
{
utils
}
/product-name-process`
)
;
const
helpers
=
global
.
yoho
.
helpers
;
const
crypto
=
global
.
yoho
.
crypto
;
const
queryString
=
require
(
'querystring'
);
...
...
@@ -131,15 +129,8 @@ exports.index = (req, res, next) => {
return
item
;
});
datas
[
1
].
data
=
datas
[
1
].
data
||
{};
datas
[
1
].
data
.
product_list
=
(
datas
[
1
].
data
.
product_list
||
[]).
map
(
function
(
value
)
{
value
.
goodsId
=
value
.
goods_list
[
0
].
goods_id
;
if
(
value
.
cn_alphabet
)
{
value
.
cn_alphabet
=
productNameProcess
(
value
.
cn_alphabet
);
}
// 商品url改版
value
.
url
=
helpers
.
urlFormat
(
`
/
product
/
$
{
value
.
product_skn
}.
html
`
)
+
`
?
openby
:
yohobuy
=
{
"action"
:
"go.productDetail"
,
"params"
:{
"product_skn"
:
$
{
value
.
product_skn
}}}
`
;
// eslint-disable-line
return
value
;
...
...
@@ -189,7 +180,6 @@ exports.index = (req, res, next) => {
}
}
// console.log(options);
options
.
studentSwitch
=
!
_
.
get
(
req
.
app
.
locals
.
wap
,
'user.removeStudentIdentification'
,
true
);
res
.
render
(
'student'
,
options
);
});
...
...
@@ -337,13 +327,6 @@ exports.verifystudent = (req, res, next) => {
});
}
datas
[
1
].
data
.
product_list
=
(
datas
[
1
].
data
.
product_list
||
[]).
map
(
function
(
value
)
{
value
.
goodsId
=
value
.
goods_list
[
0
].
goods_id
;
value
.
product_id
=
value
.
product_id
;
if
(
value
.
cn_alphabet
)
{
value
.
cn_alphabet
=
productNameProcess
(
value
.
cn_alphabet
);
}
// 商品url改版
value
.
url
=
helpers
.
urlFormat
(
`
/
product
/
$
{
value
.
product_skn
}.
html
`
)
+
`
?
openby
:
yohobuy
=
{
"action"
:
"go.productDetail"
,
"params"
:{
"product_skn"
:
$
{
value
.
product_skn
}}}
`
;
// eslint-disable-line
return
value
;
...
...
apps/product/models/new-recommend.js
View file @
22a56f4
...
...
@@ -2,8 +2,6 @@
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
const
utils
=
'../../../utils'
;
const
productNameProcess
=
require
(
`
$
{
utils
}
/product-name-process`
)
;
class
storeHome
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
...
...
@@ -19,14 +17,9 @@ class storeHome extends global.yoho.BaseModel {
_
.
forEach
(
list
&&
list
.
product_list
,
value
=>
{
if
(
!
value
.
product_skn
||
!
value
.
goods_list
||
!
value
.
goods_list
.
length
)
{
if
(
!
value
.
product_skn
)
{
return
;
}
value
.
goodsId
=
value
.
goods_list
&&
value
.
goods_list
[
0
]
&&
value
.
goods_list
[
0
].
goods_id
;
if
(
value
.
cn_alphabet
)
{
value
.
cn_alphabet
=
productNameProcess
(
value
.
cn_alphabet
);
}
let
detailUrl
=
helpers
.
urlFormat
(
`
/
product
/
$
{
value
.
product_skn
}.
html
`
);
...
...
apps/product/models/newsale.js
View file @
22a56f4
'use strict'
;
const
utils
=
'../../../utils'
;
const
productNameProcess
=
require
(
`
$
{
utils
}
/product-name-process`
)
;
const
_
=
require
(
'lodash'
);
const
serviceAPI
=
global
.
yoho
.
ServiceAPI
;
const
logger
=
global
.
yoho
.
logger
;
...
...
@@ -106,14 +104,10 @@ module.exports = class extends global.yoho.BaseModel {
_
.
forEach
(
result
.
data
.
product_list
,
function
(
data
,
index
)
{
let
one
=
{};
if
(
data
===
null
||
!
data
.
product_skn
||
!
data
.
goods_list
[
0
]
)
{
if
(
data
===
null
||
!
data
.
product_skn
)
{
return
false
;
}
if
(
data
.
cn_alphabet
)
{
data
.
cn_alphabet
=
productNameProcess
(
data
.
cn_alphabet
);
}
one
=
_
.
assign
(
one
,
{
url
:
'/product/'
+
data
.
product_skn
+
'.html'
,
// 商品url改版
thumb
:
data
.
default_images
,
...
...
apps/product/models/recommend-for-you.js
View file @
22a56f4
'use strict'
;
const
utils
=
'../../../utils'
;
const
productNameProcess
=
require
(
`
$
{
utils
}
/product-name-process`
)
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_
=
require
(
'lodash'
);
...
...
@@ -19,14 +17,9 @@ const getPreferenceData = (data) => {
_
.
forEach
(
list
&&
list
.
product_list
,
value
=>
{
if
(
!
value
.
product_skn
||
!
value
.
goods_list
||
!
value
.
goods_list
.
length
)
{
if
(
!
value
||
!
value
.
product_skn
)
{
return
;
}
value
.
goodsId
=
value
.
goods_list
&&
value
.
goods_list
[
0
]
&&
value
.
goods_list
[
0
].
goods_id
;
if
(
value
.
cn_alphabet
)
{
value
.
cn_alphabet
=
productNameProcess
(
value
.
cn_alphabet
);
}
let
goods
=
{
product_skn
:
value
.
product_skn
,
...
...
utils/product-process.js
View file @
22a56f4
'use strict'
;
require
(
'../app'
);
const
_
=
require
(
'lodash'
);
const
imageHandle
=
require
(
'./image'
);
const
helpers
=
global
.
yoho
.
helpers
;
const
GENDER
=
{
1
:
'男'
,
...
...
@@ -113,9 +114,7 @@ exports.processProductList = (list, options) => {
// }
// 商品信息有问题,则不显示
if
(
!
(
(
product
.
product_skn
&&
_
.
get
(
product
,
'goods_list.length'
,
0
))
||
product
.
recommend_type
))
{
if
(
!
product
||
!
product
.
product_skn
)
{
return
;
}
...
...
@@ -173,6 +172,9 @@ exports.processProductList = (list, options) => {
// if (!flag) {
// product.default_images = _procProductImg(product.goods_list[0], product.gender, options.yh_channel);
// }
//
product
.
default_images
=
imageHandle
.
getSourceUrl
(
product
.
default_images
,
'goodsimg'
);
product
.
is_soon_sold_out
=
product
.
is_soon_sold_out
===
'Y'
;
...
...
Please
register
or
login
to post a comment