Authored by yyq

地址接口加密

@@ -7,8 +7,6 @@ @@ -7,8 +7,6 @@
7 7
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 9
10 -const crypto = global.yoho.crypto;  
11 -  
12 const pinyin = require('../models/province-pinyin'); 10 const pinyin = require('../models/province-pinyin');
13 const AddressApi = require('../models/address-api'); 11 const AddressApi = require('../models/address-api');
14 12
@@ -47,10 +45,8 @@ module.exports = class extends global.yoho.BaseModel { @@ -47,10 +45,8 @@ module.exports = class extends global.yoho.BaseModel {
47 dd.default = true; 45 dd.default = true;
48 } 46 }
49 47
50 - // 地址加密  
51 - let id = dd.address_id; 48 + dd.id = dd.address_id;
52 49
53 - dd.id = crypto.encryption('', `${id}`);  
54 delete dd.address_id; 50 delete dd.address_id;
55 delete dd.uid; // 删除uid,用户数据保密 51 delete dd.uid; // 删除uid,用户数据保密
56 }); 52 });
@@ -60,7 +56,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -60,7 +56,6 @@ module.exports = class extends global.yoho.BaseModel {
60 } 56 }
61 57
62 delAddressById(uid, id) { 58 delAddressById(uid, id) {
63 - id = parseInt(crypto.decrypt('', `${id}`), 10);  
64 return new AddressApi(this.ctx).delAddressAsync(uid, id); 59 return new AddressApi(this.ctx).delAddressAsync(uid, id);
65 } 60 }
66 61
@@ -68,7 +63,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -68,7 +63,7 @@ module.exports = class extends global.yoho.BaseModel {
68 let addressApiModel = new AddressApi(this.ctx); 63 let addressApiModel = new AddressApi(this.ctx);
69 64
70 if (info.id) { 65 if (info.id) {
71 - let id = parseInt(crypto.decrypt('', `${info.id}`), 10); 66 + let id = info.id;
72 67
73 return addressApiModel.updateAddressAsync(uid, id, info.consignee, info.areaCode, info.address, 68 return addressApiModel.updateAddressAsync(uid, id, info.consignee, info.areaCode, info.address,
74 info.mobile, info.phone, info.zipCode, info.email); 69 info.mobile, info.phone, info.zipCode, info.email);
@@ -78,7 +73,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -78,7 +73,7 @@ module.exports = class extends global.yoho.BaseModel {
78 if (result.code === 200) { 73 if (result.code === 200) {
79 let d = result.data; 74 let d = result.data;
80 75
81 - d.id = crypto.encryption('', `${d.address_id}`); 76 + d.id = d.address_id;
82 delete d.address_id; 77 delete d.address_id;
83 delete d.uid; 78 delete d.uid;
84 } 79 }
@@ -90,8 +85,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -90,8 +85,6 @@ module.exports = class extends global.yoho.BaseModel {
90 } 85 }
91 86
92 setDefaultAddress(uid, id) { 87 setDefaultAddress(uid, id) {
93 - id = parseInt(crypto.decrypt('', `${id}`), 10);  
94 -  
95 return new AddressApi(this.ctx).setDefaultAddressAsync(uid, id); 88 return new AddressApi(this.ctx).setDefaultAddressAsync(uid, id);
96 } 89 }
97 }; 90 };
@@ -8,7 +8,6 @@ @@ -8,7 +8,6 @@
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 9
10 const helper = global.yoho.helpers; 10 const helper = global.yoho.helpers;
11 -const crypto = global.yoho.crypto;  
12 11
13 const EasypayApi = require('./easypay-api'); 12 const EasypayApi = require('./easypay-api');
14 const AddressApi = require('./address-api'); 13 const AddressApi = require('./address-api');
@@ -103,7 +102,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -103,7 +102,6 @@ module.exports = class extends global.yoho.BaseModel {
103 102
104 // 订单提交 103 // 订单提交
105 easypayOrderSubmit(uid, cartType, params, remoteIp) { 104 easypayOrderSubmit(uid, cartType, params, remoteIp) {
106 - params.addressId = crypto.decrypt('', params.addressId);  
107 params.productSkuList = this._getLimitProductData(params); 105 params.productSkuList = this._getLimitProductData(params);
108 106
109 return new EasypayApi(this.ctx).easypayOrderSubmitAsync( 107 return new EasypayApi(this.ctx).easypayOrderSubmitAsync(
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 7
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 const helper = global.yoho.helpers; 9 const helper = global.yoho.helpers;
10 -const crypto = global.yoho.crypto;  
11 10
12 module.exports = class extends global.yoho.BaseModel { 11 module.exports = class extends global.yoho.BaseModel {
13 constructor(ctx) { 12 constructor(ctx) {
@@ -67,13 +66,10 @@ module.exports = class extends global.yoho.BaseModel { @@ -67,13 +66,10 @@ module.exports = class extends global.yoho.BaseModel {
67 dd.default = true; 66 dd.default = true;
68 } 67 }
69 68
70 - // 地址加密  
71 - let id = dd.address_id;  
72 -  
73 - dd.id = crypto.encryption('', `${id}`); 69 + dd.id = dd.address_id;
74 70
75 // 设置默认选中地址 71 // 设置默认选中地址
76 - if (id === defAddrId) { 72 + if (dd.id === defAddrId) {
77 dd.selected = true; 73 dd.selected = true;
78 } 74 }
79 75
@@ -7,7 +7,6 @@ @@ -7,7 +7,6 @@
7 7
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 const helper = global.yoho.helpers; 9 const helper = global.yoho.helpers;
10 -const crypto = global.yoho.crypto;  
11 10
12 const EnsureApi = require('./order-ensure-api'); 11 const EnsureApi = require('./order-ensure-api');
13 const AddressApi = require('./address-api'); 12 const AddressApi = require('./address-api');
@@ -126,10 +125,6 @@ module.exports = class extends global.yoho.BaseModel { @@ -126,10 +125,6 @@ module.exports = class extends global.yoho.BaseModel {
126 125
127 // 订单提交 126 // 订单提交
128 submit(uid, cartType, p, remoteIp) { 127 submit(uid, cartType, p, remoteIp) {
129 - if (p.addressId) {  
130 - p.addressId = parseInt(crypto.decrypt('', `${p.addressId}`), 10);  
131 - }  
132 -  
133 return new EnsureApi(this.ctx).orderSubmitAsync(uid, cartType, p.addressId, p.deliveryTime, 128 return new EnsureApi(this.ctx).orderSubmitAsync(uid, cartType, p.addressId, p.deliveryTime,
134 p.deliveryWay, p.paymentType, p.paymentId, p.printPrice, p, remoteIp).then(result => { 129 p.deliveryWay, p.paymentType, p.paymentId, p.printPrice, p, remoteIp).then(result => {
135 if (result.code === 200) { 130 if (result.code === 200) {