detail-comment-service.js
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Created by TaoHuang on 2016/6/14.
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const _ = require('lodash');
const library = '../../../library';
const helpers = require(`${library}/helpers`);
const api = require('./detail-comment-api');
const detailHelper = require('./detail-helper');
const fake = require('./fake');
module.exports.indexAsync = (pid, page, size) => {
return co(function *() {
return fake.fakeComments;
//let commentList = yield api.indexAsync(pid, page, size);
//
//if (!commentList.code || !commentList.code !== 200) {
// return [];
//}
//return commentList.data.map(value => {
// let item = {};
//
// let avatar = detailHelper.DEFAULT_AVATAR_ICO;
//
// if (value.head_ico) {
// avatar = `${detailHelper.IMAGE_SERVICE_URL}${_.last(value.head_ico.split('headimg'))}`;
// avatar = helpers.image(avatar, 30, 30);
// }
//
// item.avatar = avatar;
// item.userName = value.nickname;
// item.color = value.color_name;
// item.size = value.size_name;
// item.comment = value.content || '';
// item.date = value.create_time;
// item.total = value.total;
//
// return item;
//});
})();
};