address.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
'use stict';
// doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/地址管理.md';
const api = global.yoho.API;
const crypto = global.yoho.crypto;
/**
* 地址数据
* @param uid
* @return
* {
* "code":200,
* "data":[
* {
* "area":"江苏省 南京市 浦口区",
* "address":"沿江街道******,
* "consignee":"孟令阶",
* "is_support":"Y",
* "area_code":"320111",
* "mobile":"180****2255",
* "address_id":"6117354", // 会被加密
* "is_default":"N",
* "is_delivery":"Y",
* "zip_code":"",
* "uid":"14616040",
* "phone":"",
* "email":""}
* ],
* "md5":"c35872955397cd0aabff4583cd41ac4b",
* "message":"Address List"
* }
*/
exports.addressData = (uid) => {
let params = {
method: 'app.address.gethidden',
uid
};
let options = {
cache: true
};
return api.get('', params, options)
.then(
result => {
if (result.code === 200) {
// 加密address_id
result.data.forEach(address => {
address.address_id = crypto.encryption(null, address.address_id);
});
}
return result;
}
,
() => {
return {code: 500, data: [], message: '地址获取失败'};
}
);
};