favorite.js
1.49 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* 点赞/关注功能控制器文件
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/5/7
*/
exports.show = function(req, res) {
res.render('pages/template', {
data: data,
layout: '../layouts/layout',
isTemplate: true
});
};
//商品收藏或取消收藏
exports.prod = function(req, res) {
if (req.query.st === '0') {
res.send({
code: 400,
message: "",
data: null
});
} else {
res.send({
code: 200,
message: "",
data: null
});
}
};
//品牌收藏或取消收藏
exports.brand = function(req, res) {
if (req.query.st === '0') {
res.send({
code: 400,
message: "",
data: null
});
} else {
res.send({
code: 200,
message: "",
data: null
});
}
};
//文章点赞或取消点赞
exports.article = function(req, res) {
// if (req.query.st === '0') {
// res.send({
// code: 400,
// message: "",
// data: 99
// });
// } else {
// res.send({
// code: 200,
// message: "",
// data: 100
// });
// }
res.send({
code: 200,
data: parseInt(Math.random() * 100, 10)
});
};
//更新页面浏览数
exports.getPrise = function(req, res) {
res.send({
code: 200,
data: {
views_num: 8
}
});
};