Authored by 毕凯

更换加密解密算法

'use strict';
const _ = require('lodash');
const Hashids = require('hashids');
const utils = '../../../utils';
const resourcesProcess = require(`${utils}/resources-process`);
const hashids = new Hashids('a64b42acf75a45f8d');
const crypto = global.yoho.crypto;
const key = 'a64b42acf75a45f8';
class CouponList extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -30,7 +31,7 @@ class CouponList extends global.yoho.BaseModel {
_.forEach(result.data, group => {
_.forEach(group.personalityShopCouponBos, coupon => {
if (coupon.couponId) {
coupon.couponId = hashids.encode(coupon.couponId);
coupon.couponId = crypto.encryption(key, coupon.couponId + '');
}
});
});
... ... @@ -41,7 +42,7 @@ class CouponList extends global.yoho.BaseModel {
receive(params) {
if (params.couponid && !_.isNumber(params.couponid)) {
params.couponid = hashids.decode(params.couponid)[0];
params.couponid = crypto.decrypt(key, params.couponid);
}
let options = {
data: {
... ...
... ... @@ -54,7 +54,6 @@
"fast-safe-stringify": "^1.2.0",
"feed": "^1.1.0",
"geetest": "^4.1.2",
"hashids": "^1.1.2",
"lodash": "^4.17.4",
"memory-cache": "^0.2.0",
"moment": "^2.18.1",
... ...