...
|
...
|
@@ -5,36 +5,44 @@ |
|
|
const api = global.yoho.API;
|
|
|
const crypto = global.yoho.crypto;
|
|
|
|
|
|
/**
|
|
|
* 地址数据
|
|
|
* @param uid
|
|
|
* @return
|
|
|
*/
|
|
|
exports.addressData = (uid) => {
|
|
|
let params = {
|
|
|
method: 'app.address.gethidden',
|
|
|
uid
|
|
|
};
|
|
|
|
|
|
let options = {
|
|
|
cache: false
|
|
|
};
|
|
|
|
|
|
return api.get('', params, options)
|
|
|
.then(
|
|
|
result => {
|
|
|
if (result.code === 200) {
|
|
|
// 加密address_id
|
|
|
result.data.forEach(address => {
|
|
|
address.address_id = encodeURIComponent(crypto.encryption(null, address.address_id));
|
|
|
});
|
|
|
class AddressModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 地址数据
|
|
|
* @param uid
|
|
|
* @return
|
|
|
*/
|
|
|
addressData(uid) {
|
|
|
let params = {
|
|
|
method: 'app.address.gethidden',
|
|
|
uid
|
|
|
};
|
|
|
|
|
|
let options = {
|
|
|
cache: false
|
|
|
};
|
|
|
|
|
|
return api.get('', params, options)
|
|
|
.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: '地址获取失败'};
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
,
|
|
|
() => {
|
|
|
return {code: 500, data: [], message: '地址获取失败'};
|
|
|
}
|
|
|
);
|
|
|
}; |
|
|
module.exports = AddressModel; |
...
|
...
|
|