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
Plain Diff
Browse Files
Authored by
周少峰
8 years ago
Commit
c7fa9a01ecfbde9e619f447a5422ebe0db376d5c
2 parents
31d2e034
26474cf8
master
...
baidu_ocpcapi
develop
feature/canbuy
feature/channelDataMap
feature/company-profile
feature/contact
feature/detail-link
feature/home-optimize
feature/overseas-edition
feature/payment
feature/pcurl
feature/reduce
feature/refactor_alert
feature/shoppingPay
feature/virtualOrder
hotfix/11
hotfix/cart
hotfix/changeappversion
hotfix/gift
hotfix/im
hotfix/link
hotfix/ocpc
hotfix/shop
hotfix/upload
hotfix/yohobi
release/6.9.0
release/6.9.2
2019-12-5
all
Merge branch 'gray'
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
8 deletions
apps/guang/controllers/index.js
apps/product/controllers/detail.js
apps/product/controllers/favorite.js
apps/product/models/detail-service.js
utils/product-process.js
apps/guang/controllers/index.js
View file @
c7fa9a0
...
...
@@ -233,7 +233,7 @@ exports.detail = (req, res, next) => {
// 判断参数是否有效, 无效会跳转到错误页面
if
(
!
info
||
!
info
.
title
)
{
return
ne
w
Error
(
'文章不存在'
);
return
ne
xt
(
);
}
let
promises
=
[
...
...
@@ -304,8 +304,8 @@ exports.detail = (req, res, next) => {
description
:
'潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜'
,
webNavHeader
:
channel
}));
}).
catch
(
next
);
});
});
}).
catch
(
next
);
};
/**
...
...
apps/product/controllers/detail.js
View file @
c7fa9a0
...
...
@@ -39,7 +39,7 @@ const showMain = (req, res, next) => {
module
:
'product'
,
page
:
'detail'
},
result
.
seo
,
result
));
}).
catch
(
next
);
}).
catch
(
()
=>
next
()
);
};
...
...
apps/product/controllers/favorite.js
View file @
c7fa9a0
...
...
@@ -143,8 +143,8 @@ const isFavShop = (req, res, next) => {
};
const
num
=
(
req
,
res
,
next
)
=>
{
let
bid
=
_
.
parseInt
(
req
.
query
.
bid
)
||
0
;
let
sid
=
_
.
parseInt
(
req
.
query
.
sid
)
||
0
;
let
bid
=
_
.
parseInt
(
`
0
$
{
req
.
query
.
bid
}
`
)
||
0
;
let
sid
=
_
.
parseInt
(
`
0
$
{
req
.
query
.
sid
}
`
)
||
0
;
if
(
sid
)
{
return
brandService
.
getShopFavNumAsync
(
sid
).
then
((
result
)
=>
{
...
...
@@ -157,6 +157,8 @@ const num = (req, res, next) => {
res
.
json
(
result
);
}).
catch
(
next
);
}
res
.
json
({});
};
module
.
exports
=
{
...
...
apps/product/models/detail-service.js
View file @
c7fa9a0
...
...
@@ -14,7 +14,7 @@ const cheerio = require('cheerio');
const
helpers
=
global
.
yoho
.
helpers
;
const
config
=
global
.
yoho
.
config
;
const
crypto
=
global
.
yoho
.
crypto
;
const
logger
=
global
.
yoho
.
logger
;
const
videoPlayerTpl
=
require
(
'../helper/video-player-tpl'
);
const
productAPI
=
require
(
'./detail-product-api'
);
...
...
@@ -1520,6 +1520,7 @@ const showMainAsync = (data) => {
let
productData
=
yield
productAPI
.
getProductAsync
(
data
.
pid
,
data
.
uid
,
data
.
isStudent
,
data
.
vipLevel
);
if
(
_
.
isEmpty
(
productData
.
data
))
{
logger
.
error
(
'app.product.data api wrong'
);
return
Promise
.
reject
({
code
:
404
,
message
:
'app.product.data api wrong'
...
...
utils/product-process.js
View file @
c7fa9a0
...
...
@@ -297,7 +297,7 @@ exports.processProductList = (list, options) => {
isfew
?
product
.
is_few
=
isfew
:
delete
product
.
is_few
;
}
if
(
options
.
query
&&
_
.
isString
(
product
.
product_name
))
{
let
qreg
=
new
RegExp
(
options
.
query
,
'ig'
);
let
qreg
=
new
RegExp
(
options
.
query
.
replace
(
'\\'
,
'\\\\'
)
,
'ig'
);
product
.
product_name
=
product
.
product_name
.
replace
(
qreg
,
'<span style="color:#c00;">$&</span>'
);
}
...
...
Please
register
or
login
to post a comment