Authored by yyq

地址接口加密

... ... @@ -7,8 +7,6 @@
const _ = require('lodash');
const crypto = global.yoho.crypto;
const pinyin = require('../models/province-pinyin');
const AddressApi = require('../models/address-api');
... ... @@ -47,10 +45,8 @@ module.exports = class extends global.yoho.BaseModel {
dd.default = true;
}
// 地址加密
let id = dd.address_id;
dd.id = dd.address_id;
dd.id = crypto.encryption('', `${id}`);
delete dd.address_id;
delete dd.uid; // 删除uid,用户数据保密
});
... ... @@ -60,7 +56,6 @@ module.exports = class extends global.yoho.BaseModel {
}
delAddressById(uid, id) {
id = parseInt(crypto.decrypt('', `${id}`), 10);
return new AddressApi(this.ctx).delAddressAsync(uid, id);
}
... ... @@ -68,7 +63,7 @@ module.exports = class extends global.yoho.BaseModel {
let addressApiModel = new AddressApi(this.ctx);
if (info.id) {
let id = parseInt(crypto.decrypt('', `${info.id}`), 10);
let id = info.id;
return addressApiModel.updateAddressAsync(uid, id, info.consignee, info.areaCode, info.address,
info.mobile, info.phone, info.zipCode, info.email);
... ... @@ -78,7 +73,7 @@ module.exports = class extends global.yoho.BaseModel {
if (result.code === 200) {
let d = result.data;
d.id = crypto.encryption('', `${d.address_id}`);
d.id = d.address_id;
delete d.address_id;
delete d.uid;
}
... ... @@ -90,8 +85,6 @@ module.exports = class extends global.yoho.BaseModel {
}
setDefaultAddress(uid, id) {
id = parseInt(crypto.decrypt('', `${id}`), 10);
return new AddressApi(this.ctx).setDefaultAddressAsync(uid, id);
}
};
... ...
... ... @@ -8,7 +8,6 @@
const _ = require('lodash');
const helper = global.yoho.helpers;
const crypto = global.yoho.crypto;
const EasypayApi = require('./easypay-api');
const AddressApi = require('./address-api');
... ... @@ -103,7 +102,6 @@ module.exports = class extends global.yoho.BaseModel {
// 订单提交
easypayOrderSubmit(uid, cartType, params, remoteIp) {
params.addressId = crypto.decrypt('', params.addressId);
params.productSkuList = this._getLimitProductData(params);
return new EasypayApi(this.ctx).easypayOrderSubmitAsync(
... ...
... ... @@ -7,7 +7,6 @@
const _ = require('lodash');
const helper = global.yoho.helpers;
const crypto = global.yoho.crypto;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -67,13 +66,10 @@ module.exports = class extends global.yoho.BaseModel {
dd.default = true;
}
// 地址加密
let id = dd.address_id;
dd.id = crypto.encryption('', `${id}`);
dd.id = dd.address_id;
// 设置默认选中地址
if (id === defAddrId) {
if (dd.id === defAddrId) {
dd.selected = true;
}
... ...
... ... @@ -7,7 +7,6 @@
const _ = require('lodash');
const helper = global.yoho.helpers;
const crypto = global.yoho.crypto;
const EnsureApi = require('./order-ensure-api');
const AddressApi = require('./address-api');
... ... @@ -126,10 +125,6 @@ module.exports = class extends global.yoho.BaseModel {
// 订单提交
submit(uid, cartType, p, remoteIp) {
if (p.addressId) {
p.addressId = parseInt(crypto.decrypt('', `${p.addressId}`), 10);
}
return new EnsureApi(this.ctx).orderSubmitAsync(uid, cartType, p.addressId, p.deliveryTime,
p.deliveryWay, p.paymentType, p.paymentId, p.printPrice, p, remoteIp).then(result => {
if (result.code === 200) {
... ...