Authored by zhangxiaoru

key 解密

... ... @@ -4,6 +4,12 @@ const headerModel = require('../../../doraemon/models/header');
const shopService = require(`${mRoot}/shop-service`);
const helpers = global.yoho.helpers;
const _ = require('lodash');
const crypto = global.yoho.crypto;
const authcode = require(`${global.utils}/authcode`);
const base64_str_encode = ($input) => {
return $input.replace('+/=', '-_.');
}
const index = (req, res, next) => {
let channel = req.cookies._Channel || 'boys';
... ... @@ -24,6 +30,7 @@ const apply = (req, res, next) => {
let channel = req.cookies._Channel || 'boys';
let uid = req.user.uid;
let loginUrl;
let adpic = {'_project': 'adpic', 'format_str': []};
if (!uid) {
... ... @@ -43,6 +50,7 @@ const apply = (req, res, next) => {
Promise.all([headerModel.requestHeaderData(channel), shopService.applyAction()]).then(result => {
responseData.headerData = result[0].headerData;
responseData.oneCategory = result[1];
responseData.uploadKey = base64_str_encode(authcode(JSON.stringify(adpic), 'yohobuy_upload_system', null, 'encode'));
res.render('apply', responseData);
}).catch(next);
};
... ...