address.js
1005 Bytes
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
'use strict';
// doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/地址管理.md';
const crypto = global.yoho.crypto;
class AddressModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 地址数据
* @param uid
* @return
*/
addressData(uid) {
return this.get({
data: {
method: 'app.address.gethidden',
uid
},
param: {
cache: false
}
}).then(result => {
if (result.code === 200) {
// 加密address_id
result.data.forEach(address => {
address.address_id = encodeURIComponent(crypto.encryption(null, address.address_id));
});
}
return result;
}, () => {
return {code: 500, data: [], message: '地址获取失败'};
});
}
}
module.exports = AddressModel;