Authored by 毕凯

format code

... ... @@ -57,9 +57,9 @@ exports.getNewArrival = (req, res, next) => {
}).catch(next);
};
exports.getIndexGuide = (req, res,next) => {
exports.getIndexGuide = (req, res, next) => {
channelModel.getIndexGuideData().then(data => {
if(data.code !== 200){
if (data.code !== 200) {
const err = new Error('异常');
throw err;
}
... ... @@ -71,5 +71,5 @@ exports.getIndexGuide = (req, res,next) => {
data.layout = false;
res.render('guide', {list: data});
}).catch(next);
}
}).catch(next);
};
... ...
... ... @@ -30,13 +30,13 @@ const showMain = (req, res, next) => {
let gender = detailHelper.getGenderByCookie(req);
service.showMainAsync({
pid: pid,
gid: gid,
channel: channel,
gender: gender,
uid: uid,
vipLevel: vipLevel
})
pid: pid,
gid: gid,
channel: channel,
gender: gender,
uid: uid,
vipLevel: vipLevel
})
.then(result => {
res.render('product/detail', Object.assign({
module: 'product',
... ...
... ... @@ -42,8 +42,8 @@ const collectProduct = (req, res, next) => {
if (uid && pid) {
switch (type) {
case 'add':
{
productService.createAsync(uid, pid)
{
productService.createAsync(uid, pid)
.then(result => {
if (result.code === 413) {
result.message = '该商品已经收藏';
... ... @@ -52,22 +52,22 @@ const collectProduct = (req, res, next) => {
res.json(result);
})
.catch(next);
break;
}
break;
}
case 'cancel':
{
productService.deleteAsync(uid, pid)
{
productService.deleteAsync(uid, pid)
.then(result => res.json(result))
.catch(next);
break;
}
break;
}
default:
{
res.json({
code: 400,
message: '错误类型'
});
}
{
res.json({
code: 400,
message: '错误类型'
});
}
}
} else if (!uid) {
res.json({
... ...
... ... @@ -15,29 +15,29 @@ const getHomeChannelNav = (channel) => {
switch (channel) {
case 'boys':
{
home = helpers.urlFormat('', '', 'default');
break;
}
{
home = helpers.urlFormat('', '', 'default');
break;
}
case 'girls':
{
home = helpers.urlFormat('/woman', '', 'new');
break;
}
{
home = helpers.urlFormat('/woman', '', 'new');
break;
}
case 'lifestyle':
{
home = helpers.urlFormat('/lifestyle', '', 'new');
break;
}
{
home = helpers.urlFormat('/lifestyle', '', 'new');
break;
}
case 'kids':
{
home = helpers.urlFormat('/kids', '', 'new');
break;
}
{
home = helpers.urlFormat('/kids', '', 'new');
break;
}
default:
{
home = helpers.urlFormat('', '', 'default');
}
{
home = helpers.urlFormat('', '', 'default');
}
}
... ...
... ... @@ -48,6 +48,6 @@ router.get('/detail/consult', detail.indexConsult);// 商品咨询
router.post('/detail/consult', detail.createConsult);// 创建咨询
router.get('/detail/hotarea', detail.indexHotArea);// 商品热区
router.post('/index/favoriteBrand', favorite.changeFavoriteBrand);// 收藏品牌
router.post('/item/togglecollect', favorite.collectProduct); //收藏商品
router.post('/item/togglecollect', favorite.collectProduct); // 收藏商品
module.exports = router;
... ...
... ... @@ -195,5 +195,5 @@ $('.slide-container').slider({
extraInfo();
lazyLoad($('img.lazy'), {
failure_limit: 20
failure_limit: 20
});
... ...