1
|
'use strict';
|
1
|
'use strict';
|
2
|
|
2
|
|
3
|
const _ = require('lodash');
|
3
|
const _ = require('lodash');
|
4
|
-const Hashids = require('hashids');
|
|
|
5
|
const utils = '../../../utils';
|
4
|
const utils = '../../../utils';
|
6
|
const resourcesProcess = require(`${utils}/resources-process`);
|
5
|
const resourcesProcess = require(`${utils}/resources-process`);
|
7
|
-const hashids = new Hashids('a64b42acf75a45f8d');
|
6
|
+
|
|
|
7
|
+const crypto = global.yoho.crypto;
|
|
|
8
|
+const key = 'a64b42acf75a45f8';
|
8
|
|
9
|
|
9
|
class CouponList extends global.yoho.BaseModel {
|
10
|
class CouponList extends global.yoho.BaseModel {
|
10
|
constructor(ctx) {
|
11
|
constructor(ctx) {
|
|
@@ -30,7 +31,7 @@ class CouponList extends global.yoho.BaseModel { |
|
@@ -30,7 +31,7 @@ class CouponList extends global.yoho.BaseModel { |
30
|
_.forEach(result.data, group => {
|
31
|
_.forEach(result.data, group => {
|
31
|
_.forEach(group.personalityShopCouponBos, coupon => {
|
32
|
_.forEach(group.personalityShopCouponBos, coupon => {
|
32
|
if (coupon.couponId) {
|
33
|
if (coupon.couponId) {
|
33
|
- coupon.couponId = hashids.encode(coupon.couponId);
|
34
|
+ coupon.couponId = crypto.encryption(key, coupon.couponId + '');
|
34
|
}
|
35
|
}
|
35
|
});
|
36
|
});
|
36
|
});
|
37
|
});
|
|
@@ -41,7 +42,7 @@ class CouponList extends global.yoho.BaseModel { |
|
@@ -41,7 +42,7 @@ class CouponList extends global.yoho.BaseModel { |
41
|
|
42
|
|
42
|
receive(params) {
|
43
|
receive(params) {
|
43
|
if (params.couponid && !_.isNumber(params.couponid)) {
|
44
|
if (params.couponid && !_.isNumber(params.couponid)) {
|
44
|
- params.couponid = hashids.decode(params.couponid)[0];
|
45
|
+ params.couponid = crypto.decrypt(key, params.couponid);
|
45
|
}
|
46
|
}
|
46
|
let options = {
|
47
|
let options = {
|
47
|
data: {
|
48
|
data: {
|