address.js
1.2 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
/**
* 个人中心---地址管理
* @author gaohongwei <hongwei.gao@yoho.cn>
* @date: 2016/9/5
*/
'use strict';
const mRoot = '../models';
const addressService = require(`${mRoot}/address-service`); // user 页 model
/**
* 地址管理列表
*/
exports.index = (req, res, next) => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
let responseData = {
module: 'home',
page: 'address'
};
// 真实数据输出
addressService.getAddressInfo(channel).then(result => {
responseData.headerData = result.headerData;
responseData.meAddressPage = true;
responseData.address = result.address;
res.render('home/address/address', responseData);
}).catch(next);
};
/**
* 编辑修改地址
*/
exports.editAddress = (req, res, next) => {
let uid = '8039836';
// 真实数据输出
addressService.editAddress(req, uid).then(result => {
res.json(result);
}).catch(next);
};
/**
* 添加保存地址
*/
exports.saveAddress = (req, res, next) => {
let uid = '8039836';
// 真实数据输出
addressService.saveAddress(req.body, uid).then(result => {
res.json(result);
}).catch(next);
};