...
|
...
|
@@ -6,22 +6,23 @@ |
|
|
|
|
|
'use strict';
|
|
|
|
|
|
const moment = require('moment');
|
|
|
|
|
|
const library = '../../../library';
|
|
|
const helpers = require(`${library}/helpers`);
|
|
|
|
|
|
const mRoot = '../models';
|
|
|
const service = require(`${mRoot}/detail-service`);
|
|
|
const detailHelper = require(`${mRoot}/detail-helper`);
|
|
|
const detailHelper = require('../models/detail-helper');
|
|
|
|
|
|
/**
|
|
|
* 单个商品详情
|
|
|
*/
|
|
|
module.exports.showMain = (req, res, next) => {
|
|
|
// TODO: 需要修改为正式取 UID 的方式
|
|
|
// TODO: vipLevel = 0; // 用户等级
|
|
|
|
|
|
let pid = 204503;
|
|
|
let pid = 373057;
|
|
|
|
|
|
let uid = req.user.uid || '';
|
|
|
|
|
|
let channel = detailHelper.COOKIE_NAME_BOYS;
|
|
|
|
...
|
...
|
@@ -38,10 +39,10 @@ module.exports.showMain = (req, res, next) => { |
|
|
ua: req.get('user-agent') || '',
|
|
|
channel: channel,
|
|
|
gender: gender,
|
|
|
uid: '',
|
|
|
uid: uid,
|
|
|
vipLevel: 0
|
|
|
}).then((result) => {
|
|
|
res.render('detail', Object.assign({
|
|
|
res.render('product/detail', Object.assign({
|
|
|
module: 'product',
|
|
|
page: 'detail'
|
|
|
}, result));
|
...
|
...
|
@@ -55,9 +56,9 @@ module.exports.indexHotArea = (req, res, next) => { |
|
|
let pid = req.params.productId || 0;
|
|
|
|
|
|
service.indexHotAreaAsync(pid).then(result => {
|
|
|
res.render('hotarea', {
|
|
|
res.render('product/hotarea', {
|
|
|
hotArea: result,
|
|
|
layout:false
|
|
|
layout: false
|
|
|
});
|
|
|
}).catch(next);
|
|
|
};
|
...
|
...
|
@@ -68,11 +69,13 @@ module.exports.indexHotArea = (req, res, next) => { |
|
|
*/
|
|
|
module.exports.indexComment = (req, res, next) => {
|
|
|
let pid = req.params.productId || 0;
|
|
|
|
|
|
let page = req.params.page || 1;
|
|
|
|
|
|
let size = req.params.size || 10;
|
|
|
|
|
|
service.indexCommentAsync(pid, page, size).then(result => {
|
|
|
res.json(result)
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
|
|
};
|
|
|
|
...
|
...
|
@@ -81,10 +84,12 @@ module.exports.indexComment = (req, res, next) => { |
|
|
* json
|
|
|
*/
|
|
|
module.exports.indexConsult = (req, res, next) => {
|
|
|
// TODO: uid
|
|
|
let uid = '';
|
|
|
let uid = req.user.uid || '';
|
|
|
|
|
|
let pid = req.params.productId || 0;
|
|
|
|
|
|
let page = req.params.page || 1;
|
|
|
|
|
|
let size = req.params.size || 10;
|
|
|
|
|
|
service.indexConsultAsync(uid, pid, page, size).then(result => {
|
...
|
...
|
@@ -97,10 +102,10 @@ module.exports.indexConsult = (req, res, next) => { |
|
|
* json
|
|
|
*/
|
|
|
module.exports.createConsult = (req, res, next) => {
|
|
|
let uid = req.user.uid || '';
|
|
|
|
|
|
//TODO: uid
|
|
|
let uid = '';
|
|
|
let pid = req.body.productId || 0;
|
|
|
|
|
|
let content = req.body.content;
|
|
|
|
|
|
if (content && uid) {
|
...
|
...
|
@@ -117,9 +122,9 @@ module.exports.createConsult = (req, res, next) => { |
|
|
} else if (!uid) {
|
|
|
res.json({
|
|
|
code: 403,
|
|
|
message: "用户没有登录",
|
|
|
message: '用户没有登录',
|
|
|
data: {
|
|
|
url: helpers.urlFormat('/signin.html')
|
|
|
url: helpers.urlFormat('signin.html')
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
|