|
|
'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: {
|
...
|
...
|
|