Authored by yyq

个人中心我的评论

... ... @@ -5,8 +5,6 @@
'use strict';
const cookie = global.yoho.cookie;
const logger = global.yoho.logger;
const commentModel = require('../models/comment');
const _ = require('lodash');
... ... @@ -14,7 +12,7 @@ const _ = require('lodash');
// comment page
exports.index = (req, res, next) => {
let uid = cookie.getUid(req);
let uid = req.user.uid;
let isComment = req.query.isComment;
let page = req.query.page || 1;
... ... @@ -42,7 +40,7 @@ exports.saveComment = (req, res, next) => {
// get post args
let data = {
uid: cookie.getUid(req),
uid: req.user.uid,
productSkn: req.body.productSkn,
productId: req.body.productId,
content: req.body.content,
... ... @@ -57,5 +55,6 @@ exports.saveComment = (req, res, next) => {
})
.catch(error => {
logger.error(`home--comment: ${error}`);
next();
});
};
... ...
... ... @@ -61,12 +61,13 @@ exports.getCommentList = (uid, isComment, page, limit) => {
erpSkuId: v.erpSkuId
};
if (isComment && v.hasOwnPeroperty('comment')) {
good.remark = v.comment;
if (isComment === v.hasOwnProperty('comment')) {
if (isComment) {
good.remark = v.comment;
}
order.goods.push(good);
commentList.goodsNum++;
}
order.goods.push(good);
commentList.goodsNum++;
});
order.goods.length && commentList.orders.push(order);
... ... @@ -103,7 +104,7 @@ exports.saveShareOrder = data => {
let process = function*() {
let res = api.post('', {
method: 'show.saveShareOrder',
data: data
parameters: JSON.stringify(data)
});
return res;
... ...
... ... @@ -122,7 +122,7 @@ router.get('/QRcode', [getCommonHeader, getHomeNav], personalController.QRcode);
// 我的评论
router.get('/comment', commentController.index);
router.get('/comment', [getCommonHeader, getHomeNav], commentController.index);
router.post('/comment/saveComment', commentController.saveComment);
// 我的咨询
... ...