login.js
1.6 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
var authService = require('../service/auth');
var _ = require('lodash');
var uploader = require('../service/upload');
module.exports = {
'/auth': function(req, res) {
var user = req.body.user || '';
var password = req.body.password || '';
authService.callLogin(user, password, res);
},
'/index/ajaxshop': function(req, res) {
var shopId = Number(req.query.shops_id);
var cookie = req.session.gray;
//设置当前的店铺信息
if (req.session.user && req.session.user.auth) {
_.forEach(req.session.user.shopList, function(v, k) {
if (v.id === shopId) {
req.session.user.auth.shopName = v.name;
req.session.user.auth.shopId = shopId;
};
});
}
//调用老系统的切换店铺的接口
authService.change(shopId, cookie, function(err, data) {
if (err) {
res.json({
'code': 500,
'message': 'something wrong!'
})
} else {
res.json({
'code': 200
});
}
});
},
'/ajax/upload': function(req, res) {
uploader.uploadFile(req, res);
},
'/ajax/down': function(req, res) {
uploader.downFile(req, res);
},
'/ajax/ueditor': function(req, res) {
uploader.ueditor(req, res);
},
'/ajax/link/:name': function(req, res) {
uploader.linkFile(req, res);
},
'/proxy':function (req,res) {
uploader.proxy(req,res);
}
}